From: <viveksharma@marvell.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <ferruh.yigit@intel.com>,
<arybchenko@solarflare.com>,
Vivek Sharma <viveksharma@marvell.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH v2] ethdev: fix QinQ strip offload support
Date: Wed, 17 Apr 2019 13:10:46 +0530 [thread overview]
Message-ID: <1555486846-20764-1-git-send-email-viveksharma@marvell.com> (raw)
Message-ID: <20190417074046.yrE_ccIRNuMG_6cMfYKeU6TGOLJwQ4-_E1oVoze7xqI@z> (raw)
In-Reply-To: <1555240302-9771-1-git-send-email-viveksharma@marvell.com>
From: Vivek Sharma <viveksharma@marvell.com>
Enable missing support for QinQ strip rx offload
in vlan offload set/get methods.
Fixes: cc9d0456b870 ("i40e: support double vlan stripping and insertion")
Cc: stable@dpdk.org
Signed-off-by: Vivek Sharma <viveksharma@marvell.com>
---
v2:
* Use pointer to dereference dev->data->dev_conf.rxmode.offloads
lib/librte_ethdev/rte_ethdev.c | 55 +++++++++++++++++++++++-------------------
lib/librte_ethdev/rte_ethdev.h | 5 +++-
2 files changed, 34 insertions(+), 26 deletions(-)
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 243beb4..3e770bc 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -2723,53 +2723,56 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
int mask = 0;
int cur, org = 0;
uint64_t orig_offloads;
+ uint64_t *dev_offloads;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
/* save original values in case of failure */
orig_offloads = dev->data->dev_conf.rxmode.offloads;
+ dev_offloads = &dev->data->dev_conf.rxmode.offloads;
/*check which option changed by application*/
cur = !!(offload_mask & ETH_VLAN_STRIP_OFFLOAD);
- org = !!(dev->data->dev_conf.rxmode.offloads &
- DEV_RX_OFFLOAD_VLAN_STRIP);
+ org = !!(*dev_offloads & DEV_RX_OFFLOAD_VLAN_STRIP);
if (cur != org) {
if (cur)
- dev->data->dev_conf.rxmode.offloads |=
- DEV_RX_OFFLOAD_VLAN_STRIP;
+ *dev_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
else
- dev->data->dev_conf.rxmode.offloads &=
- ~DEV_RX_OFFLOAD_VLAN_STRIP;
+ *dev_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
mask |= ETH_VLAN_STRIP_MASK;
}
cur = !!(offload_mask & ETH_VLAN_FILTER_OFFLOAD);
- org = !!(dev->data->dev_conf.rxmode.offloads &
- DEV_RX_OFFLOAD_VLAN_FILTER);
+ org = !!(*dev_offloads & DEV_RX_OFFLOAD_VLAN_FILTER);
if (cur != org) {
if (cur)
- dev->data->dev_conf.rxmode.offloads |=
- DEV_RX_OFFLOAD_VLAN_FILTER;
+ *dev_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
else
- dev->data->dev_conf.rxmode.offloads &=
- ~DEV_RX_OFFLOAD_VLAN_FILTER;
+ *dev_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER;
mask |= ETH_VLAN_FILTER_MASK;
}
cur = !!(offload_mask & ETH_VLAN_EXTEND_OFFLOAD);
- org = !!(dev->data->dev_conf.rxmode.offloads &
- DEV_RX_OFFLOAD_VLAN_EXTEND);
+ org = !!(*dev_offloads & DEV_RX_OFFLOAD_VLAN_EXTEND);
if (cur != org) {
if (cur)
- dev->data->dev_conf.rxmode.offloads |=
- DEV_RX_OFFLOAD_VLAN_EXTEND;
+ *dev_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
else
- dev->data->dev_conf.rxmode.offloads &=
- ~DEV_RX_OFFLOAD_VLAN_EXTEND;
+ *dev_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND;
mask |= ETH_VLAN_EXTEND_MASK;
}
+ cur = !!(offload_mask & ETH_QINQ_STRIP_OFFLOAD);
+ org = !!(*dev_offloads & DEV_RX_OFFLOAD_QINQ_STRIP);
+ if (cur != org) {
+ if (cur)
+ *dev_offloads |= DEV_RX_OFFLOAD_QINQ_STRIP;
+ else
+ *dev_offloads &= ~DEV_RX_OFFLOAD_QINQ_STRIP;
+ mask |= ETH_QINQ_STRIP_MASK;
+ }
+
/*no change*/
if (mask == 0)
return ret;
@@ -2778,7 +2781,7 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
ret = (*dev->dev_ops->vlan_offload_set)(dev, mask);
if (ret) {
/* hit an error restore original values */
- dev->data->dev_conf.rxmode.offloads = orig_offloads;
+ *dev_offloads = orig_offloads;
}
return eth_err(port_id, ret);
@@ -2788,23 +2791,25 @@ int
rte_eth_dev_get_vlan_offload(uint16_t port_id)
{
struct rte_eth_dev *dev;
+ uint64_t *dev_offloads;
int ret = 0;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+ dev_offloads = &dev->data->dev_conf.rxmode.offloads;
- if (dev->data->dev_conf.rxmode.offloads &
- DEV_RX_OFFLOAD_VLAN_STRIP)
+ if (*dev_offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
ret |= ETH_VLAN_STRIP_OFFLOAD;
- if (dev->data->dev_conf.rxmode.offloads &
- DEV_RX_OFFLOAD_VLAN_FILTER)
+ if (*dev_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
ret |= ETH_VLAN_FILTER_OFFLOAD;
- if (dev->data->dev_conf.rxmode.offloads &
- DEV_RX_OFFLOAD_VLAN_EXTEND)
+ if (*dev_offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)
ret |= ETH_VLAN_EXTEND_OFFLOAD;
+ if (*dev_offloads & DEV_RX_OFFLOAD_QINQ_STRIP)
+ ret |= DEV_RX_OFFLOAD_QINQ_STRIP;
+
return ret;
}
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 40a068f..c1792f4 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -550,11 +550,13 @@ struct rte_eth_rss_conf {
#define ETH_VLAN_STRIP_OFFLOAD 0x0001 /**< VLAN Strip On/Off */
#define ETH_VLAN_FILTER_OFFLOAD 0x0002 /**< VLAN Filter On/Off */
#define ETH_VLAN_EXTEND_OFFLOAD 0x0004 /**< VLAN Extend On/Off */
+#define ETH_QINQ_STRIP_OFFLOAD 0x0008 /**< QINQ Strip On/Off */
/* Definitions used for mask VLAN setting */
#define ETH_VLAN_STRIP_MASK 0x0001 /**< VLAN Strip setting mask */
#define ETH_VLAN_FILTER_MASK 0x0002 /**< VLAN Filter setting mask*/
#define ETH_VLAN_EXTEND_MASK 0x0004 /**< VLAN Extend setting mask*/
+#define ETH_QINQ_STRIP_MASK 0x0008 /**< QINQ Strip setting mask */
#define ETH_VLAN_ID_MAX 0x0FFF /**< VLAN ID is in lower 12 bits*/
/* Definitions used for receive MAC address */
@@ -965,7 +967,8 @@ struct rte_eth_conf {
DEV_RX_OFFLOAD_TCP_CKSUM)
#define DEV_RX_OFFLOAD_VLAN (DEV_RX_OFFLOAD_VLAN_STRIP | \
DEV_RX_OFFLOAD_VLAN_FILTER | \
- DEV_RX_OFFLOAD_VLAN_EXTEND)
+ DEV_RX_OFFLOAD_VLAN_EXTEND | \
+ DEV_RX_OFFLOAD_QINQ_STRIP)
/*
* If new Rx offload capabilities are defined, they also must be
--
2.7.4
next prev parent reply other threads:[~2019-04-17 7:41 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-14 11:11 [dpdk-dev] [PATCH] " viveksharma
2019-04-14 11:11 ` viveksharma
2019-04-15 15:54 ` Stephen Hemminger
2019-04-15 15:54 ` Stephen Hemminger
2019-04-15 21:33 ` Rami Rosen
2019-04-15 21:33 ` Rami Rosen
2019-04-17 7:40 ` viveksharma [this message]
2019-04-17 7:40 ` [dpdk-dev] [PATCH v2] " viveksharma
2019-04-17 8:34 ` Thomas Monjalon
2019-04-17 8:34 ` Thomas Monjalon
2019-04-18 7:38 ` [dpdk-dev] [EXT] " Vivek Kumar Sharma
2019-04-18 7:38 ` Vivek Kumar Sharma
2019-04-18 8:07 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2019-04-18 8:07 ` Thomas Monjalon
2019-04-19 5:59 ` [dpdk-dev] [PATCH v3] ethdev: support QinQ strip dynamic configuration viveksharma
2019-04-19 5:59 ` viveksharma
2019-06-27 11:08 ` Ferruh Yigit
2019-07-01 10:07 ` Andrew Rybchenko
2019-07-01 13:05 ` Ferruh Yigit
2019-07-02 3:37 ` [dpdk-dev] [PATCH v4] " viveksharma
2019-07-03 17:48 ` Ferruh Yigit
2019-07-03 19:55 ` Andrew Rybchenko
2019-07-04 9:41 ` Ferruh Yigit
2019-07-04 10:05 ` Ferruh Yigit
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=1555486846-20764-1-git-send-email-viveksharma@marvell.com \
--to=viveksharma@marvell.com \
--cc=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
/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).