DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
To: dev@dpdk.org
Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Subject: [dpdk-dev] [PATCH 4/7] mlx5: fix RX VLAN stripping capability check
Date: Wed,  8 Jun 2016 11:43:28 +0200	[thread overview]
Message-ID: <1465379011-24646-5-git-send-email-nelio.laranjeiro@6wind.com> (raw)
In-Reply-To: <1465379011-24646-1-git-send-email-nelio.laranjeiro@6wind.com>

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

  parent reply	other threads:[~2016-06-08  9:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Nelio Laranjeiro [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465379011-24646-5-git-send-email-nelio.laranjeiro@6wind.com \
    --to=nelio.laranjeiro@6wind.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).