* [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5
@ 2016-06-08 9:43 Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 1/7] mlx: remove unused memory region property Nelio Laranjeiro
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: Nelio Laranjeiro @ 2016-06-08 9:43 UTC (permalink / raw)
To: dev
Various minor fixes for mlx4 (ConnectX-3) and mlx5 (ConnectX-4).
Adrien Mazarguil (4):
mlx: ensure MTU update is effective
mlx: retrieve mbuf size through proper API
mlx5: fix RX VLAN stripping capability check
mlx5: cosmetic changes (coding style)
Nelio Laranjeiro (3):
mlx: remove unused memory region property
mlx5: enhance SR-IOV detection
mlx5: update documentation part related to features and limitations
doc/guides/nics/mlx5.rst | 2 +-
drivers/net/mlx4/mlx4.c | 43 ++++++++++++++++++++------------------
drivers/net/mlx5/mlx5.c | 14 +++++++------
drivers/net/mlx5/mlx5.h | 3 ++-
drivers/net/mlx5/mlx5_ethdev.c | 47 ++++++++++++++++++++++++++++++++++++++++--
drivers/net/mlx5/mlx5_rxq.c | 23 +++++++--------------
drivers/net/mlx5/mlx5_rxtx.c | 7 +++----
drivers/net/mlx5/mlx5_rxtx.h | 16 ++++++--------
drivers/net/mlx5/mlx5_txq.c | 2 +-
drivers/net/mlx5/mlx5_vlan.c | 2 +-
10 files changed, 98 insertions(+), 61 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 1/7] mlx: remove unused memory region property
2016-06-08 9:43 [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Nelio Laranjeiro
@ 2016-06-08 9:43 ` Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 2/7] mlx: ensure MTU update is effective Nelio Laranjeiro
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Nelio Laranjeiro @ 2016-06-08 9:43 UTC (permalink / raw)
To: dev; +Cc: Adrien Mazarguil
Memory regions are always local with raw Ethernet queues, drop the remote
property as it adds extra processing on the hardware side.
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx4/mlx4.c | 4 ++--
drivers/net/mlx5/mlx5_rxtx.c | 2 +-
drivers/net/mlx5/mlx5_txq.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 9ed1491..661c49f 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -998,7 +998,7 @@ txq_alloc_elts(struct txq *txq, unsigned int elts_n)
}
mr_linear =
ibv_reg_mr(txq->priv->pd, elts_linear, sizeof(*elts_linear),
- (IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE));
+ IBV_ACCESS_LOCAL_WRITE);
if (mr_linear == NULL) {
ERROR("%p: unable to configure MR, ibv_reg_mr() failed",
(void *)txq);
@@ -1310,7 +1310,7 @@ mlx4_mp2mr(struct ibv_pd *pd, struct rte_mempool *mp)
return ibv_reg_mr(pd,
(void *)start,
end - start,
- IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE);
+ IBV_ACCESS_LOCAL_WRITE);
}
/**
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 29bfcec..7f02641 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -252,7 +252,7 @@ mlx5_mp2mr(struct ibv_pd *pd, struct rte_mempool *mp)
return ibv_reg_mr(pd,
(void *)start,
end - start,
- IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE);
+ IBV_ACCESS_LOCAL_WRITE);
}
/**
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 31ce53a..e20df21 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -95,7 +95,7 @@ txq_alloc_elts(struct txq *txq, unsigned int elts_n)
}
mr_linear =
ibv_reg_mr(txq->priv->pd, elts_linear, sizeof(*elts_linear),
- (IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE));
+ IBV_ACCESS_LOCAL_WRITE);
if (mr_linear == NULL) {
ERROR("%p: unable to configure MR, ibv_reg_mr() failed",
(void *)txq);
--
2.1.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 2/7] mlx: ensure MTU update is effective
2016-06-08 9:43 [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 1/7] mlx: remove unused memory region property Nelio Laranjeiro
@ 2016-06-08 9:43 ` Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 3/7] mlx: retrieve mbuf size through proper API Nelio Laranjeiro
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Nelio Laranjeiro @ 2016-06-08 9:43 UTC (permalink / raw)
To: dev; +Cc: Adrien Mazarguil
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
There is no guarantee that the new MTU is effective after writing its value
to sysfs. Retrieve it to be sure.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx4/mlx4.c | 10 +++++++++-
drivers/net/mlx5/mlx5_ethdev.c | 10 +++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 661c49f..6174e4b 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -659,7 +659,15 @@ priv_get_mtu(struct priv *priv, uint16_t *mtu)
static int
priv_set_mtu(struct priv *priv, uint16_t mtu)
{
- return priv_set_sysfs_ulong(priv, "mtu", mtu);
+ uint16_t new_mtu;
+
+ if (priv_set_sysfs_ulong(priv, "mtu", mtu) ||
+ priv_get_mtu(priv, &new_mtu))
+ return -1;
+ if (new_mtu == mtu)
+ return 0;
+ errno = EINVAL;
+ return -1;
}
/**
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 36b369e..25926cb 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -398,7 +398,15 @@ priv_get_mtu(struct priv *priv, uint16_t *mtu)
static int
priv_set_mtu(struct priv *priv, uint16_t mtu)
{
- return priv_set_sysfs_ulong(priv, "mtu", mtu);
+ uint16_t new_mtu;
+
+ if (priv_set_sysfs_ulong(priv, "mtu", mtu) ||
+ priv_get_mtu(priv, &new_mtu))
+ return -1;
+ if (new_mtu == mtu)
+ return 0;
+ errno = EINVAL;
+ return -1;
}
/**
--
2.1.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 3/7] mlx: retrieve mbuf size through proper API
2016-06-08 9:43 [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 1/7] mlx: remove unused memory region property Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 2/7] mlx: ensure MTU update is effective Nelio Laranjeiro
@ 2016-06-08 9:43 ` Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 4/7] mlx5: fix RX VLAN stripping capability check Nelio Laranjeiro
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Nelio Laranjeiro @ 2016-06-08 9:43 UTC (permalink / raw)
To: dev; +Cc: Adrien Mazarguil
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
No need to allocate a mbuf for that.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx4/mlx4.c | 29 ++++++++++++-----------------
drivers/net/mlx5/mlx5_ethdev.c | 5 ++++-
drivers/net/mlx5/mlx5_rxq.c | 20 ++++++--------------
drivers/net/mlx5/mlx5_rxtx.c | 1 -
drivers/net/mlx5/mlx5_rxtx.h | 1 -
5 files changed, 22 insertions(+), 34 deletions(-)
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 6174e4b..82b1c63 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -197,7 +197,6 @@ struct rxq {
unsigned int sp:1; /* Use scattered RX elements. */
unsigned int csum:1; /* Enable checksum offloading. */
unsigned int csum_l2tun:1; /* Same for L2 tunnels. */
- uint32_t mb_len; /* Length of a mp-issued mbuf. */
struct mlx4_rxq_stats stats; /* RX queue counters. */
unsigned int socket; /* CPU socket ID for allocations. */
struct ibv_exp_res_domain *rd; /* Resource Domain. */
@@ -3160,7 +3159,6 @@ mlx4_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
rep->ol_flags = -1;
#endif
assert(rep->buf_len == seg->buf_len);
- assert(rep->buf_len == rxq->mb_len);
/* Reconfigure sge to use rep instead of seg. */
assert(sge->lkey == rxq->mr->lkey);
sge->addr = ((uintptr_t)rep->buf_addr + seg_headroom);
@@ -3581,6 +3579,7 @@ rxq_rehash(struct rte_eth_dev *dev, struct rxq *rxq)
unsigned int i, k;
struct ibv_exp_qp_attr mod;
struct ibv_recv_wr *bad_wr;
+ unsigned int mb_len;
int err;
int parent = (rxq == &priv->rxq_parent);
@@ -3589,6 +3588,7 @@ rxq_rehash(struct rte_eth_dev *dev, struct rxq *rxq)
(void *)dev, (void *)rxq);
return EINVAL;
}
+ mb_len = rte_pktmbuf_data_room_size(rxq->mp);
DEBUG("%p: rehashing queue %p", (void *)dev, (void *)rxq);
/* Number of descriptors and mbufs currently allocated. */
desc_n = (tmpl.elts_n * (tmpl.sp ? MLX4_PMD_SGE_WR_N : 1));
@@ -3603,9 +3603,10 @@ rxq_rehash(struct rte_eth_dev *dev, struct rxq *rxq)
rxq->csum_l2tun = tmpl.csum_l2tun;
}
/* Enable scattered packets support for this queue if necessary. */
+ assert(mb_len >= RTE_PKTMBUF_HEADROOM);
if ((dev->data->dev_conf.rxmode.jumbo_frame) &&
(dev->data->dev_conf.rxmode.max_rx_pkt_len >
- (tmpl.mb_len - RTE_PKTMBUF_HEADROOM))) {
+ (mb_len - RTE_PKTMBUF_HEADROOM))) {
tmpl.sp = 1;
desc_n /= MLX4_PMD_SGE_WR_N;
} else
@@ -3796,7 +3797,7 @@ rxq_setup(struct rte_eth_dev *dev, struct rxq *rxq, uint16_t desc,
} attr;
enum ibv_exp_query_intf_status status;
struct ibv_recv_wr *bad_wr;
- struct rte_mbuf *buf;
+ unsigned int mb_len;
int ret = 0;
int parent = (rxq == &priv->rxq_parent);
@@ -3812,31 +3813,22 @@ rxq_setup(struct rte_eth_dev *dev, struct rxq *rxq, uint16_t desc,
desc = 1;
goto skip_mr;
}
+ mb_len = rte_pktmbuf_data_room_size(mp);
if ((desc == 0) || (desc % MLX4_PMD_SGE_WR_N)) {
ERROR("%p: invalid number of RX descriptors (must be a"
" multiple of %d)", (void *)dev, MLX4_PMD_SGE_WR_N);
return EINVAL;
}
- /* Get mbuf length. */
- buf = rte_pktmbuf_alloc(mp);
- if (buf == NULL) {
- ERROR("%p: unable to allocate mbuf", (void *)dev);
- return ENOMEM;
- }
- tmpl.mb_len = buf->buf_len;
- assert((rte_pktmbuf_headroom(buf) +
- rte_pktmbuf_tailroom(buf)) == tmpl.mb_len);
- assert(rte_pktmbuf_headroom(buf) == RTE_PKTMBUF_HEADROOM);
- rte_pktmbuf_free(buf);
/* Toggle RX checksum offload if hardware supports it. */
if (priv->hw_csum)
tmpl.csum = !!dev->data->dev_conf.rxmode.hw_ip_checksum;
if (priv->hw_csum_l2tun)
tmpl.csum_l2tun = !!dev->data->dev_conf.rxmode.hw_ip_checksum;
/* Enable scattered packets support for this queue if necessary. */
+ assert(mb_len >= RTE_PKTMBUF_HEADROOM);
if ((dev->data->dev_conf.rxmode.jumbo_frame) &&
(dev->data->dev_conf.rxmode.max_rx_pkt_len >
- (tmpl.mb_len - RTE_PKTMBUF_HEADROOM))) {
+ (mb_len - RTE_PKTMBUF_HEADROOM))) {
tmpl.sp = 1;
desc /= MLX4_PMD_SGE_WR_N;
}
@@ -4873,6 +4865,7 @@ mlx4_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
/* Reconfigure each RX queue. */
for (i = 0; (i != priv->rxqs_n); ++i) {
struct rxq *rxq = (*priv->rxqs)[i];
+ unsigned int mb_len;
unsigned int max_frame_len;
int sp;
@@ -4882,7 +4875,9 @@ mlx4_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
* toggle scattered support (sp) if necessary. */
max_frame_len = (priv->mtu + ETHER_HDR_LEN +
(ETHER_MAX_VLAN_FRAME_LEN - ETHER_MAX_LEN));
- sp = (max_frame_len > (rxq->mb_len - RTE_PKTMBUF_HEADROOM));
+ mb_len = rte_pktmbuf_data_room_size(rxq->mp);
+ assert(mb_len >= RTE_PKTMBUF_HEADROOM);
+ sp = (max_frame_len > (mb_len - RTE_PKTMBUF_HEADROOM));
/* Provide new values to rxq_setup(). */
dev->data->dev_conf.rxmode.jumbo_frame = sp;
dev->data->dev_conf.rxmode.max_rx_pkt_len = max_frame_len;
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 25926cb..ecbb49b 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -718,6 +718,7 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
/* Reconfigure each RX queue. */
for (i = 0; (i != priv->rxqs_n); ++i) {
struct rxq *rxq = (*priv->rxqs)[i];
+ unsigned int mb_len;
unsigned int max_frame_len;
int sp;
@@ -727,7 +728,9 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
* toggle scattered support (sp) if necessary. */
max_frame_len = (priv->mtu + ETHER_HDR_LEN +
(ETHER_MAX_VLAN_FRAME_LEN - ETHER_MAX_LEN));
- sp = (max_frame_len > (rxq->mb_len - RTE_PKTMBUF_HEADROOM));
+ mb_len = rte_pktmbuf_data_room_size(rxq->mp);
+ assert(mb_len >= RTE_PKTMBUF_HEADROOM);
+ sp = (max_frame_len > (mb_len - RTE_PKTMBUF_HEADROOM));
/* Provide new values to rxq_setup(). */
dev->data->dev_conf.rxmode.jumbo_frame = sp;
dev->data->dev_conf.rxmode.max_rx_pkt_len = max_frame_len;
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index cbb017b..469ba98 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -973,6 +973,7 @@ rxq_rehash(struct rte_eth_dev *dev, struct rxq *rxq)
struct rte_mbuf **pool;
unsigned int i, k;
struct ibv_exp_wq_attr mod;
+ unsigned int mb_len = rte_pktmbuf_data_room_size(rxq->mp);
int err;
DEBUG("%p: rehashing queue %p", (void *)dev, (void *)rxq);
@@ -989,9 +990,10 @@ rxq_rehash(struct rte_eth_dev *dev, struct rxq *rxq)
rxq->csum_l2tun = tmpl.csum_l2tun;
}
/* Enable scattered packets support for this queue if necessary. */
+ assert(mb_len >= RTE_PKTMBUF_HEADROOM);
if ((dev->data->dev_conf.rxmode.jumbo_frame) &&
(dev->data->dev_conf.rxmode.max_rx_pkt_len >
- (tmpl.mb_len - RTE_PKTMBUF_HEADROOM))) {
+ (mb_len - RTE_PKTMBUF_HEADROOM))) {
tmpl.sp = 1;
desc_n /= MLX5_PMD_SGE_WR_N;
} else
@@ -1156,7 +1158,7 @@ rxq_setup(struct rte_eth_dev *dev, struct rxq *rxq, uint16_t desc,
struct ibv_exp_wq_init_attr wq;
} attr;
enum ibv_exp_query_intf_status status;
- struct rte_mbuf *buf;
+ unsigned int mb_len = rte_pktmbuf_data_room_size(mp);
int ret = 0;
unsigned int i;
unsigned int cq_size = desc;
@@ -1167,26 +1169,16 @@ rxq_setup(struct rte_eth_dev *dev, struct rxq *rxq, uint16_t desc,
" multiple of %d)", (void *)dev, MLX5_PMD_SGE_WR_N);
return EINVAL;
}
- /* Get mbuf length. */
- buf = rte_pktmbuf_alloc(mp);
- if (buf == NULL) {
- ERROR("%p: unable to allocate mbuf", (void *)dev);
- return ENOMEM;
- }
- tmpl.mb_len = buf->buf_len;
- assert((rte_pktmbuf_headroom(buf) +
- rte_pktmbuf_tailroom(buf)) == tmpl.mb_len);
- assert(rte_pktmbuf_headroom(buf) == RTE_PKTMBUF_HEADROOM);
- rte_pktmbuf_free(buf);
/* Toggle RX checksum offload if hardware supports it. */
if (priv->hw_csum)
tmpl.csum = !!dev->data->dev_conf.rxmode.hw_ip_checksum;
if (priv->hw_csum_l2tun)
tmpl.csum_l2tun = !!dev->data->dev_conf.rxmode.hw_ip_checksum;
/* Enable scattered packets support for this queue if necessary. */
+ assert(mb_len >= RTE_PKTMBUF_HEADROOM);
if ((dev->data->dev_conf.rxmode.jumbo_frame) &&
(dev->data->dev_conf.rxmode.max_rx_pkt_len >
- (tmpl.mb_len - RTE_PKTMBUF_HEADROOM))) {
+ (mb_len - RTE_PKTMBUF_HEADROOM))) {
tmpl.sp = 1;
desc /= MLX5_PMD_SGE_WR_N;
}
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 7f02641..3881c30 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -1005,7 +1005,6 @@ mlx5_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
rep->ol_flags = -1;
#endif
assert(rep->buf_len == seg->buf_len);
- assert(rep->buf_len == rxq->mb_len);
/* Reconfigure sge to use rep instead of seg. */
assert(sge->lkey == rxq->mr->lkey);
sge->addr = ((uintptr_t)rep->buf_addr + seg_headroom);
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index d522f70..dd3003c 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -121,7 +121,6 @@ struct rxq {
struct rxq_elt_sp (*sp)[]; /* Scattered RX elements. */
struct rxq_elt (*no_sp)[]; /* RX elements. */
} elts;
- uint32_t mb_len; /* Length of a mp-issued mbuf. */
unsigned int socket; /* CPU socket ID for allocations. */
struct mlx5_rxq_stats stats; /* RX queue counters. */
struct ibv_exp_res_domain *rd; /* Resource Domain. */
--
2.1.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 4/7] mlx5: fix RX VLAN stripping capability check
2016-06-08 9:43 [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Nelio Laranjeiro
` (2 preceding siblings ...)
2016-06-08 9:43 ` [dpdk-dev] [PATCH 3/7] mlx: retrieve mbuf size through proper API Nelio Laranjeiro
@ 2016-06-08 9:43 ` Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 5/7] mlx5: cosmetic changes (coding style) Nelio Laranjeiro
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Nelio Laranjeiro @ 2016-06-08 9:43 UTC (permalink / raw)
To: dev; +Cc: Adrien Mazarguil
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
A hardware capability check is missing before enabling RX VLAN stripping
during queue setup.
Also, while dev_conf.rxmode.hw_vlan_strip is currently a single bit that
can be stored in priv->hw_vlan_strip directly, it should be interpreted as
a boolean value for safety.
Fixes: f3db9489188a ("mlx5: support Rx VLAN stripping")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx5/mlx5_rxq.c | 3 ++-
drivers/net/mlx5/mlx5_vlan.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 469ba98..0bcf55b 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1222,7 +1222,8 @@ rxq_setup(struct rte_eth_dev *dev, struct rxq *rxq, uint16_t desc,
DEBUG("priv->device_attr.max_sge is %d",
priv->device_attr.max_sge);
/* Configure VLAN stripping. */
- tmpl.vlan_strip = dev->data->dev_conf.rxmode.hw_vlan_strip;
+ tmpl.vlan_strip = (priv->hw_vlan_strip &&
+ !!dev->data->dev_conf.rxmode.hw_vlan_strip);
attr.wq = (struct ibv_exp_wq_init_attr){
.wq_context = NULL, /* Could be useful in the future. */
.wq_type = IBV_EXP_WQT_RQ,
diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c
index ea7af1e..ff40538 100644
--- a/drivers/net/mlx5/mlx5_vlan.c
+++ b/drivers/net/mlx5/mlx5_vlan.c
@@ -218,7 +218,7 @@ mlx5_vlan_offload_set(struct rte_eth_dev *dev, int mask)
unsigned int i;
if (mask & ETH_VLAN_STRIP_MASK) {
- int hw_vlan_strip = dev->data->dev_conf.rxmode.hw_vlan_strip;
+ int hw_vlan_strip = !!dev->data->dev_conf.rxmode.hw_vlan_strip;
if (!priv->hw_vlan_strip) {
ERROR("VLAN stripping is not supported");
--
2.1.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 5/7] mlx5: cosmetic changes (coding style)
2016-06-08 9:43 [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Nelio Laranjeiro
` (3 preceding siblings ...)
2016-06-08 9:43 ` [dpdk-dev] [PATCH 4/7] mlx5: fix RX VLAN stripping capability check Nelio Laranjeiro
@ 2016-06-08 9:43 ` Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 6/7] mlx5: enhance SR-IOV detection Nelio Laranjeiro
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Nelio Laranjeiro @ 2016-06-08 9:43 UTC (permalink / raw)
To: dev; +Cc: Adrien Mazarguil
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Add consistency to mlx5_rxtx.h.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx5/mlx5_rxtx.h | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index dd3003c..47f6299 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -231,7 +231,8 @@ struct hash_rxq {
struct ibv_qp *qp; /* Hash RX QP. */
enum hash_rxq_type type; /* Hash RX queue type. */
/* MAC flow steering rules, one per VLAN ID. */
- struct ibv_exp_flow *mac_flow[MLX5_MAX_MAC_ADDRESSES][MLX5_MAX_VLAN_IDS];
+ struct ibv_exp_flow *mac_flow
+ [MLX5_MAX_MAC_ADDRESSES][MLX5_MAX_VLAN_IDS];
struct ibv_exp_flow *special_flow
[MLX5_MAX_SPECIAL_FLOWS][MLX5_MAX_VLAN_IDS];
};
@@ -322,21 +323,17 @@ int rxq_setup(struct rte_eth_dev *, struct rxq *, uint16_t, unsigned int,
int mlx5_rx_queue_setup(struct rte_eth_dev *, uint16_t, uint16_t, unsigned int,
const struct rte_eth_rxconf *, struct rte_mempool *);
void mlx5_rx_queue_release(void *);
-uint16_t mlx5_rx_burst_secondary_setup(void *dpdk_rxq, struct rte_mbuf **pkts,
- uint16_t pkts_n);
-
+uint16_t mlx5_rx_burst_secondary_setup(void *, struct rte_mbuf **, uint16_t);
/* mlx5_txq.c */
void txq_cleanup(struct txq *);
-int txq_setup(struct rte_eth_dev *dev, struct txq *txq, uint16_t desc,
- unsigned int socket, const struct rte_eth_txconf *conf);
-
+int txq_setup(struct rte_eth_dev *, struct txq *, uint16_t, unsigned int,
+ const struct rte_eth_txconf *);
int mlx5_tx_queue_setup(struct rte_eth_dev *, uint16_t, uint16_t, unsigned int,
const struct rte_eth_txconf *);
void mlx5_tx_queue_release(void *);
-uint16_t mlx5_tx_burst_secondary_setup(void *dpdk_txq, struct rte_mbuf **pkts,
- uint16_t pkts_n);
+uint16_t mlx5_tx_burst_secondary_setup(void *, struct rte_mbuf **, uint16_t);
/* mlx5_rxtx.c */
--
2.1.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 6/7] mlx5: enhance SR-IOV detection
2016-06-08 9:43 [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Nelio Laranjeiro
` (4 preceding siblings ...)
2016-06-08 9:43 ` [dpdk-dev] [PATCH 5/7] mlx5: cosmetic changes (coding style) Nelio Laranjeiro
@ 2016-06-08 9:43 ` Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 7/7] mlx5: update documentation part related to features and limitations Nelio Laranjeiro
2016-06-13 16:04 ` [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Bruce Richardson
7 siblings, 0 replies; 10+ messages in thread
From: Nelio Laranjeiro @ 2016-06-08 9:43 UTC (permalink / raw)
To: dev; +Cc: Adrien Mazarguil
SR-IOV mode is currently set when dealing with VF devices. PF devices must
be taken into account as well if they have active VFs.
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx5/mlx5.c | 14 ++++++++------
drivers/net/mlx5/mlx5.h | 3 ++-
drivers/net/mlx5/mlx5_ethdev.c | 32 ++++++++++++++++++++++++++++++++
drivers/net/mlx5/mlx5_rxtx.c | 4 ++--
4 files changed, 44 insertions(+), 9 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 041cfc3..67a541c 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -260,7 +260,7 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
int err = 0;
struct ibv_context *attr_ctx = NULL;
struct ibv_device_attr device_attr;
- unsigned int vf;
+ unsigned int sriov;
unsigned int mps;
int idx;
int i;
@@ -303,17 +303,17 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
(pci_dev->addr.devid != pci_addr.devid) ||
(pci_dev->addr.function != pci_addr.function))
continue;
- vf = ((pci_dev->id.device_id ==
+ sriov = ((pci_dev->id.device_id ==
PCI_DEVICE_ID_MELLANOX_CONNECTX4VF) ||
(pci_dev->id.device_id ==
PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF));
/* Multi-packet send is only supported by ConnectX-4 Lx PF. */
mps = (pci_dev->id.device_id ==
PCI_DEVICE_ID_MELLANOX_CONNECTX4LX);
- INFO("PCI information matches, using device \"%s\" (VF: %s,"
- " MPS: %s)",
+ INFO("PCI information matches, using device \"%s\""
+ " (SR-IOV: %s, MPS: %s)",
list[i]->name,
- vf ? "true" : "false",
+ sriov ? "true" : "false",
mps ? "true" : "false");
attr_ctx = ibv_open_device(list[i]);
err = errno;
@@ -351,6 +351,7 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
struct ibv_exp_device_attr exp_device_attr;
#endif /* HAVE_EXP_QUERY_DEVICE */
struct ether_addr mac;
+ uint16_t num_vfs = 0;
#ifdef HAVE_EXP_QUERY_DEVICE
exp_device_attr.comp_mask =
@@ -464,7 +465,8 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
priv->ind_table_max_size = RSS_INDIRECTION_TABLE_SIZE;
#endif /* HAVE_EXP_QUERY_DEVICE */
- priv->vf = vf;
+ priv_get_num_vfs(priv, &num_vfs);
+ priv->sriov = (num_vfs || sriov);
priv->mps = mps;
/* Allocate and register default RSS hash keys. */
priv->rss_conf = rte_calloc(__func__, hash_rxq_init_n,
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 2487662..dccc18d 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -105,7 +105,7 @@ struct priv {
unsigned int hw_vlan_strip:1; /* VLAN stripping is supported. */
unsigned int hw_fcs_strip:1; /* FCS stripping is supported. */
unsigned int hw_padding:1; /* End alignment padding is supported. */
- unsigned int vf:1; /* This is a VF device. */
+ unsigned int sriov:1; /* This is a VF or PF with VF devices. */
unsigned int mps:1; /* Whether multi-packet send is supported. */
unsigned int pending_alarm:1; /* An alarm is pending. */
/* RX/TX queues. */
@@ -173,6 +173,7 @@ struct priv *mlx5_get_priv(struct rte_eth_dev *dev);
int mlx5_is_secondary(void);
int priv_get_ifname(const struct priv *, char (*)[IF_NAMESIZE]);
int priv_ifreq(const struct priv *, int req, struct ifreq *);
+int priv_get_num_vfs(struct priv *, uint16_t *);
int priv_get_mtu(struct priv *, uint16_t *);
int priv_set_flags(struct priv *, unsigned int, unsigned int);
int mlx5_dev_configure(struct rte_eth_dev *);
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index ecbb49b..d2a63b8 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -363,6 +363,38 @@ priv_ifreq(const struct priv *priv, int req, struct ifreq *ifr)
}
/**
+ * Return the number of active VFs for the current device.
+ *
+ * @param[in] priv
+ * Pointer to private structure.
+ * @param[out] num_vfs
+ * Number of active VFs.
+ *
+ * @return
+ * 0 on success, -1 on failure and errno is set.
+ */
+int
+priv_get_num_vfs(struct priv *priv, uint16_t *num_vfs)
+{
+ /* The sysfs entry name depends on the operating system. */
+ const char **name = (const char *[]){
+ "device/sriov_numvfs",
+ "device/mlx5_num_vfs",
+ NULL,
+ };
+ int ret;
+
+ do {
+ unsigned long ulong_num_vfs;
+
+ ret = priv_get_sysfs_ulong(priv, *name, &ulong_num_vfs);
+ if (!ret)
+ *num_vfs = ulong_num_vfs;
+ } while (*(++name) && ret);
+ return ret;
+}
+
+/**
* Get device MTU.
*
* @param priv
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 3881c30..9cb1dfa 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -507,7 +507,7 @@ tx_burst_sg(struct txq *txq, unsigned int segs, struct txq_elt *elt,
}
/* Update SGE. */
sge->addr = rte_pktmbuf_mtod(buf, uintptr_t);
- if (txq->priv->vf)
+ if (txq->priv->sriov)
rte_prefetch0((volatile void *)
(uintptr_t)sge->addr);
sge->length = DATA_LEN(buf);
@@ -662,7 +662,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
length = DATA_LEN(buf);
/* Update element. */
elt->buf = buf;
- if (txq->priv->vf)
+ if (txq->priv->sriov)
rte_prefetch0((volatile void *)
(uintptr_t)addr);
/* Prefetch next buffer data. */
--
2.1.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 7/7] mlx5: update documentation part related to features and limitations
2016-06-08 9:43 [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Nelio Laranjeiro
` (5 preceding siblings ...)
2016-06-08 9:43 ` [dpdk-dev] [PATCH 6/7] mlx5: enhance SR-IOV detection Nelio Laranjeiro
@ 2016-06-08 9:43 ` Nelio Laranjeiro
2016-06-08 16:39 ` Mcnamara, John
2016-06-13 16:04 ` [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Bruce Richardson
7 siblings, 1 reply; 10+ messages in thread
From: Nelio Laranjeiro @ 2016-06-08 9:43 UTC (permalink / raw)
To: dev
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
doc/guides/nics/mlx5.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index b6f91e6..d9196d1 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -86,11 +86,11 @@ Features
- Hardware checksum offloads.
- Flow director (RTE_FDIR_MODE_PERFECT and RTE_FDIR_MODE_PERFECT_MAC_VLAN).
- Secondary process TX is supported.
+- KVM and VMware ESX SR-IOV modes are supported.
Limitations
-----------
-- KVM and VMware ESX SR-IOV modes are not supported yet.
- Inner RSS for VXLAN frames is not supported yet.
- Port statistics through software counters only.
- Hardware checksum offloads for VXLAN inner header are not supported yet.
--
2.1.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 7/7] mlx5: update documentation part related to features and limitations
2016-06-08 9:43 ` [dpdk-dev] [PATCH 7/7] mlx5: update documentation part related to features and limitations Nelio Laranjeiro
@ 2016-06-08 16:39 ` Mcnamara, John
0 siblings, 0 replies; 10+ messages in thread
From: Mcnamara, John @ 2016-06-08 16:39 UTC (permalink / raw)
To: Nelio Laranjeiro, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Nelio Laranjeiro
> Sent: Wednesday, June 8, 2016 10:44 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH 7/7] mlx5: update documentation part related to
> features and limitations
>
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5
2016-06-08 9:43 [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Nelio Laranjeiro
` (6 preceding siblings ...)
2016-06-08 9:43 ` [dpdk-dev] [PATCH 7/7] mlx5: update documentation part related to features and limitations Nelio Laranjeiro
@ 2016-06-13 16:04 ` Bruce Richardson
7 siblings, 0 replies; 10+ messages in thread
From: Bruce Richardson @ 2016-06-13 16:04 UTC (permalink / raw)
To: Nelio Laranjeiro; +Cc: dev
On Wed, Jun 08, 2016 at 11:43:24AM +0200, Nelio Laranjeiro wrote:
> Various minor fixes for mlx4 (ConnectX-3) and mlx5 (ConnectX-4).
>
> Adrien Mazarguil (4):
> mlx: ensure MTU update is effective
> mlx: retrieve mbuf size through proper API
> mlx5: fix RX VLAN stripping capability check
> mlx5: cosmetic changes (coding style)
>
> Nelio Laranjeiro (3):
> mlx: remove unused memory region property
> mlx5: enhance SR-IOV detection
> mlx5: update documentation part related to features and limitations
>
> doc/guides/nics/mlx5.rst | 2 +-
> drivers/net/mlx4/mlx4.c | 43 ++++++++++++++++++++------------------
> drivers/net/mlx5/mlx5.c | 14 +++++++------
> drivers/net/mlx5/mlx5.h | 3 ++-
> drivers/net/mlx5/mlx5_ethdev.c | 47 ++++++++++++++++++++++++++++++++++++++++--
> drivers/net/mlx5/mlx5_rxq.c | 23 +++++++--------------
> drivers/net/mlx5/mlx5_rxtx.c | 7 +++----
> drivers/net/mlx5/mlx5_rxtx.h | 16 ++++++--------
> drivers/net/mlx5/mlx5_txq.c | 2 +-
> drivers/net/mlx5/mlx5_vlan.c | 2 +-
> 10 files changed, 98 insertions(+), 61 deletions(-)
>
Applied to dpdk-next-net/rel_16_07
/Bruce
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-06-13 16:05 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-08 9:43 [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 1/7] mlx: remove unused memory region property Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 2/7] mlx: ensure MTU update is effective Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 3/7] mlx: retrieve mbuf size through proper API Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 4/7] mlx5: fix RX VLAN stripping capability check Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 5/7] mlx5: cosmetic changes (coding style) Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 6/7] mlx5: enhance SR-IOV detection Nelio Laranjeiro
2016-06-08 9:43 ` [dpdk-dev] [PATCH 7/7] mlx5: update documentation part related to features and limitations Nelio Laranjeiro
2016-06-08 16:39 ` Mcnamara, John
2016-06-13 16:04 ` [dpdk-dev] [PATCH 0/7] Miscellaneous fixes for mlx4 and mlx5 Bruce Richardson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).