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 31B13A056D; Tue, 3 Mar 2020 05:18:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 31CAD1C001; Tue, 3 Mar 2020 05:18:57 +0100 (CET) Received: from us-smtp-delivery-181.mimecast.com (us-smtp-delivery-181.mimecast.com [216.205.24.181]) by dpdk.org (Postfix) with ESMTP id D6A671BFEF for ; Tue, 3 Mar 2020 05:18:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rbbn.com; s=mimecast20180816; t=1583209135; 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=aRXjsEnYzMF5P03ot4IEKgUqK6TT9RqaBdiipN0/rmM=; b=T+7TdseTCANTVgvW2XCzJ3SwPa5CTBasjCM3dq3nOiB/8o0852CUbkCsos1mNf+Ra/A7Vd 9ORzK4E+trZ5R0OxVgtss5zKpswzqf5Be9T9h1pltzVX4T47mXXYOkihsvYatR8WO7DvwT 8Wgqo13pIKjQwmNtAaGxf2hVaBcT5EQ= Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-259-i1ir1_sQMaqDzHcGUhj2kQ-1; Mon, 02 Mar 2020 23:18:53 -0500 X-MC-Unique: i1ir1_sQMaqDzHcGUhj2kQ-1 Received: from DM6PR03MB4777.namprd03.prod.outlook.com (2603:10b6:5:18b::26) by DM6PR03MB4714.namprd03.prod.outlook.com (2603:10b6:5:180::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.15; Tue, 3 Mar 2020 04:18:51 +0000 Received: from DM6PR03MB4777.namprd03.prod.outlook.com ([fe80::8a1:2fec:6da4:5789]) by DM6PR03MB4777.namprd03.prod.outlook.com ([fe80::8a1:2fec:6da4:5789%5]) with mapi id 15.20.2772.019; Tue, 3 Mar 2020 04:18:50 +0000 From: sodey@rbbn.com 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: Mon, 2 Mar 2020 23:18:33 -0500 Message-Id: <20200303041833.17912-1-sodey@rbbn.com> X-Mailer: git-send-email 2.9.3.windows.1 X-ClientProxiedBy: MN2PR10CA0010.namprd10.prod.outlook.com (2603:10b6:208:120::23) To DM6PR03MB4777.namprd03.prod.outlook.com (2603:10b6:5:18b::26) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from SODEY-LMA.sonusnet.com (72.70.55.110) by MN2PR10CA0010.namprd10.prod.outlook.com (2603:10b6:208:120::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2772.14 via Frontend Transport; Tue, 3 Mar 2020 04:18:50 +0000 X-Mailer: git-send-email 2.9.3.windows.1 X-Originating-IP: [72.70.55.110] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 20b7613f-30cd-4dc9-cac5-08d7bf29fa0e X-MS-TrafficTypeDiagnostic: DM6PR03MB4714: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-Forefront-PRVS: 03319F6FEF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(39860400002)(366004)(136003)(346002)(396003)(189003)(199004)(2906002)(2616005)(6512007)(9686003)(6666004)(26005)(6506007)(956004)(81156014)(81166006)(52116002)(8936002)(6486002)(186003)(4326008)(16526019)(316002)(66946007)(66476007)(478600001)(66556008)(107886003)(86362001)(8676002)(36756003)(5660300002)(1076003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR03MB4714; H:DM6PR03MB4777.namprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WXusmJemmTSeOnar+v0GHWCZ54Wf3KNODsNORMmW+0Yvfdwe73XqcCLOWsseQzDqbU+rfCsS0jLcBIV+W/gD8y25j31dvQbhfcpNIeAm0elPE/suv2FEnWg434XwkNBRgLzrw/shbdqiYuPekHcn0790cVeY3tV9SCBQ9V6o27b6DmfwIjWtVVxBp8GJqSU20xPKsq5CrGV5yfoLBh656Ptb3wFpCkQUDoFGVG66qBmDAsOnUS32VFnn2Ia5W8U3IR4r6CKvVSP+gVxExovrtHy6neohbO3nBtgtsUbrdOgANinnhxT4Wx7qACoGvUq1/WbzHkOLiAkax4Tz+kMgNXStCNhYEUZ/70IOD0jyf3GasAB1XrZlpowZZCQZ/WgmLiE2yGWVXU4qPm0EyMV0i4Qec5vAOXp9X57LB269BZ6HIwE6lrN15WInlHppl2B3 X-MS-Exchange-AntiSpam-MessageData: h7isiaLKIYFTONwvQWTUJssWjcmgYOH8pURLqMmjnWLIrALN1d1JaU2XN1G/E9HqiZIehPalRN8tkyM0JfJb0CEQo2bUXpzzWLcIBMnyKSmjpkrEk6kwHCmknhqURwTW+ygMTYRub3aDju+BZGWJWA== X-OriginatorOrg: rbbn.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20b7613f-30cd-4dc9-cac5-08d7bf29fa0e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2020 04:18:50.7611 (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: MMlPA9BFAOmnGnMRrAViRBYzSxEJu0ZhtuKN5PHj/Mc7XFBw0ieFbLAr4u/twk/i X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4714 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: rbbn.com Content-Type: text/plain 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" From: "Dey, Souvik" 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 | 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 1dbc981..3cadb5d 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h @@ -1376,6 +1376,10 @@ 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]; +=09/* Multicast mac addresses number */ +=09uint16_t mc_addrs_num; }; /* 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..30588b1 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) =09=09=09PMD_DRV_LOG(ERR, sc, "rte_intr_enable failed"); =09} =20 +=09/* Configure the previously stored Multicast address list */ +=09if (IS_VF(sc)) +=09=09bnx2x_vfpf_set_mcast(sc, sc->mc_addrs, sc->mc_addrs_num); =09bnx2x_dev_rxtx_init(dev); =20 =09bnx2x_print_device_info(sc); @@ -265,7 +268,12 @@ bnx2x_dev_stop(struct rte_eth_dev *dev) =09=09/* stop the periodic callout */ =09=09bnx2x_periodic_stop(dev); =09} - +=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 +=09 */ +=09if (IS_VF(sc)) +=09=09bnx2x_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 +357,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) +{ +=09struct bnx2x_softc *sc =3D dev->data->dev_private; +=09int err; +=09PMD_INIT_FUNC_TRACE(sc); +=09/* flush previous addresses */ +=09err =3D bnx2x_vfpf_set_mcast(sc, NULL, 0); +=09if (err) +=09=09return err; +=09sc->mc_addrs_num =3D 0; + +=09/* Add new ones */ +=09err =3D bnx2x_vfpf_set_mcast(sc, mc_addrs, mc_addrs_num); +=09if (err) +=09=09return err; + +=09sc->mc_addrs_num =3D mc_addrs_num; +=09memcpy(sc->mc_addrs, mc_addrs, mc_addrs_num * sizeof(*mc_addrs)); + +=09return 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 +594,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..097ccfe 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) =20 =09return rc; } + +int +bnx2x_vfpf_set_mcast(struct bnx2x_softc *sc, +=09=09=09=09=09struct rte_ether_addr *mc_addrs, +=09=09=09=09=09uint32_t mc_addrs_num) +{ +=09struct vf_set_q_filters_tlv *query; +=09struct vf_common_reply_tlv *reply =3D +=09=09=09&sc->vf2pf_mbox->resp.common_reply; +=09int rc =3D 0; +=09uint32_t i =3D 0; +=09query =3D &sc->vf2pf_mbox->query[0].set_q_filters; +=09bnx2x_vf_prep(sc, &query->first_tlv, BNX2X_VF_TLV_SET_Q_FILTERS, +=09=09=09=09sizeof(*query)); +=09/* We support PFVF_MAX_MULTICAST_PER_VF mcast addresses tops */ +=09if (mc_addrs_num > VF_MAX_MULTICAST_PER_VF) { +=09=09PMD_DRV_LOG(ERR, sc, +=09=09"VF supports not more than %d multicast MAC addresses", +=09=09VF_MAX_MULTICAST_PER_VF); + +=09=09rc =3D -EINVAL; +=09=09goto out; +=09} + +=09for (i =3D 0; i < mc_addrs_num; i++) { +=09=09PMD_DRV_LOG(DEBUG, sc, "Adding mcast MAC:%x:%x:%x:%x:%x:%x", +=09=09=09=09mc_addrs[i].addr_bytes[0], +=09=09=09=09mc_addrs[i].addr_bytes[1], +=09=09=09=09mc_addrs[i].addr_bytes[2], +=09=09=09=09mc_addrs[i].addr_bytes[3], +=09=09=09=09mc_addrs[i].addr_bytes[4], +=09=09=09=09mc_addrs[i].addr_bytes[5]); +=09=09memcpy(query->multicast[i], mc_addrs[i].addr_bytes, ETH_ALEN); +=09} + +=09query->vf_qid =3D 0; +=09query->flags =3D BNX2X_VF_MULTICAST_CHANGED; +=09query->multicast_cnt =3D i; + +=09/* add list termination tlv */ +=09bnx2x_add_tlv(sc, query, query->first_tlv.tl.length, +=09=09=09=09BNX2X_VF_TLV_LIST_END, +=09=09=09=09sizeof(struct channel_list_end_tlv)); +=09rc =3D bnx2x_do_req4pf(sc, sc->vf2pf_mbox_mapping.paddr); +=09if (rc) +=09=09goto out; + +=09if (reply->status !=3D BNX2X_VF_STATUS_SUCCESS) { +=09=09PMD_DRV_LOG(ERR, sc, "Set Rx mode/multicast failed: %d", +=09=09=09=09reply->status); +=09=09rc =3D -EINVAL; +=09} + +out: +=09bnx2x_vf_finalize(sc, &query->first_tlv); + +=09return rc; +} diff --git a/drivers/net/bnx2x/bnx2x_vfpf.h b/drivers/net/bnx2x/bnx2x_vfpf.= h index ce0259a..7aab8b1 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=09struct rte_ether_addr *mc_addrs, +=09=09=09uint32_t mc_addrs_num); =20 #endif /* BNX2X_VFPF_H */ --=20 2.9.3 ---------------------------------------------------------------------------= -------------------------------------------- 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. ---------------------------------------------------------------------------= --------------------------------------------