From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0DC93A0577; Tue, 14 Apr 2020 01:09:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EFA901C038; Tue, 14 Apr 2020 01:09:23 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id EC5621C036 for ; Tue, 14 Apr 2020 01:09:21 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03DN1LXK017486; Mon, 13 Apr 2020 16:09:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=u3R8x4fumiizStaGU6c5uzSo1UgfT3OWoJ/+aDjPGrc=; b=KIFl+HhZYUU8Z2fpU6a55ITZ6sghx0jmN8pL1L1rH9QZOJfmFoQhpzaw7fxO/T+/xBGU 1wW8c/FrVapSpPEXgwq/x6shIbcReLGEyIzjH+XSYx0QmoEM4ueVKoY1KRIJXU7wGBs1 xOWnF6vWTaPx+ZcKT71/6ZvXI1QZjl4NBvZfBzcn+HnLq34FKUooGVwNcu8BFTjfW92c 5dd3OD1PbujNdgww6JOOjfwIAeXpdwdRcP5QawLXeuh+zlvpWjGqtsZGuiTiO7XLUcD3 kD/SslixW9WTfF94s+zgQfUblRHtwUQgn9PY7T3wlGNxFGq626Obg2/sMx7gsaHFezRV jA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 30bddkqybs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 13 Apr 2020 16:09:21 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 13 Apr 2020 16:09:19 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 13 Apr 2020 16:09:18 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 13 Apr 2020 16:09:18 -0700 Received: from irv1user08.caveonetworks.com (unknown [10.104.116.105]) by maili.marvell.com (Postfix) with ESMTP id 085713F703F; Mon, 13 Apr 2020 16:09:17 -0700 (PDT) Received: (from rmody@localhost) by irv1user08.caveonetworks.com (8.14.4/8.14.4/Submit) id 03DN9GWv023497; Mon, 13 Apr 2020 16:09:16 -0700 X-Authentication-Warning: irv1user08.caveonetworks.com: rmody set sender to rmody@marvell.com using -f From: Rasesh Mody To: CC: Souvik Dey , , , , Date: Mon, 13 Apr 2020 16:09:02 -0700 Message-ID: <20200413230902.23421-1-rmody@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200228200451.2128-1-sodey@rbbn.com> References: <20200228200451.2128-1-sodey@rbbn.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-13_11:2020-04-13, 2020-04-13 signatures=0 Subject: [dpdk-dev] [PATCH v2] net/bnx2x: add multicast MAC address filtering X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Souvik Dey Add support the set_mc_addr_list device operation in the bnx2xvf PMD. The configured addresses are stored in the device private area, so they can be flushed before adding new ones. Without this v6 multicast packets were properly forwarded to the Guest VF. v2: * Fixed the Wrong tag issue with check-git-log.sh Signed-off-by: Souvik Dey Acked-by: Rasesh Mody --- drivers/net/bnx2x/bnx2x.h | 4 +++ drivers/net/bnx2x/bnx2x_ethdev.c | 35 ++++++++++++++++++- drivers/net/bnx2x/bnx2x_vfpf.c | 58 ++++++++++++++++++++++++++++++++ drivers/net/bnx2x/bnx2x_vfpf.h | 3 ++ 4 files changed, 99 insertions(+), 1 deletion(-) diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 1dbc98197d..3cadb5d824 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h @@ -1376,6 +1376,10 @@ struct bnx2x_softc { uint8_t prio_to_cos[BNX2X_MAX_PRIORITY]; int panic; + /* Array of Multicast addrs */ + struct rte_ether_addr mc_addrs[VF_MAX_MULTICAST_PER_VF]; + /* Multicast mac addresses number */ + uint16_t mc_addrs_num; }; /* struct bnx2x_softc */ /* IOCTL sub-commands for edebug and firmware upgrade */ diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 7864b5b80a..30588b152f 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -240,6 +240,9 @@ bnx2x_dev_start(struct rte_eth_dev *dev) PMD_DRV_LOG(ERR, sc, "rte_intr_enable failed"); } + /* Configure the previously stored Multicast address list */ + if (IS_VF(sc)) + bnx2x_vfpf_set_mcast(sc, sc->mc_addrs, sc->mc_addrs_num); bnx2x_dev_rxtx_init(dev); bnx2x_print_device_info(sc); @@ -265,7 +268,12 @@ bnx2x_dev_stop(struct rte_eth_dev *dev) /* stop the periodic callout */ bnx2x_periodic_stop(dev); } - + /* Remove the configured Multicast list + * Sending NULL for the list of address and the + * Number is set to 0 denoting DEL_CMD + */ + if (IS_VF(sc)) + bnx2x_vfpf_set_mcast(sc, NULL, 0); ret = bnx2x_nic_unload(sc, UNLOAD_NORMAL, FALSE); if (ret) { PMD_DRV_LOG(DEBUG, sc, "bnx2x_nic_unload failed (%d)", ret); @@ -348,6 +356,30 @@ bnx2x_dev_allmulticast_disable(struct rte_eth_dev *dev) return 0; } +static int +bnx2x_dev_set_mc_addr_list(struct rte_eth_dev *dev, + struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) +{ + struct bnx2x_softc *sc = dev->data->dev_private; + int err; + PMD_INIT_FUNC_TRACE(sc); + /* flush previous addresses */ + err = bnx2x_vfpf_set_mcast(sc, NULL, 0); + if (err) + return err; + sc->mc_addrs_num = 0; + + /* Add new ones */ + err = bnx2x_vfpf_set_mcast(sc, mc_addrs, mc_addrs_num); + if (err) + return err; + + sc->mc_addrs_num = mc_addrs_num; + memcpy(sc->mc_addrs, mc_addrs, mc_addrs_num * sizeof(*mc_addrs)); + + return 0; +} + static int bnx2x_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete) { @@ -562,6 +594,7 @@ static const struct eth_dev_ops bnx2xvf_eth_dev_ops = { .promiscuous_disable = bnx2x_promisc_disable, .allmulticast_enable = bnx2x_dev_allmulticast_enable, .allmulticast_disable = bnx2x_dev_allmulticast_disable, + .set_mc_addr_list = bnx2x_dev_set_mc_addr_list, .link_update = bnx2xvf_dev_link_update, .stats_get = bnx2x_dev_stats_get, .xstats_get = bnx2x_dev_xstats_get, diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c index 8f7559c675..097ccfee19 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -703,3 +703,61 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc) return rc; } + +int +bnx2x_vfpf_set_mcast(struct bnx2x_softc *sc, + struct rte_ether_addr *mc_addrs, + uint32_t mc_addrs_num) +{ + struct vf_set_q_filters_tlv *query; + struct vf_common_reply_tlv *reply = + &sc->vf2pf_mbox->resp.common_reply; + int rc = 0; + uint32_t i = 0; + query = &sc->vf2pf_mbox->query[0].set_q_filters; + bnx2x_vf_prep(sc, &query->first_tlv, BNX2X_VF_TLV_SET_Q_FILTERS, + sizeof(*query)); + /* We support PFVF_MAX_MULTICAST_PER_VF mcast addresses tops */ + if (mc_addrs_num > VF_MAX_MULTICAST_PER_VF) { + PMD_DRV_LOG(ERR, sc, + "VF supports not more than %d multicast MAC addresses", + VF_MAX_MULTICAST_PER_VF); + + rc = -EINVAL; + goto out; + } + + for (i = 0; i < mc_addrs_num; i++) { + PMD_DRV_LOG(DEBUG, sc, "Adding mcast MAC:%x:%x:%x:%x:%x:%x", + mc_addrs[i].addr_bytes[0], + mc_addrs[i].addr_bytes[1], + mc_addrs[i].addr_bytes[2], + mc_addrs[i].addr_bytes[3], + mc_addrs[i].addr_bytes[4], + mc_addrs[i].addr_bytes[5]); + memcpy(query->multicast[i], mc_addrs[i].addr_bytes, ETH_ALEN); + } + + query->vf_qid = 0; + query->flags = BNX2X_VF_MULTICAST_CHANGED; + query->multicast_cnt = i; + + /* add list termination tlv */ + bnx2x_add_tlv(sc, query, query->first_tlv.tl.length, + BNX2X_VF_TLV_LIST_END, + sizeof(struct channel_list_end_tlv)); + rc = bnx2x_do_req4pf(sc, sc->vf2pf_mbox_mapping.paddr); + if (rc) + goto out; + + if (reply->status != BNX2X_VF_STATUS_SUCCESS) { + PMD_DRV_LOG(ERR, sc, "Set Rx mode/multicast failed: %d", + reply->status); + rc = -EINVAL; + } + +out: + bnx2x_vf_finalize(sc, &query->first_tlv); + + return rc; +} diff --git a/drivers/net/bnx2x/bnx2x_vfpf.h b/drivers/net/bnx2x/bnx2x_vfpf.h index ce0259adf1..7aab8b101a 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.h +++ b/drivers/net/bnx2x/bnx2x_vfpf.h @@ -331,5 +331,8 @@ struct bnx2x_vf_mbx_msg { int bnx2x_vf_teardown_queue(struct bnx2x_softc *sc, int qid); int bnx2x_vf_set_mac(struct bnx2x_softc *sc, int set); int bnx2x_vf_config_rss(struct bnx2x_softc *sc, struct ecore_config_rss_params *params); +int bnx2x_vfpf_set_mcast(struct bnx2x_softc *sc, + struct rte_ether_addr *mc_addrs, + uint32_t mc_addrs_num); #endif /* BNX2X_VFPF_H */ -- 2.18.0