From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150052.outbound.protection.outlook.com [40.107.15.52]) by dpdk.org (Postfix) with ESMTP id A1A151B485; Tue, 26 Mar 2019 20:16:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fkjvQH9xfhHreqRS27QLpd2UIGC2AP35cPwaOY3W4uw=; b=yN4xanPen8EaeeglnCLnoe7AM2J2O4imcN6BfLkWZL5QfaODc7seX5F2gops/spwbwe4/N3eZwb/hj6xyHe0PAdhske4CCx6bU7RlJD1Ze0FSZU9pCX+SApEuUc2o1lJSVNXSbetyNB81nuKvm/YEpO39w+O/oP3Ip+FK4Sq3Hw= Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com (52.133.45.150) by AM0PR0502MB4036.eurprd05.prod.outlook.com (52.133.38.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.19; Tue, 26 Mar 2019 19:16:05 +0000 Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::84f3:7e92:7a51:1003]) by AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::84f3:7e92:7a51:1003%2]) with mapi id 15.20.1750.014; Tue, 26 Mar 2019 19:16:05 +0000 From: Shahaf Shuler To: Yongseok Koh CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 1/3] net/mlx4: change device reference for secondary process Thread-Index: AQHU4z+CuhW1dveMIkC5OSxoARfVEaYeSfkA Date: Tue, 26 Mar 2019 19:16:05 +0000 Message-ID: References: <20190307073905.18615-1-yskoh@mellanox.com> <20190325191801.20841-1-yskoh@mellanox.com> <20190325191801.20841-2-yskoh@mellanox.com> In-Reply-To: <20190325191801.20841-2-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2a3d2c06-6ce8-4e71-0acf-08d6b21f7e58 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM0PR0502MB4036; x-ms-traffictypediagnostic: AM0PR0502MB4036: x-microsoft-antispam-prvs: x-forefront-prvs: 09888BC01D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(396003)(136003)(39860400002)(366004)(43544003)(199004)(189003)(14444005)(316002)(5660300002)(102836004)(446003)(186003)(7736002)(256004)(52536014)(486006)(2906002)(33656002)(66066001)(106356001)(76176011)(71190400001)(7696005)(5024004)(6436002)(305945005)(476003)(6506007)(54906003)(81166006)(99286004)(229853002)(97736004)(8936002)(11346002)(81156014)(26005)(86362001)(53946003)(9686003)(4326008)(53936002)(55016002)(105586002)(478600001)(6246003)(68736007)(14454004)(6116002)(74316002)(450100002)(25786009)(3846002)(6862004)(30864003)(71200400001)(6636002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB4036; H:AM0PR0502MB3795.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: hAg+rIDp/bmuQkXegy5/xAB4yaG/ulqlsFehFkmbwL9vmyONrspf2Hx6YtEF+UogS0kRoLi0/En62RQ3hH0Zylzao6gPVUMUbATGyas/3aAhGgZHP9/qdYlBfHgokagvuTdxt4818hRoZqutAz7JZYWFklu/PxW17sm7O5wWPj79q3ucEydn5+JUILoAOOmpYOk5HcaiqvmWybe8dy2ttjMRdsKO2x05ax0tdA9haXxYqYD6zNrfGn3jDAO/yhMw5RnrDgIiomtNwDlul2L/eUo/WSbOHwGyZag6gZCrHXQ55DmHquwrpF1BRffsCFLMHWjygBQA2J2k4B5MGUGKFutj8Vr8cBECCSrDGfgVOF1CcamFvRpyIFvhQYarHjAoe0kQaM4va4PoTmZs7qePnnpw9wslusie+UrF4w7okN4= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a3d2c06-6ce8-4e71-0acf-08d6b21f7e58 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Mar 2019 19:16:05.0961 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB4036 Subject: Re: [dpdk-dev] [PATCH v2 1/3] net/mlx4: change device reference for secondary process 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: , X-List-Received-Date: Tue, 26 Mar 2019 19:16:06 -0000 Monday, March 25, 2019 9:18 PM, Yongseok Koh: > Subject: [dpdk-dev] [PATCH v2 1/3] net/mlx4: change device reference for > secondary process >=20 > rte_eth_devices[] is not shared between primary and secondary process, > but a static array to each process. The reverse pointer of device (priv->= dev) > becomes invalid if mlx4 supports secondary process. Instead, priv has the > pointer to shared data of the device, > struct rte_eth_dev_data *dev_data; >=20 > Two macros are added, > #define PORT_ID(priv) ((priv)->dev_data->port_id) > #define ETH_DEV(priv) (&rte_eth_devices[PORT_ID(priv)]) >=20 > Cc: stable@dpdk.org >=20 > Suggested-by: Raslan Darawsheh > Signed-off-by: Yongseok Koh Acked-by: Shahaf Shuler > --- > drivers/net/mlx4/mlx4.c | 4 ++-- > drivers/net/mlx4/mlx4.h | 5 ++++- > drivers/net/mlx4/mlx4_flow.c | 39 +++++++++++++++++++++----------------- > - > drivers/net/mlx4/mlx4_intr.c | 20 ++++++++++---------- > drivers/net/mlx4/mlx4_mr.c | 8 ++++---- > drivers/net/mlx4/mlx4_rxq.c | 36 +++++++++++++++++++----------------- > drivers/net/mlx4/mlx4_txq.c | 8 ++++---- > 7 files changed, 64 insertions(+), 56 deletions(-) >=20 > diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index > 5ef2e7f41e..bb6ab8ec6e 100644 > --- a/drivers/net/mlx4/mlx4.c > +++ b/drivers/net/mlx4/mlx4.c > @@ -753,11 +753,11 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, > struct rte_pci_device *pci_dev) > * handled by rte_intr_rx_ctl(). > */ > eth_dev->intr_handle =3D &priv->intr_handle; > - priv->dev =3D eth_dev; > + priv->dev_data =3D eth_dev->data; > eth_dev->dev_ops =3D &mlx4_dev_ops; > /* Bring Ethernet device up. */ > DEBUG("forcing Ethernet interface up"); > - mlx4_dev_set_link_up(priv->dev); > + mlx4_dev_set_link_up(eth_dev); > /* Update link status once if waiting for LSC. */ > if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) > mlx4_link_update(eth_dev, 0); > diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index > 7ac49ca672..51566caf7f 100644 > --- a/drivers/net/mlx4/mlx4.h > +++ b/drivers/net/mlx4/mlx4.h > @@ -79,7 +79,7 @@ LIST_HEAD(mlx4_mr_list, mlx4_mr); struct mlx4_priv { > LIST_ENTRY(mlx4_priv) mem_event_cb; > /**< Called by memory event callback. */ > - struct rte_eth_dev *dev; /**< Ethernet device. */ > + struct rte_eth_dev_data *dev_data; /* Pointer to device data. */ > struct ibv_context *ctx; /**< Verbs context. */ > struct ibv_device_attr device_attr; /**< Device properties. */ > struct ibv_pd *pd; /**< Protection Domain. */ @@ -113,6 +113,9 > @@ struct mlx4_priv { > /**< Configured MAC addresses. Unused entries are zeroed. */ }; >=20 > +#define PORT_ID(priv) ((priv)->dev_data->port_id) #define ETH_DEV(priv) > +(&rte_eth_devices[PORT_ID(priv)]) > + > /* mlx4_ethdev.c */ >=20 > int mlx4_get_ifname(const struct mlx4_priv *priv, char > (*ifname)[IF_NAMESIZE]); diff --git a/drivers/net/mlx4/mlx4_flow.c > b/drivers/net/mlx4/mlx4_flow.c index f4df4ab1fb..038dc71d35 100644 > --- a/drivers/net/mlx4/mlx4_flow.c > +++ b/drivers/net/mlx4/mlx4_flow.c > @@ -773,7 +773,7 @@ mlx4_flow_prepare(struct mlx4_priv *priv, > if (flow->rss) > break; > queue =3D action->conf; > - if (queue->index >=3D priv->dev->data- > >nb_rx_queues) { > + if (queue->index >=3D ETH_DEV(priv)->data- > >nb_rx_queues) { > msg =3D "queue target index beyond number > of" > " configured Rx queues"; > goto exit_action_not_supported; > @@ -802,7 +802,7 @@ mlx4_flow_prepare(struct mlx4_priv *priv, > /* Sanity checks. */ > for (i =3D 0; i < rss->queue_num; ++i) > if (rss->queue[i] >=3D > - priv->dev->data->nb_rx_queues) > + ETH_DEV(priv)->data->nb_rx_queues) > break; > if (i !=3D rss->queue_num) { > msg =3D "queue index target beyond number > of" > @@ -1072,8 +1072,8 @@ mlx4_flow_toggle(struct mlx4_priv *priv, > /* Stop at the first nonexistent target queue. */ > for (i =3D 0; i !=3D rss->queues; ++i) > if (rss->queue_id[i] >=3D > - priv->dev->data->nb_rx_queues || > - !priv->dev->data->rx_queues[rss->queue_id[i]]) { > + ETH_DEV(priv)->data->nb_rx_queues || > + !ETH_DEV(priv)->data->rx_queues[rss- > >queue_id[i]]) { > missing =3D 1; > break; > } > @@ -1258,7 +1258,7 @@ static uint16_t > mlx4_flow_internal_next_vlan(struct mlx4_priv *priv, uint16_t vlan) { > while (vlan < 4096) { > - if (priv->dev->data->vlan_filter_conf.ids[vlan / 64] & > + if (ETH_DEV(priv)->data->vlan_filter_conf.ids[vlan / 64] & > (UINT64_C(1) << (vlan % 64))) > return vlan; > ++vlan; > @@ -1335,7 +1335,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct > rte_flow_error *error) > * get RSS by default. > */ > uint32_t queues =3D > - rte_align32pow2(priv->dev->data->nb_rx_queues + 1) >> 1; > + rte_align32pow2(ETH_DEV(priv)->data->nb_rx_queues + 1) > >> 1; > uint16_t queue[queues]; > struct rte_flow_action_rss action_rss =3D { > .func =3D RTE_ETH_HASH_FUNCTION_DEFAULT, @@ -1357,9 > +1357,9 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct > rte_flow_error *error) > }; > struct ether_addr *rule_mac =3D ð_spec.dst; > rte_be16_t *rule_vlan =3D > - (priv->dev->data->dev_conf.rxmode.offloads & > + (ETH_DEV(priv)->data->dev_conf.rxmode.offloads & > DEV_RX_OFFLOAD_VLAN_FILTER) && > - !priv->dev->data->promiscuous ? > + !ETH_DEV(priv)->data->promiscuous ? > &vlan_spec.tci : > NULL; > uint16_t vlan =3D 0; > @@ -1439,7 +1439,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct > rte_flow_error *error) > if (!flow || !flow->internal) { > /* Not found, create a new flow rule. */ > memcpy(rule_mac, mac, sizeof(*mac)); > - flow =3D mlx4_flow_create(priv->dev, &attr, pattern, > + flow =3D mlx4_flow_create(ETH_DEV(priv), &attr, > pattern, > actions, error); > if (!flow) { > err =3D -rte_errno; > @@ -1455,15 +1455,16 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct > rte_flow_error *error) > goto next_vlan; > } > /* Take care of promiscuous and all multicast flow rules. */ > - if (priv->dev->data->promiscuous || priv->dev->data->all_multicast) > { > + if (ETH_DEV(priv)->data->promiscuous || > + ETH_DEV(priv)->data->all_multicast) { > for (flow =3D LIST_FIRST(&priv->flows); > flow && flow->internal; > flow =3D LIST_NEXT(flow, next)) { > - if (priv->dev->data->promiscuous) { > + if (ETH_DEV(priv)->data->promiscuous) { > if (flow->promisc) > break; > } else { > - assert(priv->dev->data->all_multicast); > + assert(ETH_DEV(priv)->data->all_multicast); > if (flow->allmulti) > break; > } > @@ -1477,16 +1478,16 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct > rte_flow_error *error) > } > if (!flow || !flow->internal) { > /* Not found, create a new flow rule. */ > - if (priv->dev->data->promiscuous) { > + if (ETH_DEV(priv)->data->promiscuous) { > pattern[1].spec =3D NULL; > pattern[1].mask =3D NULL; > } else { > - assert(priv->dev->data->all_multicast); > + assert(ETH_DEV(priv)->data->all_multicast); > pattern[1].spec =3D ð_allmulti; > pattern[1].mask =3D ð_allmulti; > } > pattern[2] =3D pattern[3]; > - flow =3D mlx4_flow_create(priv->dev, &attr, pattern, > + flow =3D mlx4_flow_create(ETH_DEV(priv), &attr, > pattern, > actions, error); > if (!flow) { > err =3D -rte_errno; > @@ -1503,7 +1504,8 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct > rte_flow_error *error) > struct rte_flow *next =3D LIST_NEXT(flow, next); >=20 > if (!flow->select) > - claim_zero(mlx4_flow_destroy(priv->dev, flow, > error)); > + claim_zero(mlx4_flow_destroy(ETH_DEV(priv), flow, > + error)); > else > flow->select =3D 0; > flow =3D next; > @@ -1541,7 +1543,8 @@ mlx4_flow_sync(struct mlx4_priv *priv, struct > rte_flow_error *error) > for (flow =3D LIST_FIRST(&priv->flows); > flow && flow->internal; > flow =3D LIST_FIRST(&priv->flows)) > - claim_zero(mlx4_flow_destroy(priv->dev, flow, > error)); > + claim_zero(mlx4_flow_destroy(ETH_DEV(priv), flow, > + error)); > } else { > /* Refresh internal rules. */ > ret =3D mlx4_flow_internal(priv, error); @@ -1574,7 +1577,7 > @@ mlx4_flow_clean(struct mlx4_priv *priv) > struct rte_flow *flow; >=20 > while ((flow =3D LIST_FIRST(&priv->flows))) > - mlx4_flow_destroy(priv->dev, flow, NULL); > + mlx4_flow_destroy(ETH_DEV(priv), flow, NULL); > assert(LIST_EMPTY(&priv->rss)); > } >=20 > diff --git a/drivers/net/mlx4/mlx4_intr.c b/drivers/net/mlx4/mlx4_intr.c > index ec91242196..4f33526755 100644 > --- a/drivers/net/mlx4/mlx4_intr.c > +++ b/drivers/net/mlx4/mlx4_intr.c > @@ -65,7 +65,7 @@ static int > mlx4_rx_intr_vec_enable(struct mlx4_priv *priv) { > unsigned int i; > - unsigned int rxqs_n =3D priv->dev->data->nb_rx_queues; > + unsigned int rxqs_n =3D ETH_DEV(priv)->data->nb_rx_queues; > unsigned int n =3D RTE_MIN(rxqs_n, > (uint32_t)RTE_MAX_RXTX_INTR_VEC_ID); > unsigned int count =3D 0; > struct rte_intr_handle *intr_handle =3D &priv->intr_handle; @@ -79,7 > +79,7 @@ mlx4_rx_intr_vec_enable(struct mlx4_priv *priv) > return -rte_errno; > } > for (i =3D 0; i !=3D n; ++i) { > - struct rxq *rxq =3D priv->dev->data->rx_queues[i]; > + struct rxq *rxq =3D ETH_DEV(priv)->data->rx_queues[i]; >=20 > /* Skip queues that cannot request interrupts. */ > if (!rxq || !rxq->channel) { > @@ -120,12 +120,12 @@ static void > mlx4_link_status_alarm(struct mlx4_priv *priv) { > const struct rte_intr_conf *const intr_conf =3D > - &priv->dev->data->dev_conf.intr_conf; > + Ð_DEV(priv)->data->dev_conf.intr_conf; >=20 > assert(priv->intr_alarm =3D=3D 1); > priv->intr_alarm =3D 0; > if (intr_conf->lsc && !mlx4_link_status_check(priv)) > - _rte_eth_dev_callback_process(priv->dev, > + _rte_eth_dev_callback_process(ETH_DEV(priv), > RTE_ETH_EVENT_INTR_LSC, > NULL); > } > @@ -145,8 +145,8 @@ mlx4_link_status_alarm(struct mlx4_priv *priv) stati= c > int mlx4_link_status_check(struct mlx4_priv *priv) { > - struct rte_eth_link *link =3D &priv->dev->data->dev_link; > - int ret =3D mlx4_link_update(priv->dev, 0); > + struct rte_eth_link *link =3D Ð_DEV(priv)->data->dev_link; > + int ret =3D mlx4_link_update(ETH_DEV(priv), 0); >=20 > if (ret) > return ret; > @@ -185,7 +185,7 @@ mlx4_interrupt_handler(struct mlx4_priv *priv) > uint32_t caught[RTE_DIM(type)] =3D { 0 }; > struct ibv_async_event event; > const struct rte_intr_conf *const intr_conf =3D > - &priv->dev->data->dev_conf.intr_conf; > + Ð_DEV(priv)->data->dev_conf.intr_conf; > unsigned int i; >=20 > /* Read all message and acknowledge them. */ @@ -208,7 +208,7 > @@ mlx4_interrupt_handler(struct mlx4_priv *priv) > } > for (i =3D 0; i !=3D RTE_DIM(caught); ++i) > if (caught[i]) > - _rte_eth_dev_callback_process(priv->dev, type[i], > + _rte_eth_dev_callback_process(ETH_DEV(priv), > type[i], > NULL); > } >=20 > @@ -282,7 +282,7 @@ int > mlx4_intr_install(struct mlx4_priv *priv) { > const struct rte_intr_conf *const intr_conf =3D > - &priv->dev->data->dev_conf.intr_conf; > + Ð_DEV(priv)->data->dev_conf.intr_conf; > int rc; >=20 > mlx4_intr_uninstall(priv); > @@ -381,7 +381,7 @@ int > mlx4_rxq_intr_enable(struct mlx4_priv *priv) { > const struct rte_intr_conf *const intr_conf =3D > - &priv->dev->data->dev_conf.intr_conf; > + Ð_DEV(priv)->data->dev_conf.intr_conf; >=20 > if (intr_conf->rxq && mlx4_rx_intr_vec_enable(priv) < 0) > goto error; > diff --git a/drivers/net/mlx4/mlx4_mr.c b/drivers/net/mlx4/mlx4_mr.c inde= x > 4376ad0b60..e4be46ab2a 100644 > --- a/drivers/net/mlx4/mlx4_mr.c > +++ b/drivers/net/mlx4/mlx4_mr.c > @@ -896,7 +896,7 @@ mlx4_mr_mem_event_cb(enum rte_mem_event > event_type, const void *addr, > rte_rwlock_read_lock(&mlx4_mem_event_rwlock); > /* Iterate all the existing mlx4 devices. */ > LIST_FOREACH(priv, &mlx4_mem_event_cb_list, > mem_event_cb) > - mlx4_mr_mem_event_free_cb(priv->dev, addr, > len); > + mlx4_mr_mem_event_free_cb(ETH_DEV(priv), > addr, len); > rte_rwlock_read_unlock(&mlx4_mem_event_rwlock); > break; > case RTE_MEM_EVENT_ALLOC: > @@ -1028,7 +1028,7 @@ mlx4_rx_addr2mr_bh(struct rxq *rxq, uintptr_t > addr) >=20 > DEBUG("Rx queue %u: miss on top-half, mru=3D%u, head=3D%u, > addr=3D%p", > rxq->stats.idx, mr_ctrl->mru, mr_ctrl->head, (void *)addr); > - return mlx4_mr_addr2mr_bh(priv->dev, mr_ctrl, addr); > + return mlx4_mr_addr2mr_bh(ETH_DEV(priv), mr_ctrl, addr); > } >=20 > /** > @@ -1050,7 +1050,7 @@ mlx4_tx_addr2mr_bh(struct txq *txq, uintptr_t > addr) >=20 > DEBUG("Tx queue %u: miss on top-half, mru=3D%u, head=3D%u, > addr=3D%p", > txq->stats.idx, mr_ctrl->mru, mr_ctrl->head, (void *)addr); > - return mlx4_mr_addr2mr_bh(priv->dev, mr_ctrl, addr); > + return mlx4_mr_addr2mr_bh(ETH_DEV(priv), mr_ctrl, addr); > } >=20 > /** > @@ -1225,7 +1225,7 @@ mlx4_tx_update_ext_mp(struct txq *txq, uintptr_t > addr, struct rte_mempool *mp) > struct mlx4_mr_ctrl *mr_ctrl =3D &txq->mr_ctrl; > struct mlx4_priv *priv =3D txq->priv; >=20 > - mlx4_mr_update_ext_mp(priv->dev, mr_ctrl, mp); > + mlx4_mr_update_ext_mp(ETH_DEV(priv), mr_ctrl, mp); > return mlx4_tx_addr2mr_bh(txq, addr); > } >=20 > diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c > index 3782c6baab..50f33eb0c5 100644 > --- a/drivers/net/mlx4/mlx4_rxq.c > +++ b/drivers/net/mlx4/mlx4_rxq.c > @@ -176,6 +176,7 @@ mlx4_rss_attach(struct mlx4_rss *rss) >=20 > struct ibv_wq *ind_tbl[rss->queues]; > struct mlx4_priv *priv =3D rss->priv; > + struct rte_eth_dev *dev =3D ETH_DEV(priv); > const char *msg; > unsigned int i =3D 0; > int ret; > @@ -189,8 +190,8 @@ mlx4_rss_attach(struct mlx4_rss *rss) > uint16_t id =3D rss->queue_id[i]; > struct rxq *rxq =3D NULL; >=20 > - if (id < priv->dev->data->nb_rx_queues) > - rxq =3D priv->dev->data->rx_queues[id]; > + if (id < dev->data->nb_rx_queues) > + rxq =3D dev->data->rx_queues[id]; > if (!rxq) { > ret =3D EINVAL; > msg =3D "RSS target queue is not configured"; @@ - > 269,7 +270,7 @@ mlx4_rss_attach(struct mlx4_rss *rss) > rss->ind =3D NULL; > } > while (i--) > - mlx4_rxq_detach(priv->dev->data->rx_queues[rss- > >queue_id[i]]); > + mlx4_rxq_detach(dev->data->rx_queues[rss- > >queue_id[i]]); > ERROR("mlx4: %s", msg); > --rss->usecnt; > rte_errno =3D ret; > @@ -291,6 +292,7 @@ void > mlx4_rss_detach(struct mlx4_rss *rss) > { > struct mlx4_priv *priv =3D rss->priv; > + struct rte_eth_dev *dev =3D ETH_DEV(priv); > unsigned int i; >=20 > assert(rss->refcnt); > @@ -303,7 +305,7 @@ mlx4_rss_detach(struct mlx4_rss *rss) > claim_zero(mlx4_glue->destroy_rwq_ind_table(rss->ind)); > rss->ind =3D NULL; > for (i =3D 0; i !=3D rss->queues; ++i) > - mlx4_rxq_detach(priv->dev->data->rx_queues[rss- > >queue_id[i]]); > + mlx4_rxq_detach(dev->data->rx_queues[rss- > >queue_id[i]]); > } >=20 > /** > @@ -329,7 +331,7 @@ mlx4_rss_detach(struct mlx4_rss *rss) int > mlx4_rss_init(struct mlx4_priv *priv) { > - struct rte_eth_dev *dev =3D priv->dev; > + struct rte_eth_dev *dev =3D ETH_DEV(priv); > uint8_t log2_range =3D rte_log2_u32(dev->data->nb_rx_queues); > uint32_t wq_num_prev =3D 0; > const char *msg; > @@ -338,7 +340,7 @@ mlx4_rss_init(struct mlx4_priv *priv) >=20 > if (priv->rss_init) > return 0; > - if (priv->dev->data->nb_rx_queues > priv->hw_rss_max_qps) { > + if (ETH_DEV(priv)->data->nb_rx_queues > priv->hw_rss_max_qps) { > ERROR("RSS does not support more than %d queues", > priv->hw_rss_max_qps); > rte_errno =3D EINVAL; > @@ -356,8 +358,8 @@ mlx4_rss_init(struct mlx4_priv *priv) > rte_errno =3D ret; > return -ret; > } > - for (i =3D 0; i !=3D priv->dev->data->nb_rx_queues; ++i) { > - struct rxq *rxq =3D priv->dev->data->rx_queues[i]; > + for (i =3D 0; i !=3D ETH_DEV(priv)->data->nb_rx_queues; ++i) { > + struct rxq *rxq =3D ETH_DEV(priv)->data->rx_queues[i]; > struct ibv_cq *cq; > struct ibv_wq *wq; > uint32_t wq_num; > @@ -432,7 +434,7 @@ mlx4_rss_init(struct mlx4_priv *priv) > ERROR("cannot initialize common RSS resources (queue %u): %s: > %s", > i, msg, strerror(ret)); > while (i--) { > - struct rxq *rxq =3D priv->dev->data->rx_queues[i]; > + struct rxq *rxq =3D ETH_DEV(priv)->data->rx_queues[i]; >=20 > if (rxq) > mlx4_rxq_detach(rxq); > @@ -457,8 +459,8 @@ mlx4_rss_deinit(struct mlx4_priv *priv) >=20 > if (!priv->rss_init) > return; > - for (i =3D 0; i !=3D priv->dev->data->nb_rx_queues; ++i) { > - struct rxq *rxq =3D priv->dev->data->rx_queues[i]; > + for (i =3D 0; i !=3D ETH_DEV(priv)->data->nb_rx_queues; ++i) { > + struct rxq *rxq =3D ETH_DEV(priv)->data->rx_queues[i]; >=20 > if (rxq) { > assert(rxq->usecnt =3D=3D 1); > @@ -494,7 +496,7 @@ mlx4_rxq_attach(struct rxq *rxq) > } >=20 > struct mlx4_priv *priv =3D rxq->priv; > - struct rte_eth_dev *dev =3D priv->dev; > + struct rte_eth_dev *dev =3D ETH_DEV(priv); > const uint32_t elts_n =3D 1 << rxq->elts_n; > const uint32_t sges_n =3D 1 << rxq->sges_n; > struct rte_mbuf *(*elts)[elts_n] =3D rxq->elts; @@ -561,7 +563,7 @@ > mlx4_rxq_attach(struct rxq *rxq) > } > /* Pre-register Rx mempool. */ > DEBUG("port %u Rx queue %u registering mp %s having %u chunks", > - priv->dev->data->port_id, rxq->stats.idx, > + ETH_DEV(priv)->data->port_id, rxq->stats.idx, > rxq->mp->name, rxq->mp->nb_mem_chunks); > mlx4_mr_update_mp(dev, &rxq->mr_ctrl, rxq->mp); > wqes =3D (volatile struct mlx4_wqe_data_seg (*)[]) @@ -917,11 > +919,11 @@ mlx4_rx_queue_release(void *dpdk_rxq) > if (rxq =3D=3D NULL) > return; > priv =3D rxq->priv; > - for (i =3D 0; i !=3D priv->dev->data->nb_rx_queues; ++i) > - if (priv->dev->data->rx_queues[i] =3D=3D rxq) { > + for (i =3D 0; i !=3D ETH_DEV(priv)->data->nb_rx_queues; ++i) > + if (ETH_DEV(priv)->data->rx_queues[i] =3D=3D rxq) { > DEBUG("%p: removing Rx queue %p from list", > - (void *)priv->dev, (void *)rxq); > - priv->dev->data->rx_queues[i] =3D NULL; > + (void *)ETH_DEV(priv), (void *)rxq); > + ETH_DEV(priv)->data->rx_queues[i] =3D NULL; > break; > } > assert(!rxq->cq); > diff --git a/drivers/net/mlx4/mlx4_txq.c b/drivers/net/mlx4/mlx4_txq.c > index 8142775fc4..352700820d 100644 > --- a/drivers/net/mlx4/mlx4_txq.c > +++ b/drivers/net/mlx4/mlx4_txq.c > @@ -357,11 +357,11 @@ mlx4_tx_queue_release(void *dpdk_txq) > if (txq =3D=3D NULL) > return; > priv =3D txq->priv; > - for (i =3D 0; i !=3D priv->dev->data->nb_tx_queues; ++i) > - if (priv->dev->data->tx_queues[i] =3D=3D txq) { > + for (i =3D 0; i !=3D ETH_DEV(priv)->data->nb_tx_queues; ++i) > + if (ETH_DEV(priv)->data->tx_queues[i] =3D=3D txq) { > DEBUG("%p: removing Tx queue %p from list", > - (void *)priv->dev, (void *)txq); > - priv->dev->data->tx_queues[i] =3D NULL; > + (void *)ETH_DEV(priv), (void *)txq); > + ETH_DEV(priv)->data->tx_queues[i] =3D NULL; > break; > } > mlx4_txq_free_elts(txq); > -- > 2.11.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id C4861A05D3 for ; Tue, 26 Mar 2019 20:16:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8AE3E1B488; Tue, 26 Mar 2019 20:16:08 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150052.outbound.protection.outlook.com [40.107.15.52]) by dpdk.org (Postfix) with ESMTP id A1A151B485; Tue, 26 Mar 2019 20:16:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fkjvQH9xfhHreqRS27QLpd2UIGC2AP35cPwaOY3W4uw=; b=yN4xanPen8EaeeglnCLnoe7AM2J2O4imcN6BfLkWZL5QfaODc7seX5F2gops/spwbwe4/N3eZwb/hj6xyHe0PAdhske4CCx6bU7RlJD1Ze0FSZU9pCX+SApEuUc2o1lJSVNXSbetyNB81nuKvm/YEpO39w+O/oP3Ip+FK4Sq3Hw= Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com (52.133.45.150) by AM0PR0502MB4036.eurprd05.prod.outlook.com (52.133.38.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.19; Tue, 26 Mar 2019 19:16:05 +0000 Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::84f3:7e92:7a51:1003]) by AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::84f3:7e92:7a51:1003%2]) with mapi id 15.20.1750.014; Tue, 26 Mar 2019 19:16:05 +0000 From: Shahaf Shuler To: Yongseok Koh CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 1/3] net/mlx4: change device reference for secondary process Thread-Index: AQHU4z+CuhW1dveMIkC5OSxoARfVEaYeSfkA Date: Tue, 26 Mar 2019 19:16:05 +0000 Message-ID: References: <20190307073905.18615-1-yskoh@mellanox.com> <20190325191801.20841-1-yskoh@mellanox.com> <20190325191801.20841-2-yskoh@mellanox.com> In-Reply-To: <20190325191801.20841-2-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2a3d2c06-6ce8-4e71-0acf-08d6b21f7e58 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM0PR0502MB4036; x-ms-traffictypediagnostic: AM0PR0502MB4036: x-microsoft-antispam-prvs: x-forefront-prvs: 09888BC01D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(396003)(136003)(39860400002)(366004)(43544003)(199004)(189003)(14444005)(316002)(5660300002)(102836004)(446003)(186003)(7736002)(256004)(52536014)(486006)(2906002)(33656002)(66066001)(106356001)(76176011)(71190400001)(7696005)(5024004)(6436002)(305945005)(476003)(6506007)(54906003)(81166006)(99286004)(229853002)(97736004)(8936002)(11346002)(81156014)(26005)(86362001)(53946003)(9686003)(4326008)(53936002)(55016002)(105586002)(478600001)(6246003)(68736007)(14454004)(6116002)(74316002)(450100002)(25786009)(3846002)(6862004)(30864003)(71200400001)(6636002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB4036; H:AM0PR0502MB3795.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: hAg+rIDp/bmuQkXegy5/xAB4yaG/ulqlsFehFkmbwL9vmyONrspf2Hx6YtEF+UogS0kRoLi0/En62RQ3hH0Zylzao6gPVUMUbATGyas/3aAhGgZHP9/qdYlBfHgokagvuTdxt4818hRoZqutAz7JZYWFklu/PxW17sm7O5wWPj79q3ucEydn5+JUILoAOOmpYOk5HcaiqvmWybe8dy2ttjMRdsKO2x05ax0tdA9haXxYqYD6zNrfGn3jDAO/yhMw5RnrDgIiomtNwDlul2L/eUo/WSbOHwGyZag6gZCrHXQ55DmHquwrpF1BRffsCFLMHWjygBQA2J2k4B5MGUGKFutj8Vr8cBECCSrDGfgVOF1CcamFvRpyIFvhQYarHjAoe0kQaM4va4PoTmZs7qePnnpw9wslusie+UrF4w7okN4= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a3d2c06-6ce8-4e71-0acf-08d6b21f7e58 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Mar 2019 19:16:05.0961 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB4036 Subject: Re: [dpdk-dev] [PATCH v2 1/3] net/mlx4: change device reference for secondary process 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" Message-ID: <20190326191605.hynKFiIY1S0wXIBEqNA97iTKoBwErYrruWJOz2Zk2FQ@z> Monday, March 25, 2019 9:18 PM, Yongseok Koh: > Subject: [dpdk-dev] [PATCH v2 1/3] net/mlx4: change device reference for > secondary process >=20 > rte_eth_devices[] is not shared between primary and secondary process, > but a static array to each process. The reverse pointer of device (priv->= dev) > becomes invalid if mlx4 supports secondary process. Instead, priv has the > pointer to shared data of the device, > struct rte_eth_dev_data *dev_data; >=20 > Two macros are added, > #define PORT_ID(priv) ((priv)->dev_data->port_id) > #define ETH_DEV(priv) (&rte_eth_devices[PORT_ID(priv)]) >=20 > Cc: stable@dpdk.org >=20 > Suggested-by: Raslan Darawsheh > Signed-off-by: Yongseok Koh Acked-by: Shahaf Shuler > --- > drivers/net/mlx4/mlx4.c | 4 ++-- > drivers/net/mlx4/mlx4.h | 5 ++++- > drivers/net/mlx4/mlx4_flow.c | 39 +++++++++++++++++++++----------------- > - > drivers/net/mlx4/mlx4_intr.c | 20 ++++++++++---------- > drivers/net/mlx4/mlx4_mr.c | 8 ++++---- > drivers/net/mlx4/mlx4_rxq.c | 36 +++++++++++++++++++----------------- > drivers/net/mlx4/mlx4_txq.c | 8 ++++---- > 7 files changed, 64 insertions(+), 56 deletions(-) >=20 > diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index > 5ef2e7f41e..bb6ab8ec6e 100644 > --- a/drivers/net/mlx4/mlx4.c > +++ b/drivers/net/mlx4/mlx4.c > @@ -753,11 +753,11 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, > struct rte_pci_device *pci_dev) > * handled by rte_intr_rx_ctl(). > */ > eth_dev->intr_handle =3D &priv->intr_handle; > - priv->dev =3D eth_dev; > + priv->dev_data =3D eth_dev->data; > eth_dev->dev_ops =3D &mlx4_dev_ops; > /* Bring Ethernet device up. */ > DEBUG("forcing Ethernet interface up"); > - mlx4_dev_set_link_up(priv->dev); > + mlx4_dev_set_link_up(eth_dev); > /* Update link status once if waiting for LSC. */ > if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) > mlx4_link_update(eth_dev, 0); > diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index > 7ac49ca672..51566caf7f 100644 > --- a/drivers/net/mlx4/mlx4.h > +++ b/drivers/net/mlx4/mlx4.h > @@ -79,7 +79,7 @@ LIST_HEAD(mlx4_mr_list, mlx4_mr); struct mlx4_priv { > LIST_ENTRY(mlx4_priv) mem_event_cb; > /**< Called by memory event callback. */ > - struct rte_eth_dev *dev; /**< Ethernet device. */ > + struct rte_eth_dev_data *dev_data; /* Pointer to device data. */ > struct ibv_context *ctx; /**< Verbs context. */ > struct ibv_device_attr device_attr; /**< Device properties. */ > struct ibv_pd *pd; /**< Protection Domain. */ @@ -113,6 +113,9 > @@ struct mlx4_priv { > /**< Configured MAC addresses. Unused entries are zeroed. */ }; >=20 > +#define PORT_ID(priv) ((priv)->dev_data->port_id) #define ETH_DEV(priv) > +(&rte_eth_devices[PORT_ID(priv)]) > + > /* mlx4_ethdev.c */ >=20 > int mlx4_get_ifname(const struct mlx4_priv *priv, char > (*ifname)[IF_NAMESIZE]); diff --git a/drivers/net/mlx4/mlx4_flow.c > b/drivers/net/mlx4/mlx4_flow.c index f4df4ab1fb..038dc71d35 100644 > --- a/drivers/net/mlx4/mlx4_flow.c > +++ b/drivers/net/mlx4/mlx4_flow.c > @@ -773,7 +773,7 @@ mlx4_flow_prepare(struct mlx4_priv *priv, > if (flow->rss) > break; > queue =3D action->conf; > - if (queue->index >=3D priv->dev->data- > >nb_rx_queues) { > + if (queue->index >=3D ETH_DEV(priv)->data- > >nb_rx_queues) { > msg =3D "queue target index beyond number > of" > " configured Rx queues"; > goto exit_action_not_supported; > @@ -802,7 +802,7 @@ mlx4_flow_prepare(struct mlx4_priv *priv, > /* Sanity checks. */ > for (i =3D 0; i < rss->queue_num; ++i) > if (rss->queue[i] >=3D > - priv->dev->data->nb_rx_queues) > + ETH_DEV(priv)->data->nb_rx_queues) > break; > if (i !=3D rss->queue_num) { > msg =3D "queue index target beyond number > of" > @@ -1072,8 +1072,8 @@ mlx4_flow_toggle(struct mlx4_priv *priv, > /* Stop at the first nonexistent target queue. */ > for (i =3D 0; i !=3D rss->queues; ++i) > if (rss->queue_id[i] >=3D > - priv->dev->data->nb_rx_queues || > - !priv->dev->data->rx_queues[rss->queue_id[i]]) { > + ETH_DEV(priv)->data->nb_rx_queues || > + !ETH_DEV(priv)->data->rx_queues[rss- > >queue_id[i]]) { > missing =3D 1; > break; > } > @@ -1258,7 +1258,7 @@ static uint16_t > mlx4_flow_internal_next_vlan(struct mlx4_priv *priv, uint16_t vlan) { > while (vlan < 4096) { > - if (priv->dev->data->vlan_filter_conf.ids[vlan / 64] & > + if (ETH_DEV(priv)->data->vlan_filter_conf.ids[vlan / 64] & > (UINT64_C(1) << (vlan % 64))) > return vlan; > ++vlan; > @@ -1335,7 +1335,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct > rte_flow_error *error) > * get RSS by default. > */ > uint32_t queues =3D > - rte_align32pow2(priv->dev->data->nb_rx_queues + 1) >> 1; > + rte_align32pow2(ETH_DEV(priv)->data->nb_rx_queues + 1) > >> 1; > uint16_t queue[queues]; > struct rte_flow_action_rss action_rss =3D { > .func =3D RTE_ETH_HASH_FUNCTION_DEFAULT, @@ -1357,9 > +1357,9 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct > rte_flow_error *error) > }; > struct ether_addr *rule_mac =3D ð_spec.dst; > rte_be16_t *rule_vlan =3D > - (priv->dev->data->dev_conf.rxmode.offloads & > + (ETH_DEV(priv)->data->dev_conf.rxmode.offloads & > DEV_RX_OFFLOAD_VLAN_FILTER) && > - !priv->dev->data->promiscuous ? > + !ETH_DEV(priv)->data->promiscuous ? > &vlan_spec.tci : > NULL; > uint16_t vlan =3D 0; > @@ -1439,7 +1439,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct > rte_flow_error *error) > if (!flow || !flow->internal) { > /* Not found, create a new flow rule. */ > memcpy(rule_mac, mac, sizeof(*mac)); > - flow =3D mlx4_flow_create(priv->dev, &attr, pattern, > + flow =3D mlx4_flow_create(ETH_DEV(priv), &attr, > pattern, > actions, error); > if (!flow) { > err =3D -rte_errno; > @@ -1455,15 +1455,16 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct > rte_flow_error *error) > goto next_vlan; > } > /* Take care of promiscuous and all multicast flow rules. */ > - if (priv->dev->data->promiscuous || priv->dev->data->all_multicast) > { > + if (ETH_DEV(priv)->data->promiscuous || > + ETH_DEV(priv)->data->all_multicast) { > for (flow =3D LIST_FIRST(&priv->flows); > flow && flow->internal; > flow =3D LIST_NEXT(flow, next)) { > - if (priv->dev->data->promiscuous) { > + if (ETH_DEV(priv)->data->promiscuous) { > if (flow->promisc) > break; > } else { > - assert(priv->dev->data->all_multicast); > + assert(ETH_DEV(priv)->data->all_multicast); > if (flow->allmulti) > break; > } > @@ -1477,16 +1478,16 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct > rte_flow_error *error) > } > if (!flow || !flow->internal) { > /* Not found, create a new flow rule. */ > - if (priv->dev->data->promiscuous) { > + if (ETH_DEV(priv)->data->promiscuous) { > pattern[1].spec =3D NULL; > pattern[1].mask =3D NULL; > } else { > - assert(priv->dev->data->all_multicast); > + assert(ETH_DEV(priv)->data->all_multicast); > pattern[1].spec =3D ð_allmulti; > pattern[1].mask =3D ð_allmulti; > } > pattern[2] =3D pattern[3]; > - flow =3D mlx4_flow_create(priv->dev, &attr, pattern, > + flow =3D mlx4_flow_create(ETH_DEV(priv), &attr, > pattern, > actions, error); > if (!flow) { > err =3D -rte_errno; > @@ -1503,7 +1504,8 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct > rte_flow_error *error) > struct rte_flow *next =3D LIST_NEXT(flow, next); >=20 > if (!flow->select) > - claim_zero(mlx4_flow_destroy(priv->dev, flow, > error)); > + claim_zero(mlx4_flow_destroy(ETH_DEV(priv), flow, > + error)); > else > flow->select =3D 0; > flow =3D next; > @@ -1541,7 +1543,8 @@ mlx4_flow_sync(struct mlx4_priv *priv, struct > rte_flow_error *error) > for (flow =3D LIST_FIRST(&priv->flows); > flow && flow->internal; > flow =3D LIST_FIRST(&priv->flows)) > - claim_zero(mlx4_flow_destroy(priv->dev, flow, > error)); > + claim_zero(mlx4_flow_destroy(ETH_DEV(priv), flow, > + error)); > } else { > /* Refresh internal rules. */ > ret =3D mlx4_flow_internal(priv, error); @@ -1574,7 +1577,7 > @@ mlx4_flow_clean(struct mlx4_priv *priv) > struct rte_flow *flow; >=20 > while ((flow =3D LIST_FIRST(&priv->flows))) > - mlx4_flow_destroy(priv->dev, flow, NULL); > + mlx4_flow_destroy(ETH_DEV(priv), flow, NULL); > assert(LIST_EMPTY(&priv->rss)); > } >=20 > diff --git a/drivers/net/mlx4/mlx4_intr.c b/drivers/net/mlx4/mlx4_intr.c > index ec91242196..4f33526755 100644 > --- a/drivers/net/mlx4/mlx4_intr.c > +++ b/drivers/net/mlx4/mlx4_intr.c > @@ -65,7 +65,7 @@ static int > mlx4_rx_intr_vec_enable(struct mlx4_priv *priv) { > unsigned int i; > - unsigned int rxqs_n =3D priv->dev->data->nb_rx_queues; > + unsigned int rxqs_n =3D ETH_DEV(priv)->data->nb_rx_queues; > unsigned int n =3D RTE_MIN(rxqs_n, > (uint32_t)RTE_MAX_RXTX_INTR_VEC_ID); > unsigned int count =3D 0; > struct rte_intr_handle *intr_handle =3D &priv->intr_handle; @@ -79,7 > +79,7 @@ mlx4_rx_intr_vec_enable(struct mlx4_priv *priv) > return -rte_errno; > } > for (i =3D 0; i !=3D n; ++i) { > - struct rxq *rxq =3D priv->dev->data->rx_queues[i]; > + struct rxq *rxq =3D ETH_DEV(priv)->data->rx_queues[i]; >=20 > /* Skip queues that cannot request interrupts. */ > if (!rxq || !rxq->channel) { > @@ -120,12 +120,12 @@ static void > mlx4_link_status_alarm(struct mlx4_priv *priv) { > const struct rte_intr_conf *const intr_conf =3D > - &priv->dev->data->dev_conf.intr_conf; > + Ð_DEV(priv)->data->dev_conf.intr_conf; >=20 > assert(priv->intr_alarm =3D=3D 1); > priv->intr_alarm =3D 0; > if (intr_conf->lsc && !mlx4_link_status_check(priv)) > - _rte_eth_dev_callback_process(priv->dev, > + _rte_eth_dev_callback_process(ETH_DEV(priv), > RTE_ETH_EVENT_INTR_LSC, > NULL); > } > @@ -145,8 +145,8 @@ mlx4_link_status_alarm(struct mlx4_priv *priv) stati= c > int mlx4_link_status_check(struct mlx4_priv *priv) { > - struct rte_eth_link *link =3D &priv->dev->data->dev_link; > - int ret =3D mlx4_link_update(priv->dev, 0); > + struct rte_eth_link *link =3D Ð_DEV(priv)->data->dev_link; > + int ret =3D mlx4_link_update(ETH_DEV(priv), 0); >=20 > if (ret) > return ret; > @@ -185,7 +185,7 @@ mlx4_interrupt_handler(struct mlx4_priv *priv) > uint32_t caught[RTE_DIM(type)] =3D { 0 }; > struct ibv_async_event event; > const struct rte_intr_conf *const intr_conf =3D > - &priv->dev->data->dev_conf.intr_conf; > + Ð_DEV(priv)->data->dev_conf.intr_conf; > unsigned int i; >=20 > /* Read all message and acknowledge them. */ @@ -208,7 +208,7 > @@ mlx4_interrupt_handler(struct mlx4_priv *priv) > } > for (i =3D 0; i !=3D RTE_DIM(caught); ++i) > if (caught[i]) > - _rte_eth_dev_callback_process(priv->dev, type[i], > + _rte_eth_dev_callback_process(ETH_DEV(priv), > type[i], > NULL); > } >=20 > @@ -282,7 +282,7 @@ int > mlx4_intr_install(struct mlx4_priv *priv) { > const struct rte_intr_conf *const intr_conf =3D > - &priv->dev->data->dev_conf.intr_conf; > + Ð_DEV(priv)->data->dev_conf.intr_conf; > int rc; >=20 > mlx4_intr_uninstall(priv); > @@ -381,7 +381,7 @@ int > mlx4_rxq_intr_enable(struct mlx4_priv *priv) { > const struct rte_intr_conf *const intr_conf =3D > - &priv->dev->data->dev_conf.intr_conf; > + Ð_DEV(priv)->data->dev_conf.intr_conf; >=20 > if (intr_conf->rxq && mlx4_rx_intr_vec_enable(priv) < 0) > goto error; > diff --git a/drivers/net/mlx4/mlx4_mr.c b/drivers/net/mlx4/mlx4_mr.c inde= x > 4376ad0b60..e4be46ab2a 100644 > --- a/drivers/net/mlx4/mlx4_mr.c > +++ b/drivers/net/mlx4/mlx4_mr.c > @@ -896,7 +896,7 @@ mlx4_mr_mem_event_cb(enum rte_mem_event > event_type, const void *addr, > rte_rwlock_read_lock(&mlx4_mem_event_rwlock); > /* Iterate all the existing mlx4 devices. */ > LIST_FOREACH(priv, &mlx4_mem_event_cb_list, > mem_event_cb) > - mlx4_mr_mem_event_free_cb(priv->dev, addr, > len); > + mlx4_mr_mem_event_free_cb(ETH_DEV(priv), > addr, len); > rte_rwlock_read_unlock(&mlx4_mem_event_rwlock); > break; > case RTE_MEM_EVENT_ALLOC: > @@ -1028,7 +1028,7 @@ mlx4_rx_addr2mr_bh(struct rxq *rxq, uintptr_t > addr) >=20 > DEBUG("Rx queue %u: miss on top-half, mru=3D%u, head=3D%u, > addr=3D%p", > rxq->stats.idx, mr_ctrl->mru, mr_ctrl->head, (void *)addr); > - return mlx4_mr_addr2mr_bh(priv->dev, mr_ctrl, addr); > + return mlx4_mr_addr2mr_bh(ETH_DEV(priv), mr_ctrl, addr); > } >=20 > /** > @@ -1050,7 +1050,7 @@ mlx4_tx_addr2mr_bh(struct txq *txq, uintptr_t > addr) >=20 > DEBUG("Tx queue %u: miss on top-half, mru=3D%u, head=3D%u, > addr=3D%p", > txq->stats.idx, mr_ctrl->mru, mr_ctrl->head, (void *)addr); > - return mlx4_mr_addr2mr_bh(priv->dev, mr_ctrl, addr); > + return mlx4_mr_addr2mr_bh(ETH_DEV(priv), mr_ctrl, addr); > } >=20 > /** > @@ -1225,7 +1225,7 @@ mlx4_tx_update_ext_mp(struct txq *txq, uintptr_t > addr, struct rte_mempool *mp) > struct mlx4_mr_ctrl *mr_ctrl =3D &txq->mr_ctrl; > struct mlx4_priv *priv =3D txq->priv; >=20 > - mlx4_mr_update_ext_mp(priv->dev, mr_ctrl, mp); > + mlx4_mr_update_ext_mp(ETH_DEV(priv), mr_ctrl, mp); > return mlx4_tx_addr2mr_bh(txq, addr); > } >=20 > diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c > index 3782c6baab..50f33eb0c5 100644 > --- a/drivers/net/mlx4/mlx4_rxq.c > +++ b/drivers/net/mlx4/mlx4_rxq.c > @@ -176,6 +176,7 @@ mlx4_rss_attach(struct mlx4_rss *rss) >=20 > struct ibv_wq *ind_tbl[rss->queues]; > struct mlx4_priv *priv =3D rss->priv; > + struct rte_eth_dev *dev =3D ETH_DEV(priv); > const char *msg; > unsigned int i =3D 0; > int ret; > @@ -189,8 +190,8 @@ mlx4_rss_attach(struct mlx4_rss *rss) > uint16_t id =3D rss->queue_id[i]; > struct rxq *rxq =3D NULL; >=20 > - if (id < priv->dev->data->nb_rx_queues) > - rxq =3D priv->dev->data->rx_queues[id]; > + if (id < dev->data->nb_rx_queues) > + rxq =3D dev->data->rx_queues[id]; > if (!rxq) { > ret =3D EINVAL; > msg =3D "RSS target queue is not configured"; @@ - > 269,7 +270,7 @@ mlx4_rss_attach(struct mlx4_rss *rss) > rss->ind =3D NULL; > } > while (i--) > - mlx4_rxq_detach(priv->dev->data->rx_queues[rss- > >queue_id[i]]); > + mlx4_rxq_detach(dev->data->rx_queues[rss- > >queue_id[i]]); > ERROR("mlx4: %s", msg); > --rss->usecnt; > rte_errno =3D ret; > @@ -291,6 +292,7 @@ void > mlx4_rss_detach(struct mlx4_rss *rss) > { > struct mlx4_priv *priv =3D rss->priv; > + struct rte_eth_dev *dev =3D ETH_DEV(priv); > unsigned int i; >=20 > assert(rss->refcnt); > @@ -303,7 +305,7 @@ mlx4_rss_detach(struct mlx4_rss *rss) > claim_zero(mlx4_glue->destroy_rwq_ind_table(rss->ind)); > rss->ind =3D NULL; > for (i =3D 0; i !=3D rss->queues; ++i) > - mlx4_rxq_detach(priv->dev->data->rx_queues[rss- > >queue_id[i]]); > + mlx4_rxq_detach(dev->data->rx_queues[rss- > >queue_id[i]]); > } >=20 > /** > @@ -329,7 +331,7 @@ mlx4_rss_detach(struct mlx4_rss *rss) int > mlx4_rss_init(struct mlx4_priv *priv) { > - struct rte_eth_dev *dev =3D priv->dev; > + struct rte_eth_dev *dev =3D ETH_DEV(priv); > uint8_t log2_range =3D rte_log2_u32(dev->data->nb_rx_queues); > uint32_t wq_num_prev =3D 0; > const char *msg; > @@ -338,7 +340,7 @@ mlx4_rss_init(struct mlx4_priv *priv) >=20 > if (priv->rss_init) > return 0; > - if (priv->dev->data->nb_rx_queues > priv->hw_rss_max_qps) { > + if (ETH_DEV(priv)->data->nb_rx_queues > priv->hw_rss_max_qps) { > ERROR("RSS does not support more than %d queues", > priv->hw_rss_max_qps); > rte_errno =3D EINVAL; > @@ -356,8 +358,8 @@ mlx4_rss_init(struct mlx4_priv *priv) > rte_errno =3D ret; > return -ret; > } > - for (i =3D 0; i !=3D priv->dev->data->nb_rx_queues; ++i) { > - struct rxq *rxq =3D priv->dev->data->rx_queues[i]; > + for (i =3D 0; i !=3D ETH_DEV(priv)->data->nb_rx_queues; ++i) { > + struct rxq *rxq =3D ETH_DEV(priv)->data->rx_queues[i]; > struct ibv_cq *cq; > struct ibv_wq *wq; > uint32_t wq_num; > @@ -432,7 +434,7 @@ mlx4_rss_init(struct mlx4_priv *priv) > ERROR("cannot initialize common RSS resources (queue %u): %s: > %s", > i, msg, strerror(ret)); > while (i--) { > - struct rxq *rxq =3D priv->dev->data->rx_queues[i]; > + struct rxq *rxq =3D ETH_DEV(priv)->data->rx_queues[i]; >=20 > if (rxq) > mlx4_rxq_detach(rxq); > @@ -457,8 +459,8 @@ mlx4_rss_deinit(struct mlx4_priv *priv) >=20 > if (!priv->rss_init) > return; > - for (i =3D 0; i !=3D priv->dev->data->nb_rx_queues; ++i) { > - struct rxq *rxq =3D priv->dev->data->rx_queues[i]; > + for (i =3D 0; i !=3D ETH_DEV(priv)->data->nb_rx_queues; ++i) { > + struct rxq *rxq =3D ETH_DEV(priv)->data->rx_queues[i]; >=20 > if (rxq) { > assert(rxq->usecnt =3D=3D 1); > @@ -494,7 +496,7 @@ mlx4_rxq_attach(struct rxq *rxq) > } >=20 > struct mlx4_priv *priv =3D rxq->priv; > - struct rte_eth_dev *dev =3D priv->dev; > + struct rte_eth_dev *dev =3D ETH_DEV(priv); > const uint32_t elts_n =3D 1 << rxq->elts_n; > const uint32_t sges_n =3D 1 << rxq->sges_n; > struct rte_mbuf *(*elts)[elts_n] =3D rxq->elts; @@ -561,7 +563,7 @@ > mlx4_rxq_attach(struct rxq *rxq) > } > /* Pre-register Rx mempool. */ > DEBUG("port %u Rx queue %u registering mp %s having %u chunks", > - priv->dev->data->port_id, rxq->stats.idx, > + ETH_DEV(priv)->data->port_id, rxq->stats.idx, > rxq->mp->name, rxq->mp->nb_mem_chunks); > mlx4_mr_update_mp(dev, &rxq->mr_ctrl, rxq->mp); > wqes =3D (volatile struct mlx4_wqe_data_seg (*)[]) @@ -917,11 > +919,11 @@ mlx4_rx_queue_release(void *dpdk_rxq) > if (rxq =3D=3D NULL) > return; > priv =3D rxq->priv; > - for (i =3D 0; i !=3D priv->dev->data->nb_rx_queues; ++i) > - if (priv->dev->data->rx_queues[i] =3D=3D rxq) { > + for (i =3D 0; i !=3D ETH_DEV(priv)->data->nb_rx_queues; ++i) > + if (ETH_DEV(priv)->data->rx_queues[i] =3D=3D rxq) { > DEBUG("%p: removing Rx queue %p from list", > - (void *)priv->dev, (void *)rxq); > - priv->dev->data->rx_queues[i] =3D NULL; > + (void *)ETH_DEV(priv), (void *)rxq); > + ETH_DEV(priv)->data->rx_queues[i] =3D NULL; > break; > } > assert(!rxq->cq); > diff --git a/drivers/net/mlx4/mlx4_txq.c b/drivers/net/mlx4/mlx4_txq.c > index 8142775fc4..352700820d 100644 > --- a/drivers/net/mlx4/mlx4_txq.c > +++ b/drivers/net/mlx4/mlx4_txq.c > @@ -357,11 +357,11 @@ mlx4_tx_queue_release(void *dpdk_txq) > if (txq =3D=3D NULL) > return; > priv =3D txq->priv; > - for (i =3D 0; i !=3D priv->dev->data->nb_tx_queues; ++i) > - if (priv->dev->data->tx_queues[i] =3D=3D txq) { > + for (i =3D 0; i !=3D ETH_DEV(priv)->data->nb_tx_queues; ++i) > + if (ETH_DEV(priv)->data->tx_queues[i] =3D=3D txq) { > DEBUG("%p: removing Tx queue %p from list", > - (void *)priv->dev, (void *)txq); > - priv->dev->data->tx_queues[i] =3D NULL; > + (void *)ETH_DEV(priv), (void *)txq); > + ETH_DEV(priv)->data->tx_queues[i] =3D NULL; > break; > } > mlx4_txq_free_elts(txq); > -- > 2.11.0