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 54B94A052F; Wed, 29 Jan 2020 13:26:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DCCB31BFC0; Wed, 29 Jan 2020 13:26:16 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id D19AF1BFBE for ; Wed, 29 Jan 2020 13:26:15 +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 00TCF2UH030586 for ; Wed, 29 Jan 2020 04:26:15 -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=YJGED6ziIoNLmgDpq595lbl/ES5NVaR+cpVmcfBpmj0=; b=LrBWW6Pz6I7v7dokw4z8gfGa8mhNUpwExwCvZIk5i9Z0qPVrAmgrd9dbYf0WaURdWZMj k3vbBtRP8pVAKbC4ptzgSca7rEXvRdfX1eAqeL0UxciPorIISe7DKKKYqnSNRzX55vI9 MRT6qft3QXTc+Kh7oBWPvVqifQs/X5/h9LaC5Kb48tiTaRbyt7Y93gwq+xAefxHmKDkT eB2plH0Ue17c2mQNZICJQ0no9TOPnX3mSiucVgT3F9OicALeO2H9U6aDFhdG1CFg2tI3 jTfMNjUwY2dh5xRfKhSLmoIwbcj1G8jrxRfD7AOnXNp4dXr/V8GAhew6OUmxDnvNiNVT 3g== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2xrp2t92t7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 29 Jan 2020 04:26:15 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 29 Jan 2020 04:26:12 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.175) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Wed, 29 Jan 2020 04:26:12 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RxmYBUYh4IEEY6V6afhi9cVROEH3K2wJx0LG0Y2jcOcZUuR1Xc29yW4amYpyEPE26g7IH88p31ZIBtFRsdd6eq6Vv9uCa+60RwDk6jbvJW9kd2vJ43nTjzSpidbXVg8P/dn77F/JamcG+pwCuqLWzgKV9CRJ89hSDMDTFfELvxitRZLFHxvzKlIHSUv24NKbEaB92i2aLXOuXj0leLMibjvR9510+ssTEpryS2SL+B0CoavQDw910vII3yiHSYB60iOI3FSSYgfDdHbtjHMBLoyU66JdZH/dNRp/OuGk7sN0OIDXQgIbF17xHZebsKCSXiQw8bWDOCxApciIYmib2g== 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=YJGED6ziIoNLmgDpq595lbl/ES5NVaR+cpVmcfBpmj0=; b=kXorhSO8ycW9/jEJKnYxESl5erW/MmxNlb35t7MMeUoGStmrY1U4FlReFAztV9Y9b1yYI9kxkERdRu2YFvDZfQKTeJAOLn/d4gmohGQIjln4Hjw21kisN9v1kj8H8UJkZySSbqUwE5Kiy9/w5z6e9pz0c450AnrYAjBNXKNPsOcrgJbFPMK5a766GGlxsyw53DKB/JbN3h3jbOa56noz8sQJtxU4Eph//OREN9NC9Ms6LiOZzNavDWJBXGI+3UihKiCTI/cHXUk/arrZkw2L0k+iWotzVwUTJiwpvX9KOLumc1Seq0cgO6U+Whget15rJsX/klQbffYjT2s28bxN3A== 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=YJGED6ziIoNLmgDpq595lbl/ES5NVaR+cpVmcfBpmj0=; b=uT6VqGilnnEH6RWWvfHb8XmKwkG2tPd5SnVcyRnm6OHnv171/gTwefGn3ZQnhQCiRkOZGpP6vVHW4XICn+bYkcEzoebesggi1TmnZW5Xgb1a4zWM2zIptFO6kMKP5UxacnSZWjPDfte9acWyH2F923m7mt5xW6fBcuF+Z21WPjs= Received: from MN2PR18MB2848.namprd18.prod.outlook.com (20.179.20.19) by MN2PR18MB2477.namprd18.prod.outlook.com (20.179.81.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.22; Wed, 29 Jan 2020 12:26:11 +0000 Received: from MN2PR18MB2848.namprd18.prod.outlook.com ([fe80::6de0:6ead:9fc:5beb]) by MN2PR18MB2848.namprd18.prod.outlook.com ([fe80::6de0:6ead:9fc:5beb%3]) with mapi id 15.20.2665.027; Wed, 29 Jan 2020 12:26:11 +0000 Received: from outlook.office365.com (115.113.156.2) by PN1PR01CA0093.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.21 via Frontend Transport; Wed, 29 Jan 2020 12:26:10 +0000 From: Harman Kalra To: Sunil Kumar Kori CC: "dev@dpdk.org" Thread-Topic: [PATCH v2 1/1] net/octeontx: fix user supplied index in MAC address add Thread-Index: AQHV1m9aqrHJzsJCG0ipsHfUAHhpwagBkaKA Date: Wed, 29 Jan 2020 12:26:11 +0000 Message-ID: <20200129122552.GA172452@outlook.office365.com> References: <20200124063554.893-1-skori@marvell.com> <20200129064242.8139-1-skori@marvell.com> In-Reply-To: <20200129064242.8139-1-skori@marvell.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR01CA0093.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::33) To MN2PR18MB2848.namprd18.prod.outlook.com (2603:10b6:208:38::19) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [115.113.156.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c2ea2f6c-c446-48af-22fc-08d7a4b66cae x-ms-traffictypediagnostic: MN2PR18MB2477: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2657; x-forefront-prvs: 02973C87BC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(366004)(376002)(136003)(39860400002)(396003)(189003)(199004)(16526019)(8676002)(186003)(316002)(956004)(6862004)(9686003)(55016002)(4326008)(2906002)(66946007)(64756008)(66476007)(6506007)(66556008)(33656002)(66446008)(8936002)(26005)(7696005)(55236004)(478600001)(6636002)(5660300002)(1076003)(81166006)(52116002)(71200400001)(86362001)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2477; H:MN2PR18MB2848.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: JvgOY7D5v3eeVtdRf4dmln/wbAI8PwIr+du5qPX+RiWmqmWXLag6s6mpZVqBOckxc8TBIDEVH+dh/Kf/JSPaSAFyXQCzWYdml988ru5DNtxRC987xKTKkVF/c7x7+6jZGULoSy6O9wPJnhwEsAUU7ydYoyPCO5xdvm5wyl4Am0uGTTftmoUpQ+1WciHgvfggzUh1O+hK0V+TmQXWwjixKbuZKT3py/A7FIXHuA+5D3RApAorbCL/Gu00sWAaY3BOyOcJAUsbdTfadlZ8zwPX/A0kSlhCVMlYXUW8qG44RTmqtuHfaJb42+1g6KV8qaWdY0yvyX5G4F8k+jvBI7FISSKxtJOGqrcGMwXMmf9TbLu2wtyTbgR4/Tzrx2QngnriQ6VyMQZ6zEqco6Wiw8hKqBrehIlafR8wgOl6TlIwgZ6VXv+svR2Uk+19k773gf2E x-ms-exchange-antispam-messagedata: +FPd++rZ5tHzdlb7VkXcycd7Xiz7D/QqpGLi1b7C2wzlR5/n0ZFiLlBXUIHQD8TVtgd+E5FxSSxQyDb2b9HHAw4fa4CaXdIA4Vagr2ABwvszGXdfXm2khP9VcfLLfzsUhRWUcMFwgVGjZgEBYT7Pog== Content-Type: text/plain; charset="us-ascii" Content-ID: <0732EA166603A0428F6ADE1DAA8C4969@namprd18.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: c2ea2f6c-c446-48af-22fc-08d7a4b66cae X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jan 2020 12:26:11.2108 (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: rOZpe2RVJwguVMA87uAl1wpGxqkqjxqU7YT4NYvmlX7TUkYM/5sVWmCaVPpO6HLDqNquDSQ3Ln9GxoGh/tQPgA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2477 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-01-29_02:2020-01-28, 2020-01-29 signatures=0 Subject: Re: [dpdk-dev] [PATCH v2 1/1] net/octeontx: fix user supplied index in MAC address add 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 Wed, Jan 29, 2020 at 12:12:42PM +0530, Sunil Kumar Kori wrote: > Earlier after a successful mac_addr_add operation, index was returned > by underlying layer which was unused but same as provided by DPDK API. >=20 > So API is enhanced to use application provided index location to add > MAC address entry. >=20 > Fixes: e4373bf1b3f5 ("net/octeontx: add unicast MAC filter") >=20 > Signed-off-by: Sunil Kumar Kori Acked-by: Harman Kalra > --- > v2: > - Disable promiscuous mode flag when default MAC address is set. >=20 > drivers/net/octeontx/base/octeontx_bgx.c | 13 ++++++------- > drivers/net/octeontx/base/octeontx_bgx.h | 7 ++++++- > drivers/net/octeontx/octeontx_ethdev.c | 21 +++++++++++++++++---- > 3 files changed, 29 insertions(+), 12 deletions(-) >=20 > diff --git a/drivers/net/octeontx/base/octeontx_bgx.c b/drivers/net/octeo= ntx/base/octeontx_bgx.c > index e70255b11..a2d615fb2 100644 > --- a/drivers/net/octeontx/base/octeontx_bgx.c > +++ b/drivers/net/octeontx/base/octeontx_bgx.c > @@ -245,22 +245,21 @@ octeontx_bgx_port_mac_set(int port, uint8_t *mac_ad= dr) > } > =20 > int > -octeontx_bgx_port_mac_add(int port, uint8_t *mac_addr) > +octeontx_bgx_port_mac_add(int port, uint8_t *mac_addr, int index) > { > + struct octeontx_mbox_bgx_port_mac_filter filter; > struct octeontx_mbox_hdr hdr; > - int resp =3D 0; > int len =3D 6; > - int res =3D 0; > =20 > hdr.coproc =3D OCTEONTX_BGX_COPROC; > hdr.msg =3D MBOX_BGX_PORT_ADD_MACADDR; > hdr.vfid =3D port; > =20 > - res =3D octeontx_mbox_send(&hdr, mac_addr, len, &resp, sizeof(int)); > - if (res < 0) > - return -EACCES; > + memcpy(filter.mac_addr, mac_addr, len); > + filter.index =3D index; > + len =3D sizeof(struct octeontx_mbox_bgx_port_mac_filter); > =20 > - return res; > + return octeontx_mbox_send(&hdr, &filter, len, NULL, 0); > } > =20 > int > diff --git a/drivers/net/octeontx/base/octeontx_bgx.h b/drivers/net/octeo= ntx/base/octeontx_bgx.h > index caaff179c..11c25db67 100644 > --- a/drivers/net/octeontx/base/octeontx_bgx.h > +++ b/drivers/net/octeontx/base/octeontx_bgx.h > @@ -112,6 +112,11 @@ typedef struct octeontx_mbox_bgx_port_stats { > uint64_t rx_jabber_errors; > } octeontx_mbox_bgx_port_stats_t; > =20 > +struct octeontx_mbox_bgx_port_mac_filter { > + uint8_t mac_addr[6]; > + int index; > +}; > + > int octeontx_bgx_port_open(int port, octeontx_mbox_bgx_port_conf_t *conf= ); > int octeontx_bgx_port_close(int port); > int octeontx_bgx_port_start(int port); > @@ -123,7 +128,7 @@ 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_add(int port, uint8_t *mac_addr, int index); > int octeontx_bgx_port_mac_del(int port, uint32_t index); > int octeontx_bgx_port_mac_entries_get(int port); > =20 > diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeont= x/octeontx_ethdev.c > index e23162d8a..f965b946e 100644 > --- a/drivers/net/octeontx/octeontx_ethdev.c > +++ b/drivers/net/octeontx/octeontx_ethdev.c > @@ -573,13 +573,14 @@ octeontx_dev_mac_addr_del(struct rte_eth_dev *dev, = uint32_t index) > static int > octeontx_dev_mac_addr_add(struct rte_eth_dev *dev, > struct rte_ether_addr *mac_addr, > - __rte_unused uint32_t index, > + uint32_t index, > __rte_unused uint32_t vmdq) > { > struct octeontx_nic *nic =3D octeontx_pmd_priv(dev); > int ret; > =20 > - ret =3D octeontx_bgx_port_mac_add(nic->port_id, mac_addr->addr_bytes); > + ret =3D octeontx_bgx_port_mac_add(nic->port_id, mac_addr->addr_bytes, > + index); > if (ret < 0) { > octeontx_log_err("failed to add MAC address filter on port %d", > nic->port_id); > @@ -594,12 +595,21 @@ octeontx_dev_default_mac_addr_set(struct rte_eth_de= v *dev, > struct rte_ether_addr *addr) > { > struct octeontx_nic *nic =3D octeontx_pmd_priv(dev); > + uint8_t prom_mode =3D dev->data->promiscuous; > int ret; > =20 > + dev->data->promiscuous =3D 0; > ret =3D octeontx_bgx_port_mac_set(nic->port_id, addr->addr_bytes); > - if (ret !=3D 0) > + if (ret =3D=3D 0) { > + /* Update same mac address to BGX CAM table */ > + ret =3D octeontx_bgx_port_mac_add(nic->port_id, addr->addr_bytes, > + 0); > + } > + if (ret < 0) { > + dev->data->promiscuous =3D prom_mode; > octeontx_log_err("failed to set MAC address on port %d", > - nic->port_id); > + nic->port_id); > + } > =20 > return ret; > } > @@ -1149,6 +1159,9 @@ octeontx_create(struct rte_vdev_device *dev, int po= rt, uint8_t evdev, > /* Update port_id mac to eth_dev */ > memcpy(data->mac_addrs, nic->mac_addr, RTE_ETHER_ADDR_LEN); > =20 > + /* Update same mac address to BGX CAM table at index 0 */ > + octeontx_bgx_port_mac_add(nic->port_id, nic->mac_addr, 0); > + > PMD_INIT_LOG(DEBUG, "ethdev info: "); > PMD_INIT_LOG(DEBUG, "port %d, port_ena %d ochan %d num_ochan %d tx_q %d= ", > nic->port_id, nic->port_ena, > --=20 > 2.17.1 >=20