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 CBD9BA04FD; Tue, 14 Jan 2020 08:43:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7CE8D1C242; Tue, 14 Jan 2020 08:43:09 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 40ABB1C241 for ; Tue, 14 Jan 2020 08:43:08 +0100 (CET) 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 00E7h4rZ007210; Mon, 13 Jan 2020 23:43:07 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=pfpt0818; bh=neH6PIXMw9sWGq3p8FrYFNEis+f1DJ4QFYzmPPWgmEw=; b=tbGvOGMiKN6o0Sh1CPV11rwTSEJWe2Sy5rZnM6j7FiznPHst82ixJaqikvlp5E1Sz87N DfUTyPwDqIkCQ4JHWnL3sRjLerUTNoW7xkXvaoVFuEdSqzEhCUOT7Q27B2slOLDtUU8L /Zr70H1TvVTDKIO7cQgRT5/b2Qjpzm/VdJivvabSeJmPtSyVtvzcuD+QvM0y3swctKzi 7cn17yKgjk9FJIyCxq4Fng21C3nFbm29IRQrK1M1OuAgLuxwDcIP6k2INgy2357hHv4D d7daDRzXnCPbA6iO4+OgQWEZCZT8YXZMpw0HTxHYOh9Clk1Rcx9Gw9kV0pLI8IQIR/Vm vA== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2xgng4uq1a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 13 Jan 2020 23:43:07 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 13 Jan 2020 23:43:05 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.171) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 13 Jan 2020 23:43:05 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OIJEcO55g+LyUeVNVc5Fpmd7VdUBjnJQflM6crDaSq8ExTuxEnm51utcXFzsXf+sXmR5HvFBMbTD8UjBJyQ8wIszpoMOgvQI5ErmotectY1zdEMvAfX2g1OebGuSK1DtFP1ORPCc1TEZRtkn5QN6TLIlL5oMnHpWGI7u6iEIw2kqmqHEcegg3MTstlaW3mHm6aVcJvQLpQ0j22xtiHROjxc4nEuopbZVNVB2Gd/N5lcob/bCw1eMt40/bnO4imtbgIVG3xyYUPBbFxvPTLIvuLGSJSZZQKwEUiGLBWA7GpgVjQaNZWqxNMbrf90Tl2goR1qmpnZEdPawyNdy4clfeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=neH6PIXMw9sWGq3p8FrYFNEis+f1DJ4QFYzmPPWgmEw=; b=dn8ZPda9VTwLVlvMweYgQk2jR/eX1bU7T3sHA+wgYpjKdA5gteUf7ge6PWp1Dmcejr9MHP1cWTeL6ewwtvQhstOd8s+uISKvIZtqNJnl9S/rVuQKgc8AlpvpVMPufE6MUnpuCnr4NgK8ySTj3xQQOAutROf4ydmlNhNUOKn4bzsTwvXxMAY9Q0p6dO2BLNSAu89sdmeou84r+JoB33fHS2olv36K4bAg8QmEkb/htOzVSnEqGnSOXoIEKbwFAOowRCEWyx6sQAp89e0X0N7XSdKGzvkkoTM85LUd0nHJJUYO+Nea68PVDV4juz+le23iQTEHlfcuAF0v6s3ecqBR+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=neH6PIXMw9sWGq3p8FrYFNEis+f1DJ4QFYzmPPWgmEw=; b=TWIFq166UscoSIM4d9F3nhJ65wRnnLadqz4vigcl2KLmGVfaj0HW13ZzwZLK4/EQBmLam6lcVwTVlnB8CqxbphgSzQrgTBBqNCOfePDRKqbzOHHzXRVxK2ecrEtulocUgIiEoWLBmI/mafpQsNRzVXx7ZEMTWtZnJeZqCuIFmrc= Received: from BYAPR18MB2838.namprd18.prod.outlook.com (20.179.58.18) by BYAPR18MB2837.namprd18.prod.outlook.com (20.179.59.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.13; Tue, 14 Jan 2020 07:43:03 +0000 Received: from BYAPR18MB2838.namprd18.prod.outlook.com ([fe80::e175:b685:2427:c816]) by BYAPR18MB2838.namprd18.prod.outlook.com ([fe80::e175:b685:2427:c816%3]) with mapi id 15.20.2644.015; Tue, 14 Jan 2020 07:43:03 +0000 Received: from outlook.office365.com (115.113.156.2) by PN1PR0101CA0025.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.9 via Frontend Transport; Tue, 14 Jan 2020 07:43:01 +0000 From: Harman Kalra To: Sunil Kumar Kori CC: Jerin Jacob Kollanukkaran , John McNamara , Marko Kovacevic , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/octeontx: add unicast MAC filter Thread-Index: AQHVydkTg7BN9D1ojEyiS8LKy1vABKfpyLcA Date: Tue, 14 Jan 2020 07:43:03 +0000 Message-ID: <20200114074241.GA160869@outlook.office365.com> References: <20200113061644.6320-1-skori@marvell.com> In-Reply-To: <20200113061644.6320-1-skori@marvell.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR0101CA0025.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::11) To BYAPR18MB2838.namprd18.prod.outlook.com (2603:10b6:a03:10a::18) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [115.113.156.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1d72cba1-7fa3-48bf-c1f8-08d798c562cb x-ms-traffictypediagnostic: BYAPR18MB2837: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:356; x-forefront-prvs: 028256169F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(346002)(376002)(136003)(396003)(366004)(189003)(199004)(1076003)(33656002)(86362001)(5660300002)(478600001)(8936002)(8676002)(81156014)(81166006)(6862004)(66946007)(2906002)(66446008)(64756008)(66556008)(66476007)(55016002)(316002)(16526019)(186003)(71200400001)(54906003)(6506007)(55236004)(52116002)(7696005)(9686003)(956004)(6636002)(26005)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR18MB2837; H:BYAPR18MB2838.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1wWhnhe+t0rfjDr4KLRi+XPro+71xrErGIqoX8KPw1N7HRGiQlOWT36/rRBpkclHXzwE+A2ws50sPofkf9lAPCEdvDsfQBhIsrHIYW5CBWoSv4x7G+ZjAR5wJsBz8JeaMxL72C8zK2i7ESiEqxudWn8zy8wUtLkFhO2LhhahIB2gYff3ogK7xKcz3SgItQo1p02P1ZG3gIya4o4ng4QsgKcPYYhXYA0Vco5ZNEVi7vYy5yfgZIwgvDhkjx5DJQXvWi+WM0cu0lTdjytx8WhpAskk1zXLYzVhBthCgTU71OfO7z4VaE0dZfWSrXHj9nCZyPeOVfXC0N+FI+rhzplY0+WUt2rFDfW9jVKPWTVcXA6PLN7krhfN5CI00RdQMdvqUxgGZamFRF2VHQMiRST6U+kgb9SI007PAwSED7oMa/AfdndXjqRdxUhGHKcz6zI4 Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 1d72cba1-7fa3-48bf-c1f8-08d798c562cb X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2020 07:43:03.2632 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: O+ve2Eem4ZXJfxgpKs8De9kBr6KjN7sJqyd59/DacFQJ1AzYpa0BbbdIeuNHGPxWJIXp0K7i5AB44ac8lDyczA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2837 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-01-14_01:2020-01-13, 2020-01-14 signatures=0 Subject: Re: [dpdk-dev] [PATCH] net/octeontx: add unicast MAC filter 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" On Mon, Jan 13, 2020 at 11:46:44AM +0530, Sunil Kumar Kori wrote: > At BGX, DMAC filter table can be enabled to allow defined hosts. > Patch implements 'mac_addr_add' and 'mac_addr_remove' ops to > add/remove MAC filters which uses BGX DMAC filter table. >=20 > Signed-off-by: Sunil Kumar Kori Acked-by: Harman Kalra > --- > doc/guides/nics/features/octeontx.ini | 2 +- > drivers/net/octeontx/base/octeontx_bgx.c | 55 ++++++++++++++++++++++++ > drivers/net/octeontx/base/octeontx_bgx.h | 6 +++ > drivers/net/octeontx/octeontx_ethdev.c | 50 +++++++++++++++++++-- > 4 files changed, 109 insertions(+), 4 deletions(-) >=20 > diff --git a/doc/guides/nics/features/octeontx.ini b/doc/guides/nics/feat= ures/octeontx.ini > index c92d5aa07..323befe59 100644 > --- a/doc/guides/nics/features/octeontx.ini > +++ b/doc/guides/nics/features/octeontx.ini > @@ -10,7 +10,7 @@ Lock-free Tx queue =3D Y > Queue start/stop =3D P > Jumbo frame =3D Y > Promiscuous mode =3D Y > -Unicast MAC filter =3D P > +Unicast MAC filter =3D Y > CRC offload =3D Y > Packet type parsing =3D Y > Basic stats =3D Y > diff --git a/drivers/net/octeontx/base/octeontx_bgx.c b/drivers/net/octeo= ntx/base/octeontx_bgx.c > index 0e2388264..e70255b11 100644 > --- a/drivers/net/octeontx/base/octeontx_bgx.c > +++ b/drivers/net/octeontx/base/octeontx_bgx.c > @@ -243,3 +243,58 @@ octeontx_bgx_port_mac_set(int port, uint8_t *mac_add= r) > =20 > return res; > } > + > +int > +octeontx_bgx_port_mac_add(int port, uint8_t *mac_addr) > +{ > + struct octeontx_mbox_hdr hdr; > + int resp =3D 0; > + int len =3D 6; > + int res =3D 0; > + > + hdr.coproc =3D OCTEONTX_BGX_COPROC; > + hdr.msg =3D MBOX_BGX_PORT_ADD_MACADDR; > + hdr.vfid =3D port; > + > + res =3D octeontx_mbox_send(&hdr, mac_addr, len, &resp, sizeof(int)); > + if (res < 0) > + return -EACCES; > + > + return res; > +} > + > +int > +octeontx_bgx_port_mac_del(int port, uint32_t index) > +{ > + struct octeontx_mbox_hdr hdr; > + int len =3D sizeof(uint32_t); > + int res =3D 0; > + > + hdr.coproc =3D OCTEONTX_BGX_COPROC; > + hdr.msg =3D MBOX_BGX_PORT_DEL_MACADDR; > + hdr.vfid =3D port; > + > + res =3D octeontx_mbox_send(&hdr, &index, len, NULL, 0); > + if (res < 0) > + return -EACCES; > + > + return res; > +} > + > +int > +octeontx_bgx_port_mac_entries_get(int port) > +{ > + struct octeontx_mbox_hdr hdr; > + int resp =3D 6; > + int res =3D 0; > + > + hdr.coproc =3D OCTEONTX_BGX_COPROC; > + hdr.msg =3D MBOX_BGX_PORT_GET_MACADDR_ENTRIES; > + hdr.vfid =3D port; > + > + res =3D octeontx_mbox_send(&hdr, NULL, 0, &resp, sizeof(int)); > + if (res < 0) > + return -EACCES; > + > + return resp; > +} > diff --git a/drivers/net/octeontx/base/octeontx_bgx.h b/drivers/net/octeo= ntx/base/octeontx_bgx.h > index a9bbaf2c3..caaff179c 100644 > --- a/drivers/net/octeontx/base/octeontx_bgx.h > +++ b/drivers/net/octeontx/base/octeontx_bgx.h > @@ -28,6 +28,9 @@ > #define MBOX_BGX_PORT_SET_BCAST 12 > #define MBOX_BGX_PORT_SET_MCAST 13 > #define MBOX_BGX_PORT_SET_MTU 14 > +#define MBOX_BGX_PORT_ADD_MACADDR 15 > +#define MBOX_BGX_PORT_DEL_MACADDR 16 > +#define MBOX_BGX_PORT_GET_MACADDR_ENTRIES 17 > =20 > /* BGX port configuration parameters: */ > typedef struct octeontx_mbox_bgx_port_conf { > @@ -120,6 +123,9 @@ int octeontx_bgx_port_stats_clr(int port); > int octeontx_bgx_port_link_status(int port); > int octeontx_bgx_port_promisc_set(int port, int en); > int octeontx_bgx_port_mac_set(int port, uint8_t *mac_addr); > +int octeontx_bgx_port_mac_add(int port, uint8_t *mac_addr); > +int octeontx_bgx_port_mac_del(int port, uint32_t index); > +int octeontx_bgx_port_mac_entries_get(int port); > =20 > #endif /* __OCTEONTX_BGX_H__ */ > =20 > diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeont= x/octeontx_ethdev.c > index 679803dd4..e23162d8a 100644 > --- a/drivers/net/octeontx/octeontx_ethdev.c > +++ b/drivers/net/octeontx/octeontx_ethdev.c > @@ -558,6 +558,37 @@ octeontx_dev_stats_reset(struct rte_eth_dev *dev) > return octeontx_port_stats_clr(nic); > } > =20 > +static void > +octeontx_dev_mac_addr_del(struct rte_eth_dev *dev, uint32_t index) > +{ > + struct octeontx_nic *nic =3D octeontx_pmd_priv(dev); > + int ret; > + > + ret =3D octeontx_bgx_port_mac_del(nic->port_id, index); > + if (ret !=3D 0) > + octeontx_log_err("failed to del MAC address filter on port %d", > + nic->port_id); > +} > + > +static int > +octeontx_dev_mac_addr_add(struct rte_eth_dev *dev, > + struct rte_ether_addr *mac_addr, > + __rte_unused uint32_t index, > + __rte_unused uint32_t vmdq) > +{ > + struct octeontx_nic *nic =3D octeontx_pmd_priv(dev); > + int ret; > + > + ret =3D octeontx_bgx_port_mac_add(nic->port_id, mac_addr->addr_bytes); > + if (ret < 0) { > + octeontx_log_err("failed to add MAC address filter on port %d", > + nic->port_id); > + return ret; > + } > + > + return 0; > +} > + > static int > octeontx_dev_default_mac_addr_set(struct rte_eth_dev *dev, > struct rte_ether_addr *addr) > @@ -577,7 +608,7 @@ static int > octeontx_dev_info(struct rte_eth_dev *dev, > struct rte_eth_dev_info *dev_info) > { > - RTE_SET_USED(dev); > + struct octeontx_nic *nic =3D octeontx_pmd_priv(dev); > =20 > /* Autonegotiation may be disabled */ > dev_info->speed_capa =3D ETH_LINK_SPEED_FIXED; > @@ -585,7 +616,8 @@ octeontx_dev_info(struct rte_eth_dev *dev, > ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G | > ETH_LINK_SPEED_40G; > =20 > - dev_info->max_mac_addrs =3D 1; > + dev_info->max_mac_addrs =3D > + octeontx_bgx_port_mac_entries_get(nic->port_id); > dev_info->max_rx_pktlen =3D PKI_MAX_PKTLEN; > dev_info->max_rx_queues =3D 1; > dev_info->max_tx_queues =3D PKO_MAX_NUM_DQ; > @@ -986,6 +1018,8 @@ static const struct eth_dev_ops octeontx_dev_ops =3D= { > .link_update =3D octeontx_dev_link_update, > .stats_get =3D octeontx_dev_stats_get, > .stats_reset =3D octeontx_dev_stats_reset, > + .mac_addr_remove =3D octeontx_dev_mac_addr_del, > + .mac_addr_add =3D octeontx_dev_mac_addr_add, > .mac_addr_set =3D octeontx_dev_default_mac_addr_set, > .tx_queue_start =3D octeontx_dev_tx_queue_start, > .tx_queue_stop =3D octeontx_dev_tx_queue_stop, > @@ -1009,6 +1043,7 @@ octeontx_create(struct rte_vdev_device *dev, int po= rt, uint8_t evdev, > struct rte_eth_dev *eth_dev =3D NULL; > struct rte_eth_dev_data *data; > const char *name =3D rte_vdev_device_name(dev); > + int max_entries; > =20 > PMD_INIT_FUNC_TRACE(); > =20 > @@ -1082,7 +1117,16 @@ octeontx_create(struct rte_vdev_device *dev, int p= ort, uint8_t evdev, > data->all_multicast =3D 0; > data->scattered_rx =3D 0; > =20 > - data->mac_addrs =3D rte_zmalloc_socket(octtx_name, RTE_ETHER_ADDR_LEN, = 0, > + /* Get maximum number of supported MAC entries */ > + max_entries =3D octeontx_bgx_port_mac_entries_get(nic->port_id); > + if (max_entries < 0) { > + octeontx_log_err("Failed to get max entries for mac addr"); > + res =3D -ENOTSUP; > + goto err; > + } > + > + data->mac_addrs =3D rte_zmalloc_socket(octtx_name, max_entries * > + RTE_ETHER_ADDR_LEN, 0, > socket_id); > if (data->mac_addrs =3D=3D NULL) { > octeontx_log_err("failed to allocate memory for mac_addrs"); > --=20 > 2.17.1 >=20