From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id CC8469AC6 for ; Wed, 8 Jun 2016 11:44:40 +0200 (CEST) Received: by mail-wm0-f49.google.com with SMTP id k184so15496211wme.1 for ; Wed, 08 Jun 2016 02:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6ZSnI6UMGq6lCMvXk+MG4tet+2dF7RtFuGi4d1jtBVU=; b=IdBO1TCtWklDpBYXgMPadXxrIHFgIog72yO/cnuol2aPAmMQmuR42mWUZNBgAA4NjU Bstb6arOuctaW0lAJLQR7QKTurqKlIR65T8smRl1Y/lIEPpoUGMWH1dOKSk/FjCV2BJ7 xjGYae1ppeYCt42tfGaeCZb5UTMno0gOIzjGyZ9k9iN74HqvcuPxxTk6sO2ydUQFel1H aNOeeLadOqz3cDFu9BujN5nwAS2Ydic26l8z8/kpEmxubXnZV3oZXLMnTFiL4jSw2a5E GS/FKqlqqceiHv4wL6U1PUHzdKJk+quzMcIWqBqIePs4Gj4Q4JaO4fh1JduwpyhYBzlq PnHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6ZSnI6UMGq6lCMvXk+MG4tet+2dF7RtFuGi4d1jtBVU=; b=PIgTQCu4qFItZ+n5vxkE9grvb+OJXZB1K8Lvb4A00wddgUgYhZwCmUT98qPhmINxXH H3ZyLUeGKqRH0OKr2NP/R+gwULE2bDUFDT0rlZCCCS+2SWdDI6/b+IQDDgKpnodQl74A WdUEUOjYLkMV0GP58rdZvkvlAjTBDsPRMW2iPqUHJigUw8mK6aFVR6HbAJoa+9BYBv+o FcnxpqlJMz8nnhujc33191tUbEbPjv74PR54Al4WDlXVgt48q6rf67Qdaj0w//du9QW6 j98ovoiYQ90gsCP+U9uurBXyFZ07XWpVH43EoBipBfs3r+cNmExFQMcmNEL7VOAGwKYH ifKw== X-Gm-Message-State: ALyK8tLrrtfxJ/w/lHe4IVSnuEV36A6+WVx1mdBd8kck3MhK4TvhleYzwYyyquL3tOF7WzW1 X-Received: by 10.194.3.51 with SMTP id 19mr3822485wjz.57.1465379080642; Wed, 08 Jun 2016 02:44:40 -0700 (PDT) Received: from ping.vm.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id xw8sm479085wjb.30.2016.06.08.02.44.39 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Jun 2016 02:44:40 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Cc: Adrien Mazarguil Date: Wed, 8 Jun 2016 11:43:28 +0200 Message-Id: <1465379011-24646-5-git-send-email-nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1465379011-24646-1-git-send-email-nelio.laranjeiro@6wind.com> References: <1465379011-24646-1-git-send-email-nelio.laranjeiro@6wind.com> Subject: [dpdk-dev] [PATCH 4/7] mlx5: fix RX VLAN stripping capability check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2016 09:44:41 -0000 From: Adrien Mazarguil 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 --- 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