* [dpdk-dev] [PATCH] net/ice: add support for Auxiliary IP Offset Rx descriptor
@ 2020-08-26 3:21 Junfeng Guo
2020-08-31 5:33 ` Wang, Haiyue
0 siblings, 1 reply; 3+ messages in thread
From: Junfeng Guo @ 2020-08-26 3:21 UTC (permalink / raw)
To: qi.z.zhang, jingjing.wu, beilei.xing; +Cc: dev, haiyue.wang, junfeng.guo
Add RXDID #25 to support Auxiliary IP Offset Rx descriptor, including
FlexiMD.4: Outer/Single IPv4 Header offset
FlexiMD.5: Outer/Single IPv6 Header offset
And parse the valid IP Offset into mbuf by flexible descriptor
section via devargs "proto_xtr" with "proto_xtr=ip_offset".
This patch depends on:
commit e0c8ed904083 (net/ice: optimize the FlexiMD hardware check)
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
doc/guides/nics/ice.rst | 14 ++++-
drivers/net/ice/base/ice_lan_tx_rx.h | 1 +
drivers/net/ice/ice_ethdev.c | 10 +++-
drivers/net/ice/ice_ethdev.h | 1 +
drivers/net/ice/ice_rxtx.c | 77 +++++++++++++++++--------
drivers/net/ice/rte_pmd_ice.h | 13 +++++
drivers/net/ice/rte_pmd_ice_version.map | 1 +
7 files changed, 90 insertions(+), 27 deletions(-)
diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 9a9f4a6bb..ffaaad4e4 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -102,7 +102,7 @@ Runtime Config Options
The grouping ``()`` can be omitted for single element group. If no queues are
specified, PMD will use this protocol extraction type for all queues.
- Protocol is : ``vlan, ipv4, ipv6, ipv6_flow, tcp``.
+ Protocol is : ``vlan, ipv4, ipv6, ipv6_flow, tcp, ip_offset``.
.. code-block:: console
@@ -183,6 +183,18 @@ Runtime Config Options
TCPHDR2 - Reserved
+ .. table:: Protocol extraction : ``ip_offset``
+
+ +----------------------------+----------------------------+
+ | IPHDR2 | IPHDR1 |
+ +============================+============================+
+ | IPv6 HDR Offset | IPv4 HDR Offset |
+ +----------------------------+----------------------------+
+
+ IPHDR1 - Outer/Single IPv4 Header offset.
+
+ IPHDR2 - Outer/Single IPv6 Header offset.
+
Use ``rte_net_ice_dynf_proto_xtr_metadata_get`` to access the protocol
extraction metadata, and use ``RTE_PKT_RX_DYNF_PROTO_XTR_*`` to get the
metadata type of ``struct rte_mbuf::ol_flags``.
diff --git a/drivers/net/ice/base/ice_lan_tx_rx.h b/drivers/net/ice/base/ice_lan_tx_rx.h
index c47114d16..ec0c9f3ab 100644
--- a/drivers/net/ice/base/ice_lan_tx_rx.h
+++ b/drivers/net/ice/base/ice_lan_tx_rx.h
@@ -715,6 +715,7 @@ enum ice_rxdid {
ICE_RXDID_COMMS_AUX_IPV6 = 19,
ICE_RXDID_COMMS_AUX_IPV6_FLOW = 20,
ICE_RXDID_COMMS_AUX_TCP = 21,
+ ICE_RXDID_COMMS_AUX_IP_OFFSET = 25,
ICE_RXDID_LAST = 63,
};
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index d67390f29..4a161ae8a 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -65,6 +65,9 @@ static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = {
[PROTO_XTR_TCP] = {
.param = { .name = "ice_dynflag_proto_xtr_tcp" },
.ol_flag = &rte_net_ice_dynflag_proto_xtr_tcp_mask },
+ [PROTO_XTR_IP_OFFSET] = {
+ .param = { .name = "ice_dynflag_proto_xtr_ip_offset" },
+ .ol_flag = &rte_net_ice_dynflag_proto_xtr_ip_offset_mask },
};
#define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100
@@ -323,6 +326,7 @@ lookup_proto_xtr_type(const char *xtr_name)
{ "ipv6", PROTO_XTR_IPV6 },
{ "ipv6_flow", PROTO_XTR_IPV6_FLOW },
{ "tcp", PROTO_XTR_TCP },
+ { "ip_offset", PROTO_XTR_IP_OFFSET },
};
uint32_t i;
@@ -568,6 +572,10 @@ ice_check_proto_xtr_support(struct ice_hw *hw)
[PROTO_XTR_TCP] = { ICE_RXDID_COMMS_AUX_TCP,
ICE_RX_OPC_EXTRACT,
ICE_PROT_TCP_IL, ICE_PROT_ID_INVAL },
+ [PROTO_XTR_IP_OFFSET] = { ICE_RXDID_COMMS_AUX_IP_OFFSET,
+ ICE_RX_OPC_PROTID,
+ ICE_PROT_IPV4_OF_OR_S,
+ ICE_PROT_IPV6_OF_OR_S },
};
uint32_t i;
@@ -5145,7 +5153,7 @@ RTE_PMD_REGISTER_PCI(net_ice, rte_ice_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_ice, pci_id_ice_map);
RTE_PMD_REGISTER_KMOD_DEP(net_ice, "* igb_uio | uio_pci_generic | vfio-pci");
RTE_PMD_REGISTER_PARAM_STRING(net_ice,
- ICE_PROTO_XTR_ARG "=[queue:]<vlan|ipv4|ipv6|ipv6_flow|tcp>"
+ ICE_PROTO_XTR_ARG "=[queue:]<vlan|ipv4|ipv6|ipv6_flow|tcp|ip_offset>"
ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>"
ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>"
ICE_FLOW_MARK_SUPPORT_ARG "=<0|1>");
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 06b9b8683..758caa8b4 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -262,6 +262,7 @@ enum proto_xtr_type {
PROTO_XTR_IPV6,
PROTO_XTR_IPV6_FLOW,
PROTO_XTR_TCP,
+ PROTO_XTR_IP_OFFSET,
PROTO_XTR_MAX /* The last one */
};
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 2e1f06d2c..53dfef014 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -23,27 +23,40 @@ uint64_t rte_net_ice_dynflag_proto_xtr_ipv4_mask;
uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_mask;
uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;
uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;
+uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask;
static inline uint64_t
-ice_rxdid_to_proto_xtr_ol_flag(uint8_t rxdid)
-{
- static uint64_t *ol_flag_map[] = {
- [ICE_RXDID_COMMS_AUX_VLAN] =
- &rte_net_ice_dynflag_proto_xtr_vlan_mask,
- [ICE_RXDID_COMMS_AUX_IPV4] =
- &rte_net_ice_dynflag_proto_xtr_ipv4_mask,
- [ICE_RXDID_COMMS_AUX_IPV6] =
- &rte_net_ice_dynflag_proto_xtr_ipv6_mask,
- [ICE_RXDID_COMMS_AUX_IPV6_FLOW] =
- &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask,
- [ICE_RXDID_COMMS_AUX_TCP] =
- &rte_net_ice_dynflag_proto_xtr_tcp_mask,
+ice_rxdid_to_proto_xtr_ol_flag(uint8_t rxdid, bool *chk_valid)
+{
+ static struct {
+ uint64_t *ol_flag;
+ bool chk_valid;
+ } ol_flag_map[] = {
+ [ICE_RXDID_COMMS_AUX_VLAN] = {
+ &rte_net_ice_dynflag_proto_xtr_vlan_mask, true },
+ [ICE_RXDID_COMMS_AUX_IPV4] = {
+ &rte_net_ice_dynflag_proto_xtr_ipv4_mask, true },
+ [ICE_RXDID_COMMS_AUX_IPV6] = {
+ &rte_net_ice_dynflag_proto_xtr_ipv6_mask, true },
+ [ICE_RXDID_COMMS_AUX_IPV6_FLOW] = {
+ &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask, true },
+ [ICE_RXDID_COMMS_AUX_TCP] = {
+ &rte_net_ice_dynflag_proto_xtr_tcp_mask, true },
+ [ICE_RXDID_COMMS_AUX_IP_OFFSET] = {
+ &rte_net_ice_dynflag_proto_xtr_ip_offset_mask, false },
};
uint64_t *ol_flag;
- ol_flag = rxdid < RTE_DIM(ol_flag_map) ? ol_flag_map[rxdid] : NULL;
+ if (rxdid < RTE_DIM(ol_flag_map)) {
+ ol_flag = ol_flag_map[rxdid].ol_flag;
+ if (!ol_flag)
+ return 0ULL;
- return ol_flag != NULL ? *ol_flag : 0ULL;
+ *chk_valid = ol_flag_map[rxdid].chk_valid;
+ return *ol_flag;
+ }
+
+ return 0ULL;
}
static inline uint8_t
@@ -56,6 +69,7 @@ ice_proto_xtr_type_to_rxdid(uint8_t xtr_type)
[PROTO_XTR_IPV6] = ICE_RXDID_COMMS_AUX_IPV6,
[PROTO_XTR_IPV6_FLOW] = ICE_RXDID_COMMS_AUX_IPV6_FLOW,
[PROTO_XTR_TCP] = ICE_RXDID_COMMS_AUX_TCP,
+ [PROTO_XTR_IP_OFFSET] = ICE_RXDID_COMMS_AUX_IP_OFFSET,
};
return xtr_type < RTE_DIM(rxdid_map) ?
@@ -1312,23 +1326,36 @@ ice_rxd_to_proto_xtr(struct rte_mbuf *mb,
volatile struct ice_32b_rx_flex_desc_comms *desc)
{
uint16_t stat_err = rte_le_to_cpu_16(desc->status_error1);
- uint32_t metadata;
+ uint32_t metadata = 0;
uint64_t ol_flag;
+ bool chk_valid;
- if (unlikely(!(stat_err & ICE_RX_PROTO_XTR_VALID)))
- return;
-
- ol_flag = ice_rxdid_to_proto_xtr_ol_flag(desc->rxdid);
+ ol_flag = ice_rxdid_to_proto_xtr_ol_flag(desc->rxdid, &chk_valid);
if (unlikely(!ol_flag))
return;
- mb->ol_flags |= ol_flag;
+ if (chk_valid) {
+ if (stat_err & (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S))
+ metadata = rte_le_to_cpu_16(desc->flex_ts.flex.aux0);
+
+ if (stat_err & (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S))
+ metadata |=
+ rte_le_to_cpu_16(desc->flex_ts.flex.aux1) << 16;
+ } else {
+ /**
+ * No need to check XTR_MD.#_VLD bit in Status/Error fields for
+ * Protocol Offset according to CPK HAS 7.9.8.
+ */
+ if (rte_le_to_cpu_16(desc->flex_ts.flex.aux0) != 0xFFFF)
+ metadata = rte_le_to_cpu_16(desc->flex_ts.flex.aux0);
+ else if (rte_le_to_cpu_16(desc->flex_ts.flex.aux1) != 0xFFFF)
+ metadata = rte_le_to_cpu_16(desc->flex_ts.flex.aux1);
+ }
- metadata = stat_err & (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_S) ?
- rte_le_to_cpu_16(desc->flex_ts.flex.aux0) : 0;
+ if (!metadata)
+ return;
- if (likely(stat_err & (1 << ICE_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_S)))
- metadata |= rte_le_to_cpu_16(desc->flex_ts.flex.aux1) << 16;
+ mb->ol_flags |= ol_flag;
*RTE_NET_ICE_DYNF_PROTO_XTR_METADATA(mb) = metadata;
}
diff --git a/drivers/net/ice/rte_pmd_ice.h b/drivers/net/ice/rte_pmd_ice.h
index e254db053..9a436a140 100644
--- a/drivers/net/ice/rte_pmd_ice.h
+++ b/drivers/net/ice/rte_pmd_ice.h
@@ -78,6 +78,8 @@ union rte_net_ice_proto_xtr_metadata {
doff:4;
uint16_t rsvd;
} tcp;
+
+ uint32_t ip_ofs;
};
/* Offset of mbuf dynamic field for protocol extraction data */
@@ -89,6 +91,7 @@ extern uint64_t rte_net_ice_dynflag_proto_xtr_ipv4_mask;
extern uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_mask;
extern uint64_t rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;
extern uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;
+extern uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask;
/**
* The mbuf dynamic field pointer for protocol extraction metadata.
@@ -133,6 +136,13 @@ extern uint64_t rte_net_ice_dynflag_proto_xtr_tcp_mask;
#define RTE_PKT_RX_DYNF_PROTO_XTR_TCP \
(rte_net_ice_dynflag_proto_xtr_tcp_mask)
+/**
+ * The mbuf dynamic flag for IP_OFFSET extraction metadata, it is valid
+ * when dev_args 'proto_xtr' has 'ip_offset' specified.
+ */
+#define RTE_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET \
+ (rte_net_ice_dynflag_proto_xtr_ip_offset_mask)
+
/**
* Check if mbuf dynamic field for protocol extraction metadata is registered.
*
@@ -222,6 +232,9 @@ rte_net_ice_dump_proto_xtr_metadata(struct rte_mbuf *m)
data.tcp.rst ? "R" : "",
data.tcp.syn ? "S" : "",
data.tcp.fin ? "F" : "");
+ else if (m->ol_flags & RTE_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET)
+ printf(" - Protocol Offset:ip_offset=%u",
+ data.ip_ofs);
}
#ifdef __cplusplus
diff --git a/drivers/net/ice/rte_pmd_ice_version.map b/drivers/net/ice/rte_pmd_ice_version.map
index 91f40225e..632a296a0 100644
--- a/drivers/net/ice/rte_pmd_ice_version.map
+++ b/drivers/net/ice/rte_pmd_ice_version.map
@@ -12,4 +12,5 @@ EXPERIMENTAL {
rte_net_ice_dynflag_proto_xtr_ipv6_mask;
rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;
rte_net_ice_dynflag_proto_xtr_tcp_mask;
+ rte_net_ice_dynflag_proto_xtr_ip_offset_mask;
};
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/ice: add support for Auxiliary IP Offset Rx descriptor
2020-08-26 3:21 [dpdk-dev] [PATCH] net/ice: add support for Auxiliary IP Offset Rx descriptor Junfeng Guo
@ 2020-08-31 5:33 ` Wang, Haiyue
2020-08-31 5:46 ` Zhang, Qi Z
0 siblings, 1 reply; 3+ messages in thread
From: Wang, Haiyue @ 2020-08-31 5:33 UTC (permalink / raw)
To: Guo, Junfeng, Zhang, Qi Z, Wu, Jingjing, Xing, Beilei; +Cc: dev
> -----Original Message-----
> From: Guo, Junfeng <junfeng.guo@intel.com>
> Sent: Wednesday, August 26, 2020 11:22
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Wang, Haiyue <haiyue.wang@intel.com>; Guo, Junfeng <junfeng.guo@intel.com>
> Subject: [PATCH] net/ice: add support for Auxiliary IP Offset Rx descriptor
>
> Add RXDID #25 to support Auxiliary IP Offset Rx descriptor, including
> FlexiMD.4: Outer/Single IPv4 Header offset
> FlexiMD.5: Outer/Single IPv6 Header offset
> And parse the valid IP Offset into mbuf by flexible descriptor
> section via devargs "proto_xtr" with "proto_xtr=ip_offset".
>
> This patch depends on:
> commit e0c8ed904083 (net/ice: optimize the FlexiMD hardware check)
>
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> ---
> doc/guides/nics/ice.rst | 14 ++++-
> drivers/net/ice/base/ice_lan_tx_rx.h | 1 +
> drivers/net/ice/ice_ethdev.c | 10 +++-
> drivers/net/ice/ice_ethdev.h | 1 +
> drivers/net/ice/ice_rxtx.c | 77 +++++++++++++++++--------
> drivers/net/ice/rte_pmd_ice.h | 13 +++++
> drivers/net/ice/rte_pmd_ice_version.map | 1 +
> 7 files changed, 90 insertions(+), 27 deletions(-)
>
[...]
> + /**
> + * No need to check XTR_MD.#_VLD bit in Status/Error fields for
> + * Protocol Offset according to CPK HAS 7.9.8.
> + */
These comments are no need, since HAS doc session is internal information, and the
code is clean enough: if (chk_valid) ... else...
> + if (rte_le_to_cpu_16(desc->flex_ts.flex.aux0) != 0xFFFF)
> + metadata = rte_le_to_cpu_16(desc->flex_ts.flex.aux0);
> + else if (rte_le_to_cpu_16(desc->flex_ts.flex.aux1) != 0xFFFF)
> + metadata = rte_le_to_cpu_16(desc->flex_ts.flex.aux1);
Others,
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
> 2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/ice: add support for Auxiliary IP Offset Rx descriptor
2020-08-31 5:33 ` Wang, Haiyue
@ 2020-08-31 5:46 ` Zhang, Qi Z
0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2020-08-31 5:46 UTC (permalink / raw)
To: Wang, Haiyue, Guo, Junfeng, Wu, Jingjing, Xing, Beilei; +Cc: dev
> -----Original Message-----
> From: Wang, Haiyue <haiyue.wang@intel.com>
> Sent: Monday, August 31, 2020 1:34 PM
> To: Guo, Junfeng <junfeng.guo@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH] net/ice: add support for Auxiliary IP Offset Rx descriptor
>
> > -----Original Message-----
> > From: Guo, Junfeng <junfeng.guo@intel.com>
> > Sent: Wednesday, August 26, 2020 11:22
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing
> > <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> > Cc: dev@dpdk.org; Wang, Haiyue <haiyue.wang@intel.com>; Guo, Junfeng
> > <junfeng.guo@intel.com>
> > Subject: [PATCH] net/ice: add support for Auxiliary IP Offset Rx
> > descriptor
> >
> > Add RXDID #25 to support Auxiliary IP Offset Rx descriptor, including
> > FlexiMD.4: Outer/Single IPv4 Header offset
> > FlexiMD.5: Outer/Single IPv6 Header offset And parse the valid IP
> > Offset into mbuf by flexible descriptor section via devargs
> > "proto_xtr" with "proto_xtr=ip_offset".
> >
> > This patch depends on:
> > commit e0c8ed904083 (net/ice: optimize the FlexiMD hardware check)
> >
> > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> > ---
> > doc/guides/nics/ice.rst | 14 ++++-
> > drivers/net/ice/base/ice_lan_tx_rx.h | 1 +
> > drivers/net/ice/ice_ethdev.c | 10 +++-
> > drivers/net/ice/ice_ethdev.h | 1 +
> > drivers/net/ice/ice_rxtx.c | 77 +++++++++++++++++--------
> > drivers/net/ice/rte_pmd_ice.h | 13 +++++
> > drivers/net/ice/rte_pmd_ice_version.map | 1 +
> > 7 files changed, 90 insertions(+), 27 deletions(-)
> >
>
> [...]
>
> > +/**
> > + * No need to check XTR_MD.#_VLD bit in Status/Error fields for
> > + * Protocol Offset according to CPK HAS 7.9.8.
> > + */
>
> These comments are no need, since HAS doc session is internal information,
> and the code is clean enough: if (chk_valid) ... else...
>
> > +if (rte_le_to_cpu_16(desc->flex_ts.flex.aux0) != 0xFFFF) metadata =
> > +rte_le_to_cpu_16(desc->flex_ts.flex.aux0);
> > +else if (rte_le_to_cpu_16(desc->flex_ts.flex.aux1) != 0xFFFF)
> > +metadata = rte_le_to_cpu_16(desc->flex_ts.flex.aux1);
>
> Others,
>
> Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Applied to dpdk-next-net-intel after remove unnecessary comment.
Thanks
Qi
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-31 5:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 3:21 [dpdk-dev] [PATCH] net/ice: add support for Auxiliary IP Offset Rx descriptor Junfeng Guo
2020-08-31 5:33 ` Wang, Haiyue
2020-08-31 5:46 ` Zhang, Qi Z
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).