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 B89C0A0561; Fri, 28 Feb 2020 21:05:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0DB3B1C012; Fri, 28 Feb 2020 21:05:07 +0100 (CET) Received: from us-smtp-delivery-181.mimecast.com (us-smtp-delivery-181.mimecast.com [63.128.21.181]) by dpdk.org (Postfix) with ESMTP id F2E6E1C00E for ; Fri, 28 Feb 2020 21:05:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rbbn.com; s=mimecast20180816; t=1582920304; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=e2jWyhObIvG+fO1eKgUpMKSL6mW1ZtH6D4uVi46x+94=; b=QB7A8xWW2gO2U7ggbBs+7SJIZwxnD5+t0a55KgtKWiLZ3xVN1vo7CbkbOIZdvUCT9hLa3F fWiRV5RqKESbmNKCfhVztK5pdLTDPl01hezKXdfGt1Xaf4DgOLan4kcNoZkMh0ViNCA+pk SfBdTYLtyug10AiH6s7FS1NWIFRY0oI= Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-52-YtnbLy55Psqx17VHeCIpqg-1; Fri, 28 Feb 2020 15:05:01 -0500 X-MC-Unique: YtnbLy55Psqx17VHeCIpqg-1 Received: from MN2PR03MB4781.namprd03.prod.outlook.com (2603:10b6:208:ae::23) by MN2PR03MB5359.namprd03.prod.outlook.com (2603:10b6:208:19f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2750.22; Fri, 28 Feb 2020 20:04:58 +0000 Received: from MN2PR03MB4781.namprd03.prod.outlook.com ([fe80::347a:449f:f327:3a89]) by MN2PR03MB4781.namprd03.prod.outlook.com ([fe80::347a:449f:f327:3a89%7]) with mapi id 15.20.2750.024; Fri, 28 Feb 2020 20:04:58 +0000 From: "Dey, Souvik" To: rmody@marvell.com, shshaikh@marvell.com, jerinj@marvell.com, ferruh.yigit@intel.com, thomas@monjalon.net Cc: dev@dpdk.org, stable@dpdk.org, "Dey, Souvik" Date: Fri, 28 Feb 2020 15:04:51 -0500 Message-Id: <20200228200451.2128-1-sodey@rbbn.com> X-Mailer: git-send-email 2.9.3.windows.1 X-ClientProxiedBy: BL0PR0102CA0019.prod.exchangelabs.com (2603:10b6:207:18::32) To MN2PR03MB4781.namprd03.prod.outlook.com (2603:10b6:208:ae::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from SODEY-LMA.sonusnet.com (208.45.178.4) by BL0PR0102CA0019.prod.exchangelabs.com (2603:10b6:207:18::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2772.16 via Frontend Transport; Fri, 28 Feb 2020 20:04:58 +0000 X-Mailer: git-send-email 2.9.3.windows.1 X-Originating-IP: [208.45.178.4] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2601bf63-2b99-4d1d-7738-08d7bc897ca9 X-MS-TrafficTypeDiagnostic: MN2PR03MB5359: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-Forefront-PRVS: 0327618309 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(346002)(136003)(39860400002)(376002)(199004)(189003)(6486002)(86362001)(5660300002)(81166006)(6666004)(66476007)(81156014)(8936002)(66946007)(316002)(66556008)(1076003)(6506007)(107886003)(52116002)(6512007)(2906002)(4326008)(26005)(2616005)(36756003)(8676002)(186003)(16526019)(478600001)(956004); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR03MB5359; H:MN2PR03MB4781.namprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ml8QzwC6tWQrvnZC9G2WR8zgda+DJ6DftQFEca/v7/VsqVMPcfMvW20whyrPFLj2Ba7dqnMVrLnU3Ggp0okToAMtVawmEFxkjkKtyv6uy/RoVaDcQ10pWi8ka5z5txsxd1fX2XpRf4wNvVuZ7OGlpKpbVJHiHKAKeJGWTW80BJUd7yMjfasaD6KMDTRk8G9NpIt642Jo41mUZhBIfVG5K8Vq4yK4CNBNdY7et3+vj+NVAiYFQTFBBHnoINqXv498tsm9VHGVUP/yg6uBBimabZTVFzGPktMluD6EnxXx0+p8M+P1QQFtxbaS0eO8aij7J1YndNDlkBL1eV7ypSjjtyFTDoqUCcJeIfzH2kfCKJFW3mKqXM5gyK85zFlZmQfTOlDSEmqYWp4LWWlhGQH4J6kpDX8xSa8GISlTa7cVfqzvxxMkgrYsoJQwxec07mLy X-MS-Exchange-AntiSpam-MessageData: 4dOjlfBexEfYyEBWxgW1sszgrggTRygjJHRjZBf7HKoRfCQVIMrefhneEoQAc+e6wFKbVEbPDnWJDV+QNeyYIG6n6eahB2bePXfQc+XlgKk+d9djQGDpWkA5vXN94Gx+OMXIPvRd4Kz9Gd3xnCAKsQ== X-OriginatorOrg: rbbn.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2601bf63-2b99-4d1d-7738-08d7bc897ca9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2020 20:04:58.5975 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 29a671dc-ed7e-4a54-b1e5-8da1eb495dc3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OAo1nO2nlIwtWmyK2TGNzT5bev2wAEoJ+umzry+4HhAo1ivHQKs9VFkJl8wGnJpX X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR03MB5359 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: rbbn.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] [PATCH] 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" 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. Signed-off-by: "Dey, Souvik" --- drivers/net/bnx2x/bnx2x.h | 3 ++ drivers/net/bnx2x/bnx2x_ethdev.c | 36 ++++++++++++++++++++++++ drivers/net/bnx2x/bnx2x_vfpf.c | 59 ++++++++++++++++++++++++++++++++++++= ++++ drivers/net/bnx2x/bnx2x_vfpf.h | 3 ++ 4 files changed, 101 insertions(+) diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 1dbc981..3f9bb67 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h @@ -1376,6 +1376,9 @@ struct bnx2x_softc { =09uint8_t prio_to_cos[BNX2X_MAX_PRIORITY]; =20 =09int panic; +=09/* Array of Multicast addrs */ +=09struct rte_ether_addr mc_addrs[VF_MAX_MULTICAST_PER_VF]; + uint16_t mc_addrs_num; /* Multicast mac addresses number */ }; /* struct bnx2x_softc */ =20 /* IOCTL sub-commands for edebug and firmware upgrade */ diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_eth= dev.c index 7864b5b..3ce9e7d 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -239,6 +239,10 @@ bnx2x_dev_start(struct rte_eth_dev *dev) =09=09if (rte_intr_enable(&sc->pci_dev->intr_handle)) =09=09=09PMD_DRV_LOG(ERR, sc, "rte_intr_enable failed"); =09} +=09/* Configure the previously stored Multicast address list */ +=09if (IS_VF(sc)) { + bnx2x_vfpf_set_mcast(sc, sc->mc_addrs, sc->mc_addrs_num); + } =20 =09bnx2x_dev_rxtx_init(dev); =20 @@ -266,6 +270,13 @@ bnx2x_dev_stop(struct rte_eth_dev *dev) =09=09bnx2x_periodic_stop(dev); =09} =20 +=09/* Remove the configured Multicast list +=09 * Sending NULL for the list of address and the +=09 * Number is set to 0 denoting DEL_CMD */ +=09if (IS_VF(sc)) { + bnx2x_vfpf_set_mcast(sc, NULL, 0); + } + =09ret =3D bnx2x_nic_unload(sc, UNLOAD_NORMAL, FALSE); =09if (ret) { =09=09PMD_DRV_LOG(DEBUG, sc, "bnx2x_nic_unload failed (%d)", ret); @@ -349,6 +360,30 @@ bnx2x_dev_allmulticast_disable(struct rte_eth_dev *dev= ) } =20 static int +bnx2x_dev_set_mc_addr_list(struct rte_eth_dev *dev, +=09=09struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) +{ + struct bnx2x_softc *sc =3D dev->data->dev_private; + int err; + PMD_INIT_FUNC_TRACE(sc); + /* flush previous addresses */ + err =3D bnx2x_vfpf_set_mcast(sc, NULL, 0); + if (err) + return err; + sc->mc_addrs_num =3D 0; + + /* Add new ones */ + err =3D bnx2x_vfpf_set_mcast(sc, mc_addrs, mc_addrs_num ); + if (err) + return err; + + sc->mc_addrs_num =3D 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_co= mplete) { =09struct bnx2x_softc *sc =3D dev->data->dev_private; @@ -562,6 +597,7 @@ static const struct eth_dev_ops bnx2xvf_eth_dev_ops =3D= { =09.promiscuous_disable =3D bnx2x_promisc_disable, =09.allmulticast_enable =3D bnx2x_dev_allmulticast_enable, =09.allmulticast_disable =3D bnx2x_dev_allmulticast_disable, +=09.set_mc_addr_list =3D bnx2x_dev_set_mc_addr_list, =09.link_update =3D bnx2xvf_dev_link_update, =09.stats_get =3D bnx2x_dev_stats_get, =09.xstats_get =3D bnx2x_dev_xstats_get, diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.= c index 8f7559c..3bcc85d 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -703,3 +703,62 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc) =20 =09return rc; } + +int +bnx2x_vfpf_set_mcast(struct bnx2x_softc *sc, +=09=09=09=09=09struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) +{ + struct vf_set_q_filters_tlv *query; + struct vf_common_reply_tlv *reply =3D &sc->vf2pf_mbox->resp.common_rep= ly; + int rc =3D 0; + uint32_t i =3D 0; + query =3D &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, +=09=09"VF supports not more than %d multicast MAC addresses", +=09=09VF_MAX_MULTICAST_PER_VF); + + rc =3D -EINVAL; + goto out; + } + + for (i =3D 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); + i++; + } + + query->vf_qid =3D 0; + query->flags =3D BNX2X_VF_MULTICAST_CHANGED; + query->multicast_cnt =3D 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 =3D bnx2x_do_req4pf(sc, sc->vf2pf_mbox_mapping.paddr); + if (rc) + goto out; + + if (reply->status !=3D BNX2X_VF_STATUS_SUCCESS) { + PMD_DRV_LOG(ERR, sc, "Set Rx mode/multicast failed: %d", + reply->status); + rc =3D -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 ce0259a..0c7cb65 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_pa= rams *params); +int bnx2x_vfpf_set_mcast(struct bnx2x_softc *sc, +=09=09=09=09struct rte_ether_addr *mc_addrs, +=09=09=09=09uint32_t mc_addrs_num); =20 #endif /* BNX2X_VFPF_H */ --=20 2.9.3.windows.1 ---------------------------------------------------------------------------= -------------------------------------------- Notice: This e-mail together with any attachments may contain information o= f Ribbon Communications Inc. that is confidential and/or proprietary for the sole use of the intended recipie= nt. Any review, disclosure, reliance or distribution by others or forwarding without express permission is strictly= prohibited. If you are not the intended recipient, please notify the sender immediately and then delete all copies,= including any attachments. ---------------------------------------------------------------------------= --------------------------------------------