From 8d53e9f3c6001dcb2865f6e894da5b54e1418f88 Mon Sep 17 00:00:00 2001 From: Christian Ehrhardt Date: Thu, 4 Jul 2019 10:40:06 +0200 Subject: New upstream version 18.11.2 Change-Id: I23eb4f9179abf1f9c659891f8fddb27ee68ad26b Signed-off-by: Christian Ehrhardt --- drivers/net/mlx4/mlx4.c | 14 ++++----- drivers/net/mlx4/mlx4.h | 26 +++++++++------- drivers/net/mlx4/mlx4_ethdev.c | 38 ++++++++++++------------ drivers/net/mlx4/mlx4_flow.c | 67 ++++++++++++++++++++++-------------------- drivers/net/mlx4/mlx4_flow.h | 6 ++-- drivers/net/mlx4/mlx4_intr.c | 40 ++++++++++++------------- drivers/net/mlx4/mlx4_mr.c | 51 +++++++++++++++----------------- drivers/net/mlx4/mlx4_rxq.c | 56 ++++++++++++++++++----------------- drivers/net/mlx4/mlx4_rxtx.h | 18 ++++++------ drivers/net/mlx4/mlx4_txq.c | 14 ++++----- 10 files changed, 168 insertions(+), 162 deletions(-) (limited to 'drivers/net/mlx4') diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 7f07b8dc..4bc966d5 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -81,7 +81,7 @@ static void mlx4_dev_stop(struct rte_eth_dev *dev); static int mlx4_dev_configure(struct rte_eth_dev *dev) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct rte_flow_error error; int ret; @@ -117,7 +117,7 @@ exit: static int mlx4_dev_start(struct rte_eth_dev *dev) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct rte_flow_error error; int ret; @@ -169,7 +169,7 @@ err: static void mlx4_dev_stop(struct rte_eth_dev *dev) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; if (!priv->started) return; @@ -194,7 +194,7 @@ mlx4_dev_stop(struct rte_eth_dev *dev) static void mlx4_dev_close(struct rte_eth_dev *dev) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; unsigned int i; DEBUG("%p: closing device \"%s\"", @@ -599,7 +599,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) struct ibv_context *ctx = NULL; struct ibv_port_attr port_attr; struct ibv_pd *pd = NULL; - struct priv *priv = NULL; + struct mlx4_priv *priv = NULL; struct rte_eth_dev *eth_dev = NULL; struct ether_addr mac; @@ -752,11 +752,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 = &priv->intr_handle; - priv->dev = eth_dev; + priv->dev_data = eth_dev->data; eth_dev->dev_ops = &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 e6fb934f..fc568eb3 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -72,13 +72,14 @@ struct rxq; struct txq; struct rte_flow; -LIST_HEAD(mlx4_dev_list, priv); +LIST_HEAD(mlx4_dev_list, mlx4_priv); LIST_HEAD(mlx4_mr_list, mlx4_mr); /** Private data structure. */ -struct priv { - LIST_ENTRY(priv) mem_event_cb; /* Called by memory event callback. */ - struct rte_eth_dev *dev; /**< Ethernet device. */ +struct mlx4_priv { + LIST_ENTRY(mlx4_priv) mem_event_cb; + /**< Called by memory event callback. */ + 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. */ @@ -112,11 +113,14 @@ struct priv { /**< Configured MAC addresses. Unused entries are zeroed. */ }; +#define PORT_ID(priv) ((priv)->dev_data->port_id) +#define ETH_DEV(priv) (&rte_eth_devices[PORT_ID(priv)]) + /* mlx4_ethdev.c */ -int mlx4_get_ifname(const struct priv *priv, char (*ifname)[IF_NAMESIZE]); -int mlx4_get_mac(struct priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN]); -int mlx4_mtu_get(struct priv *priv, uint16_t *mtu); +int mlx4_get_ifname(const struct mlx4_priv *priv, char (*ifname)[IF_NAMESIZE]); +int mlx4_get_mac(struct mlx4_priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN]); +int mlx4_mtu_get(struct mlx4_priv *priv, uint16_t *mtu); int mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); int mlx4_dev_set_link_down(struct rte_eth_dev *dev); int mlx4_dev_set_link_up(struct rte_eth_dev *dev); @@ -143,10 +147,10 @@ int mlx4_is_removed(struct rte_eth_dev *dev); /* mlx4_intr.c */ -int mlx4_intr_uninstall(struct priv *priv); -int mlx4_intr_install(struct priv *priv); -int mlx4_rxq_intr_enable(struct priv *priv); -void mlx4_rxq_intr_disable(struct priv *priv); +int mlx4_intr_uninstall(struct mlx4_priv *priv); +int mlx4_intr_install(struct mlx4_priv *priv); +int mlx4_rxq_intr_enable(struct mlx4_priv *priv); +void mlx4_rxq_intr_disable(struct mlx4_priv *priv); int mlx4_rx_intr_disable(struct rte_eth_dev *dev, uint16_t idx); int mlx4_rx_intr_enable(struct rte_eth_dev *dev, uint16_t idx); diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 195a1b6d..084b24e4 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -59,7 +59,7 @@ * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_get_ifname(const struct priv *priv, char (*ifname)[IF_NAMESIZE]) +mlx4_get_ifname(const struct mlx4_priv *priv, char (*ifname)[IF_NAMESIZE]) { DIR *dir; struct dirent *dent; @@ -146,7 +146,7 @@ try_dev_id: * 0 on success, negative errno value otherwise and rte_errno is set. */ static int -mlx4_ifreq(const struct priv *priv, int req, struct ifreq *ifr) +mlx4_ifreq(const struct mlx4_priv *priv, int req, struct ifreq *ifr) { int sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); int ret; @@ -176,7 +176,7 @@ mlx4_ifreq(const struct priv *priv, int req, struct ifreq *ifr) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_get_mac(struct priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN]) +mlx4_get_mac(struct mlx4_priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN]) { struct ifreq request; int ret = mlx4_ifreq(priv, SIOCGIFHWADDR, &request); @@ -199,7 +199,7 @@ mlx4_get_mac(struct priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN]) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_mtu_get(struct priv *priv, uint16_t *mtu) +mlx4_mtu_get(struct mlx4_priv *priv, uint16_t *mtu) { struct ifreq request; int ret = mlx4_ifreq(priv, SIOCGIFMTU, &request); @@ -224,7 +224,7 @@ mlx4_mtu_get(struct priv *priv, uint16_t *mtu) int mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct ifreq request = { .ifr_mtu = mtu, }; int ret = mlx4_ifreq(priv, SIOCSIFMTU, &request); @@ -248,7 +248,7 @@ mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) * 0 on success, negative errno value otherwise and rte_errno is set. */ static int -mlx4_set_flags(struct priv *priv, unsigned int keep, unsigned int flags) +mlx4_set_flags(struct mlx4_priv *priv, unsigned int keep, unsigned int flags) { struct ifreq request; int ret = mlx4_ifreq(priv, SIOCGIFFLAGS, &request); @@ -272,7 +272,7 @@ mlx4_set_flags(struct priv *priv, unsigned int keep, unsigned int flags) * 0 on success, negative errno value otherwise and rte_errno is set. */ static int -mlx4_dev_set_link(struct priv *priv, int up) +mlx4_dev_set_link(struct mlx4_priv *priv, int up) { int err; @@ -300,7 +300,7 @@ mlx4_dev_set_link(struct priv *priv, int up) int mlx4_dev_set_link_down(struct rte_eth_dev *dev) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; return mlx4_dev_set_link(priv, 0); } @@ -317,7 +317,7 @@ mlx4_dev_set_link_down(struct rte_eth_dev *dev) int mlx4_dev_set_link_up(struct rte_eth_dev *dev) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; return mlx4_dev_set_link(priv, 1); } @@ -345,7 +345,7 @@ enum rxmode_toggle { static void mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; const char *mode; struct rte_flow_error error; @@ -430,7 +430,7 @@ mlx4_allmulticast_disable(struct rte_eth_dev *dev) void mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct rte_flow_error error; if (index >= RTE_DIM(priv->mac)) { @@ -466,7 +466,7 @@ int mlx4_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, uint32_t index, uint32_t vmdq) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct rte_flow_error error; int ret; @@ -503,7 +503,7 @@ mlx4_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, int mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct rte_flow_error error; unsigned int vidx = vlan_id / 64; unsigned int vbit = vlan_id % 64; @@ -557,7 +557,7 @@ mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) void mlx4_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; unsigned int max; char ifname[IF_NAMESIZE]; @@ -688,7 +688,7 @@ mlx4_stats_reset(struct rte_eth_dev *dev) int mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete) { - const struct priv *priv = dev->data->dev_private; + const struct mlx4_priv *priv = dev->data->dev_private; struct ethtool_cmd edata = { .cmd = ETHTOOL_GSET, }; @@ -741,7 +741,7 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete) int mlx4_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct ifreq ifr; struct ethtool_pauseparam ethpause = { .cmd = ETHTOOL_GPAUSEPARAM, @@ -785,7 +785,7 @@ out: int mlx4_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct ifreq ifr; struct ethtool_pauseparam ethpause = { .cmd = ETHTOOL_SPAUSEPARAM, @@ -853,7 +853,7 @@ mlx4_dev_supported_ptypes_get(struct rte_eth_dev *dev) RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN, RTE_PTYPE_UNKNOWN }; - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; if (dev->rx_pkt_burst == mlx4_rx_burst) { if (priv->hw_csum_l2tun) @@ -877,7 +877,7 @@ int mlx4_is_removed(struct rte_eth_dev *dev) { struct ibv_device_attr device_attr; - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; if (mlx4_glue->query_device(priv->ctx, &device_attr) == EIO) return 1; diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index b40e7e5c..5136d136 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -71,7 +71,7 @@ struct mlx4_flow_proc_item { struct mlx4_drop { struct ibv_qp *qp; /**< QP target. */ struct ibv_cq *cq; /**< CQ associated with above QP. */ - struct priv *priv; /**< Back pointer to private data. */ + struct mlx4_priv *priv; /**< Back pointer to private data. */ uint32_t refcnt; /**< Reference count. */ }; @@ -95,7 +95,7 @@ struct mlx4_drop { * rte_errno is set. */ uint64_t -mlx4_conv_rss_types(struct priv *priv, uint64_t types, int verbs_to_dpdk) +mlx4_conv_rss_types(struct mlx4_priv *priv, uint64_t types, int verbs_to_dpdk) { enum { INNER, @@ -657,7 +657,7 @@ static const struct mlx4_flow_proc_item mlx4_flow_proc_item_list[] = { * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx4_flow_prepare(struct priv *priv, +mlx4_flow_prepare(struct mlx4_priv *priv, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], @@ -767,7 +767,7 @@ fill: if (flow->rss) break; queue = action->conf; - if (queue->index >= priv->dev->data->nb_rx_queues) { + if (queue->index >= ETH_DEV(priv)->data->nb_rx_queues) { msg = "queue target index beyond number of" " configured Rx queues"; goto exit_action_not_supported; @@ -796,7 +796,7 @@ fill: /* Sanity checks. */ for (i = 0; i < rss->queue_num; ++i) if (rss->queue[i] >= - priv->dev->data->nb_rx_queues) + ETH_DEV(priv)->data->nb_rx_queues) break; if (i != rss->queue_num) { msg = "queue index target beyond number of" @@ -928,7 +928,7 @@ mlx4_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_action actions[], struct rte_flow_error *error) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; return mlx4_flow_prepare(priv, attr, pattern, actions, error, NULL); } @@ -944,7 +944,7 @@ mlx4_flow_validate(struct rte_eth_dev *dev, * is set. */ static struct mlx4_drop * -mlx4_drop_get(struct priv *priv) +mlx4_drop_get(struct mlx4_priv *priv) { struct mlx4_drop *drop = priv->drop; @@ -1020,7 +1020,7 @@ mlx4_drop_put(struct mlx4_drop *drop) * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx4_flow_toggle(struct priv *priv, +mlx4_flow_toggle(struct mlx4_priv *priv, struct rte_flow *flow, int enable, struct rte_flow_error *error) @@ -1066,8 +1066,8 @@ mlx4_flow_toggle(struct priv *priv, /* Stop at the first nonexistent target queue. */ for (i = 0; i != rss->queues; ++i) if (rss->queue_id[i] >= - 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 = 1; break; } @@ -1136,7 +1136,7 @@ mlx4_flow_create(struct rte_eth_dev *dev, const struct rte_flow_action actions[], struct rte_flow_error *error) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct rte_flow *flow; int err; @@ -1177,7 +1177,7 @@ mlx4_flow_isolate(struct rte_eth_dev *dev, int enable, struct rte_flow_error *error) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; if (!!enable == !!priv->isolated) return 0; @@ -1200,7 +1200,7 @@ mlx4_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, struct rte_flow_error *error) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; int err = mlx4_flow_toggle(priv, flow, 0, error); if (err) @@ -1224,7 +1224,7 @@ static int mlx4_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct rte_flow *flow = LIST_FIRST(&priv->flows); while (flow) { @@ -1249,10 +1249,10 @@ mlx4_flow_flush(struct rte_eth_dev *dev, * Next configured VLAN ID or a high value (>= 4096) if there is none. */ static uint16_t -mlx4_flow_internal_next_vlan(struct priv *priv, uint16_t vlan) +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; @@ -1289,7 +1289,7 @@ mlx4_flow_internal_next_vlan(struct priv *priv, uint16_t vlan) * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx4_flow_internal(struct priv *priv, struct rte_flow_error *error) +mlx4_flow_internal(struct mlx4_priv *priv, struct rte_flow_error *error) { struct rte_flow_attr attr = { .priority = MLX4_FLOW_PRIORITY_LAST, @@ -1329,7 +1329,7 @@ mlx4_flow_internal(struct priv *priv, struct rte_flow_error *error) * get RSS by default. */ uint32_t queues = - 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 = { .func = RTE_ETH_HASH_FUNCTION_DEFAULT, @@ -1351,9 +1351,9 @@ mlx4_flow_internal(struct priv *priv, struct rte_flow_error *error) }; struct ether_addr *rule_mac = ð_spec.dst; rte_be16_t *rule_vlan = - (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 = 0; @@ -1433,7 +1433,7 @@ next_vlan: if (!flow || !flow->internal) { /* Not found, create a new flow rule. */ memcpy(rule_mac, mac, sizeof(*mac)); - flow = mlx4_flow_create(priv->dev, &attr, pattern, + flow = mlx4_flow_create(ETH_DEV(priv), &attr, pattern, actions, error); if (!flow) { err = -rte_errno; @@ -1449,15 +1449,16 @@ next_vlan: 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 = LIST_FIRST(&priv->flows); flow && flow->internal; flow = 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; } @@ -1471,16 +1472,16 @@ next_vlan: } 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 = NULL; pattern[1].mask = NULL; } else { - assert(priv->dev->data->all_multicast); + assert(ETH_DEV(priv)->data->all_multicast); pattern[1].spec = ð_allmulti; pattern[1].mask = ð_allmulti; } pattern[2] = pattern[3]; - flow = mlx4_flow_create(priv->dev, &attr, pattern, + flow = mlx4_flow_create(ETH_DEV(priv), &attr, pattern, actions, error); if (!flow) { err = -rte_errno; @@ -1497,7 +1498,8 @@ error: struct rte_flow *next = LIST_NEXT(flow, next); 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 = 0; flow = next; @@ -1521,7 +1523,7 @@ error: * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx4_flow_sync(struct priv *priv, struct rte_flow_error *error) +mlx4_flow_sync(struct mlx4_priv *priv, struct rte_flow_error *error) { struct rte_flow *flow; int ret; @@ -1535,7 +1537,8 @@ mlx4_flow_sync(struct priv *priv, struct rte_flow_error *error) for (flow = LIST_FIRST(&priv->flows); flow && flow->internal; flow = 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 = mlx4_flow_internal(priv, error); @@ -1563,12 +1566,12 @@ mlx4_flow_sync(struct priv *priv, struct rte_flow_error *error) * Pointer to private structure. */ void -mlx4_flow_clean(struct priv *priv) +mlx4_flow_clean(struct mlx4_priv *priv) { struct rte_flow *flow; while ((flow = LIST_FIRST(&priv->flows))) - mlx4_flow_destroy(priv->dev, flow, NULL); + mlx4_flow_destroy(ETH_DEV(priv), flow, NULL); assert(LIST_EMPTY(&priv->rss)); } diff --git a/drivers/net/mlx4/mlx4_flow.h b/drivers/net/mlx4/mlx4_flow.h index 2917ebe9..03a4bd05 100644 --- a/drivers/net/mlx4/mlx4_flow.h +++ b/drivers/net/mlx4/mlx4_flow.h @@ -48,10 +48,10 @@ struct rte_flow { /* mlx4_flow.c */ -uint64_t mlx4_conv_rss_types(struct priv *priv, uint64_t types, +uint64_t mlx4_conv_rss_types(struct mlx4_priv *priv, uint64_t types, int verbs_to_dpdk); -int mlx4_flow_sync(struct priv *priv, struct rte_flow_error *error); -void mlx4_flow_clean(struct priv *priv); +int mlx4_flow_sync(struct mlx4_priv *priv, struct rte_flow_error *error); +void mlx4_flow_clean(struct mlx4_priv *priv); int mlx4_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, enum rte_filter_op filter_op, diff --git a/drivers/net/mlx4/mlx4_intr.c b/drivers/net/mlx4/mlx4_intr.c index eeb982a0..4f335267 100644 --- a/drivers/net/mlx4/mlx4_intr.c +++ b/drivers/net/mlx4/mlx4_intr.c @@ -33,7 +33,7 @@ #include "mlx4_rxtx.h" #include "mlx4_utils.h" -static int mlx4_link_status_check(struct priv *priv); +static int mlx4_link_status_check(struct mlx4_priv *priv); /** * Clean up Rx interrupts handler. @@ -42,7 +42,7 @@ static int mlx4_link_status_check(struct priv *priv); * Pointer to private structure. */ static void -mlx4_rx_intr_vec_disable(struct priv *priv) +mlx4_rx_intr_vec_disable(struct mlx4_priv *priv) { struct rte_intr_handle *intr_handle = &priv->intr_handle; @@ -62,10 +62,10 @@ mlx4_rx_intr_vec_disable(struct priv *priv) * 0 on success, negative errno value otherwise and rte_errno is set. */ static int -mlx4_rx_intr_vec_enable(struct priv *priv) +mlx4_rx_intr_vec_enable(struct mlx4_priv *priv) { unsigned int i; - unsigned int rxqs_n = priv->dev->data->nb_rx_queues; + unsigned int rxqs_n = ETH_DEV(priv)->data->nb_rx_queues; unsigned int n = RTE_MIN(rxqs_n, (uint32_t)RTE_MAX_RXTX_INTR_VEC_ID); unsigned int count = 0; struct rte_intr_handle *intr_handle = &priv->intr_handle; @@ -79,7 +79,7 @@ mlx4_rx_intr_vec_enable(struct priv *priv) return -rte_errno; } for (i = 0; i != n; ++i) { - struct rxq *rxq = priv->dev->data->rx_queues[i]; + struct rxq *rxq = ETH_DEV(priv)->data->rx_queues[i]; /* Skip queues that cannot request interrupts. */ if (!rxq || !rxq->channel) { @@ -117,15 +117,15 @@ mlx4_rx_intr_vec_enable(struct priv *priv) * Pointer to private structure. */ static void -mlx4_link_status_alarm(struct priv *priv) +mlx4_link_status_alarm(struct mlx4_priv *priv) { const struct rte_intr_conf *const intr_conf = - &priv->dev->data->dev_conf.intr_conf; + Ð_DEV(priv)->data->dev_conf.intr_conf; assert(priv->intr_alarm == 1); priv->intr_alarm = 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); } @@ -143,10 +143,10 @@ mlx4_link_status_alarm(struct priv *priv) * otherwise and rte_errno is set. */ static int -mlx4_link_status_check(struct priv *priv) +mlx4_link_status_check(struct mlx4_priv *priv) { - struct rte_eth_link *link = &priv->dev->data->dev_link; - int ret = mlx4_link_update(priv->dev, 0); + struct rte_eth_link *link = Ð_DEV(priv)->data->dev_link; + int ret = mlx4_link_update(ETH_DEV(priv), 0); if (ret) return ret; @@ -175,7 +175,7 @@ mlx4_link_status_check(struct priv *priv) * Pointer to private structure. */ static void -mlx4_interrupt_handler(struct priv *priv) +mlx4_interrupt_handler(struct mlx4_priv *priv) { enum { LSC, RMV, }; static const enum rte_eth_event_type type[] = { @@ -185,7 +185,7 @@ mlx4_interrupt_handler(struct priv *priv) uint32_t caught[RTE_DIM(type)] = { 0 }; struct ibv_async_event event; const struct rte_intr_conf *const intr_conf = - &priv->dev->data->dev_conf.intr_conf; + Ð_DEV(priv)->data->dev_conf.intr_conf; unsigned int i; /* Read all message and acknowledge them. */ @@ -208,7 +208,7 @@ mlx4_interrupt_handler(struct priv *priv) } for (i = 0; i != 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); } @@ -251,7 +251,7 @@ mlx4_arm_cq(struct rxq *rxq, int solicited) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_intr_uninstall(struct priv *priv) +mlx4_intr_uninstall(struct mlx4_priv *priv) { int err = rte_errno; /* Make sure rte_errno remains unchanged. */ @@ -279,10 +279,10 @@ mlx4_intr_uninstall(struct priv *priv) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_intr_install(struct priv *priv) +mlx4_intr_install(struct mlx4_priv *priv) { const struct rte_intr_conf *const intr_conf = - &priv->dev->data->dev_conf.intr_conf; + Ð_DEV(priv)->data->dev_conf.intr_conf; int rc; mlx4_intr_uninstall(priv); @@ -378,10 +378,10 @@ mlx4_rx_intr_enable(struct rte_eth_dev *dev, uint16_t idx) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_rxq_intr_enable(struct priv *priv) +mlx4_rxq_intr_enable(struct mlx4_priv *priv) { const struct rte_intr_conf *const intr_conf = - &priv->dev->data->dev_conf.intr_conf; + Ð_DEV(priv)->data->dev_conf.intr_conf; if (intr_conf->rxq && mlx4_rx_intr_vec_enable(priv) < 0) goto error; @@ -397,7 +397,7 @@ error: * Pointer to private structure. */ void -mlx4_rxq_intr_disable(struct priv *priv) +mlx4_rxq_intr_disable(struct mlx4_priv *priv) { int err = rte_errno; /* Make sure rte_errno remains unchanged. */ diff --git a/drivers/net/mlx4/mlx4_mr.c b/drivers/net/mlx4/mlx4_mr.c index a0094483..98c236fb 100644 --- a/drivers/net/mlx4/mlx4_mr.c +++ b/drivers/net/mlx4/mlx4_mr.c @@ -348,7 +348,7 @@ mr_find_next_chunk(struct mlx4_mr *mr, struct mlx4_mr_cache *entry, static int mr_insert_dev_cache(struct rte_eth_dev *dev, struct mlx4_mr *mr) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; unsigned int n; DEBUG("port %u inserting MR(%p) to global cache", @@ -389,7 +389,7 @@ static struct mlx4_mr * mr_lookup_dev_list(struct rte_eth_dev *dev, struct mlx4_mr_cache *entry, uintptr_t addr) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct mlx4_mr *mr; /* Iterate all the existing MRs. */ @@ -430,7 +430,7 @@ static uint32_t mr_lookup_dev(struct rte_eth_dev *dev, struct mlx4_mr_cache *entry, uintptr_t addr) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; uint16_t idx; uint32_t lkey = UINT32_MAX; struct mlx4_mr *mr; @@ -477,7 +477,7 @@ mr_free(struct mlx4_mr *mr) } /** - * Releass resources of detached MR having no online entry. + * Release resources of detached MR having no online entry. * * @param dev * Pointer to Ethernet device. @@ -485,7 +485,7 @@ mr_free(struct mlx4_mr *mr) static void mlx4_mr_garbage_collect(struct rte_eth_dev *dev) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct mlx4_mr *mr_next; struct mlx4_mr_list free_list = LIST_HEAD_INITIALIZER(free_list); @@ -525,7 +525,7 @@ mr_find_contig_memsegs_cb(const struct rte_memseg_list *msl, } /** - * Create a new global Memroy Region (MR) for a missing virtual address. + * Create a new global Memory Region (MR) for a missing virtual address. * Register entire virtually contiguous memory chunk around the address. * * @param dev @@ -543,7 +543,7 @@ static uint32_t mlx4_mr_create(struct rte_eth_dev *dev, struct mlx4_mr_cache *entry, uintptr_t addr) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; const struct rte_memseg_list *msl; const struct rte_memseg *ms; @@ -623,7 +623,7 @@ alloc_resources: bmp_mem = RTE_PTR_ALIGN_CEIL(mr + 1, RTE_CACHE_LINE_SIZE); mr->ms_bmp = rte_bitmap_init(ms_n, bmp_mem, bmp_size); if (mr->ms_bmp == NULL) { - WARN("port %u unable to initialize bitamp for a new MR of" + WARN("port %u unable to initialize bitmap for a new MR of" " address (%p).", dev->data->port_id, (void *)addr); rte_errno = EINVAL; @@ -769,7 +769,7 @@ err_nolock: static void mr_rebuild_dev_cache(struct rte_eth_dev *dev) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct mlx4_mr *mr; DEBUG("port %u rebuild dev cache[]", dev->data->port_id); @@ -801,7 +801,7 @@ mr_rebuild_dev_cache(struct rte_eth_dev *dev) static void mlx4_mr_mem_event_free_cb(struct rte_eth_dev *dev, const void *addr, size_t len) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; const struct rte_memseg_list *msl; struct mlx4_mr *mr; int ms_n; @@ -889,14 +889,14 @@ void mlx4_mr_mem_event_cb(enum rte_mem_event event_type, const void *addr, size_t len, void *arg __rte_unused) { - struct priv *priv; + struct mlx4_priv *priv; switch (event_type) { case RTE_MEM_EVENT_FREE: 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: @@ -926,7 +926,7 @@ static uint32_t mlx4_mr_lookup_dev(struct rte_eth_dev *dev, struct mlx4_mr_ctrl *mr_ctrl, struct mlx4_mr_cache *entry, uintptr_t addr) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct mlx4_mr_btree *bt = &mr_ctrl->cache_bh; uint16_t idx; uint32_t lkey; @@ -1024,11 +1024,9 @@ uint32_t mlx4_rx_addr2mr_bh(struct rxq *rxq, uintptr_t addr) { struct mlx4_mr_ctrl *mr_ctrl = &rxq->mr_ctrl; - struct priv *priv = rxq->priv; + struct mlx4_priv *priv = rxq->priv; - DEBUG("Rx queue %u: miss on top-half, mru=%u, head=%u, addr=%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); } /** @@ -1046,11 +1044,9 @@ static uint32_t mlx4_tx_addr2mr_bh(struct txq *txq, uintptr_t addr) { struct mlx4_mr_ctrl *mr_ctrl = &txq->mr_ctrl; - struct priv *priv = txq->priv; + struct mlx4_priv *priv = txq->priv; - DEBUG("Tx queue %u: miss on top-half, mru=%u, head=%u, addr=%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); } /** @@ -1122,7 +1118,7 @@ mlx4_mr_update_ext_mp_cb(struct rte_mempool *mp, void *opaque, { struct mr_update_mp_data *data = opaque; struct rte_eth_dev *dev = data->dev; - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct mlx4_mr_ctrl *mr_ctrl = data->mr_ctrl; struct mlx4_mr *mr = NULL; uintptr_t addr = (uintptr_t)memhdr->addr; @@ -1223,9 +1219,9 @@ uint32_t mlx4_tx_update_ext_mp(struct txq *txq, uintptr_t addr, struct rte_mempool *mp) { struct mlx4_mr_ctrl *mr_ctrl = &txq->mr_ctrl; - struct priv *priv = txq->priv; + struct mlx4_priv *priv = txq->priv; - 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); } @@ -1289,7 +1285,7 @@ mlx4_mr_update_mp(struct rte_eth_dev *dev, struct mlx4_mr_ctrl *mr_ctrl, void mlx4_mr_dump_dev(struct rte_eth_dev *dev) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct mlx4_mr *mr; int mr_n = 0; int chunk_n = 0; @@ -1332,8 +1328,8 @@ mlx4_mr_dump_dev(struct rte_eth_dev *dev) void mlx4_mr_release(struct rte_eth_dev *dev) { - struct priv *priv = dev->data->dev_private; - struct mlx4_mr *mr_next = LIST_FIRST(&priv->mr.mr_list); + struct mlx4_priv *priv = dev->data->dev_private; + struct mlx4_mr *mr_next; /* Remove from memory callback device list. */ rte_rwlock_write_lock(&mlx4_mem_event_rwlock); @@ -1344,6 +1340,7 @@ mlx4_mr_release(struct rte_eth_dev *dev) #endif rte_rwlock_write_lock(&priv->mr.rwlock); /* Detach from MR list and move to free list. */ + mr_next = LIST_FIRST(&priv->mr.mr_list); while (mr_next != NULL) { struct mlx4_mr *mr = mr_next; diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c index 6804c634..50f33eb0 100644 --- a/drivers/net/mlx4/mlx4_rxq.c +++ b/drivers/net/mlx4/mlx4_rxq.c @@ -87,7 +87,7 @@ mlx4_rss_hash_key_default[MLX4_RSS_HASH_KEY_SIZE] = { * Pointer to RSS context on success, NULL otherwise and rte_errno is set. */ struct mlx4_rss * -mlx4_rss_get(struct priv *priv, uint64_t fields, +mlx4_rss_get(struct mlx4_priv *priv, uint64_t fields, const uint8_t key[MLX4_RSS_HASH_KEY_SIZE], uint16_t queues, const uint16_t queue_id[]) { @@ -175,7 +175,8 @@ mlx4_rss_attach(struct mlx4_rss *rss) } struct ibv_wq *ind_tbl[rss->queues]; - struct priv *priv = rss->priv; + struct mlx4_priv *priv = rss->priv; + struct rte_eth_dev *dev = ETH_DEV(priv); const char *msg; unsigned int i = 0; int ret; @@ -189,8 +190,8 @@ mlx4_rss_attach(struct mlx4_rss *rss) uint16_t id = rss->queue_id[i]; struct rxq *rxq = NULL; - if (id < priv->dev->data->nb_rx_queues) - rxq = priv->dev->data->rx_queues[id]; + if (id < dev->data->nb_rx_queues) + rxq = dev->data->rx_queues[id]; if (!rxq) { ret = EINVAL; msg = "RSS target queue is not configured"; @@ -269,7 +270,7 @@ error: rss->ind = 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 = ret; @@ -290,7 +291,8 @@ error: void mlx4_rss_detach(struct mlx4_rss *rss) { - struct priv *priv = rss->priv; + struct mlx4_priv *priv = rss->priv; + struct rte_eth_dev *dev = ETH_DEV(priv); unsigned int i; 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 = NULL; for (i = 0; i != 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]]); } /** @@ -327,9 +329,9 @@ mlx4_rss_detach(struct mlx4_rss *rss) * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx4_rss_init(struct priv *priv) +mlx4_rss_init(struct mlx4_priv *priv) { - struct rte_eth_dev *dev = priv->dev; + struct rte_eth_dev *dev = ETH_DEV(priv); uint8_t log2_range = rte_log2_u32(dev->data->nb_rx_queues); uint32_t wq_num_prev = 0; const char *msg; @@ -338,7 +340,7 @@ mlx4_rss_init(struct priv *priv) 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 = EINVAL; @@ -356,8 +358,8 @@ mlx4_rss_init(struct priv *priv) rte_errno = ret; return -ret; } - for (i = 0; i != priv->dev->data->nb_rx_queues; ++i) { - struct rxq *rxq = priv->dev->data->rx_queues[i]; + for (i = 0; i != ETH_DEV(priv)->data->nb_rx_queues; ++i) { + struct rxq *rxq = ETH_DEV(priv)->data->rx_queues[i]; struct ibv_cq *cq; struct ibv_wq *wq; uint32_t wq_num; @@ -432,7 +434,7 @@ error: ERROR("cannot initialize common RSS resources (queue %u): %s: %s", i, msg, strerror(ret)); while (i--) { - struct rxq *rxq = priv->dev->data->rx_queues[i]; + struct rxq *rxq = ETH_DEV(priv)->data->rx_queues[i]; if (rxq) mlx4_rxq_detach(rxq); @@ -451,14 +453,14 @@ error: * Pointer to private structure. */ void -mlx4_rss_deinit(struct priv *priv) +mlx4_rss_deinit(struct mlx4_priv *priv) { unsigned int i; if (!priv->rss_init) return; - for (i = 0; i != priv->dev->data->nb_rx_queues; ++i) { - struct rxq *rxq = priv->dev->data->rx_queues[i]; + for (i = 0; i != ETH_DEV(priv)->data->nb_rx_queues; ++i) { + struct rxq *rxq = ETH_DEV(priv)->data->rx_queues[i]; if (rxq) { assert(rxq->usecnt == 1); @@ -493,8 +495,8 @@ mlx4_rxq_attach(struct rxq *rxq) return 0; } - struct priv *priv = rxq->priv; - struct rte_eth_dev *dev = priv->dev; + struct mlx4_priv *priv = rxq->priv; + struct rte_eth_dev *dev = ETH_DEV(priv); const uint32_t elts_n = 1 << rxq->elts_n; const uint32_t sges_n = 1 << rxq->sges_n; struct rte_mbuf *(*elts)[elts_n] = 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 = (volatile struct mlx4_wqe_data_seg (*)[]) @@ -675,7 +677,7 @@ mlx4_rxq_detach(struct rxq *rxq) * Supported Tx offloads. */ uint64_t -mlx4_get_rx_queue_offloads(struct priv *priv) +mlx4_get_rx_queue_offloads(struct mlx4_priv *priv) { uint64_t offloads = DEV_RX_OFFLOAD_SCATTER | DEV_RX_OFFLOAD_KEEP_CRC | @@ -696,7 +698,7 @@ mlx4_get_rx_queue_offloads(struct priv *priv) * Supported Rx offloads. */ uint64_t -mlx4_get_rx_port_offloads(struct priv *priv) +mlx4_get_rx_port_offloads(struct mlx4_priv *priv) { uint64_t offloads = DEV_RX_OFFLOAD_VLAN_FILTER; @@ -728,7 +730,7 @@ mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_rxconf *conf, struct rte_mempool *mp) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; uint32_t mb_len = rte_pktmbuf_data_room_size(mp); struct rte_mbuf *(*elts)[rte_align32pow2(desc)]; struct rxq *rxq; @@ -911,17 +913,17 @@ void mlx4_rx_queue_release(void *dpdk_rxq) { struct rxq *rxq = (struct rxq *)dpdk_rxq; - struct priv *priv; + struct mlx4_priv *priv; unsigned int i; if (rxq == NULL) return; priv = rxq->priv; - for (i = 0; i != priv->dev->data->nb_rx_queues; ++i) - if (priv->dev->data->rx_queues[i] == rxq) { + for (i = 0; i != ETH_DEV(priv)->data->nb_rx_queues; ++i) + if (ETH_DEV(priv)->data->rx_queues[i] == rxq) { DEBUG("%p: removing Rx queue %p from list", - (void *)priv->dev, (void *)rxq); - priv->dev->data->rx_queues[i] = NULL; + (void *)ETH_DEV(priv), (void *)rxq); + ETH_DEV(priv)->data->rx_queues[i] = NULL; break; } assert(!rxq->cq); diff --git a/drivers/net/mlx4/mlx4_rxtx.h b/drivers/net/mlx4/mlx4_rxtx.h index d7ec4e0c..29389f1e 100644 --- a/drivers/net/mlx4/mlx4_rxtx.h +++ b/drivers/net/mlx4/mlx4_rxtx.h @@ -38,7 +38,7 @@ struct mlx4_rxq_stats { /** Rx queue descriptor. */ struct rxq { - struct priv *priv; /**< Back pointer to private data. */ + struct mlx4_priv *priv; /**< Back pointer to private data. */ struct rte_mempool *mp; /**< Memory pool for allocations. */ struct ibv_cq *cq; /**< Completion queue. */ struct ibv_wq *wq; /**< Work queue. */ @@ -65,7 +65,7 @@ struct rxq { /** Shared flow target for Rx queues. */ struct mlx4_rss { LIST_ENTRY(mlx4_rss) next; /**< Next entry in list. */ - struct priv *priv; /**< Back pointer to private data. */ + struct mlx4_priv *priv; /**< Back pointer to private data. */ uint32_t refcnt; /**< Reference count for this object. */ uint32_t usecnt; /**< Number of users relying on @p qp and @p ind. */ struct ibv_qp *qp; /**< Queue pair. */ @@ -111,7 +111,7 @@ struct txq { uint32_t lb:1; /**< Whether packets should be looped back by eSwitch. */ uint8_t *bounce_buf; /**< Memory used for storing the first DWORD of data TXBBs. */ - struct priv *priv; /**< Back pointer to private data. */ + struct mlx4_priv *priv; /**< Back pointer to private data. */ unsigned int socket; /**< CPU socket ID for allocations. */ struct ibv_cq *cq; /**< Completion queue. */ struct ibv_qp *qp; /**< Queue pair. */ @@ -121,9 +121,9 @@ struct txq { /* mlx4_rxq.c */ uint8_t mlx4_rss_hash_key_default[MLX4_RSS_HASH_KEY_SIZE]; -int mlx4_rss_init(struct priv *priv); -void mlx4_rss_deinit(struct priv *priv); -struct mlx4_rss *mlx4_rss_get(struct priv *priv, uint64_t fields, +int mlx4_rss_init(struct mlx4_priv *priv); +void mlx4_rss_deinit(struct mlx4_priv *priv); +struct mlx4_rss *mlx4_rss_get(struct mlx4_priv *priv, uint64_t fields, const uint8_t key[MLX4_RSS_HASH_KEY_SIZE], uint16_t queues, const uint16_t queue_id[]); void mlx4_rss_put(struct mlx4_rss *rss); @@ -131,8 +131,8 @@ int mlx4_rss_attach(struct mlx4_rss *rss); void mlx4_rss_detach(struct mlx4_rss *rss); int mlx4_rxq_attach(struct rxq *rxq); void mlx4_rxq_detach(struct rxq *rxq); -uint64_t mlx4_get_rx_port_offloads(struct priv *priv); -uint64_t mlx4_get_rx_queue_offloads(struct priv *priv); +uint64_t mlx4_get_rx_port_offloads(struct mlx4_priv *priv); +uint64_t mlx4_get_rx_queue_offloads(struct mlx4_priv *priv); int mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_rxconf *conf, @@ -152,7 +152,7 @@ uint16_t mlx4_rx_burst_removed(void *dpdk_rxq, struct rte_mbuf **pkts, /* mlx4_txq.c */ -uint64_t mlx4_get_tx_port_offloads(struct priv *priv); +uint64_t mlx4_get_tx_port_offloads(struct mlx4_priv *priv); int mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_txconf *conf); diff --git a/drivers/net/mlx4/mlx4_txq.c b/drivers/net/mlx4/mlx4_txq.c index 9aa7440d..35270082 100644 --- a/drivers/net/mlx4/mlx4_txq.c +++ b/drivers/net/mlx4/mlx4_txq.c @@ -107,7 +107,7 @@ mlx4_txq_fill_dv_obj_info(struct txq *txq, struct mlx4dv_obj *mlxdv) * Supported Tx offloads. */ uint64_t -mlx4_get_tx_port_offloads(struct priv *priv) +mlx4_get_tx_port_offloads(struct mlx4_priv *priv) { uint64_t offloads = DEV_TX_OFFLOAD_MULTI_SEGS; @@ -148,7 +148,7 @@ int mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_txconf *conf) { - struct priv *priv = dev->data->dev_private; + struct mlx4_priv *priv = dev->data->dev_private; struct mlx4dv_obj mlxdv; struct mlx4dv_qp dv_qp; struct mlx4dv_cq dv_cq; @@ -351,17 +351,17 @@ void mlx4_tx_queue_release(void *dpdk_txq) { struct txq *txq = (struct txq *)dpdk_txq; - struct priv *priv; + struct mlx4_priv *priv; unsigned int i; if (txq == NULL) return; priv = txq->priv; - for (i = 0; i != priv->dev->data->nb_tx_queues; ++i) - if (priv->dev->data->tx_queues[i] == txq) { + for (i = 0; i != ETH_DEV(priv)->data->nb_tx_queues; ++i) + if (ETH_DEV(priv)->data->tx_queues[i] == txq) { DEBUG("%p: removing Tx queue %p from list", - (void *)priv->dev, (void *)txq); - priv->dev->data->tx_queues[i] = NULL; + (void *)ETH_DEV(priv), (void *)txq); + ETH_DEV(priv)->data->tx_queues[i] = NULL; break; } mlx4_txq_free_elts(txq); -- cgit 1.2.3-korg