net/ice: refactor flex descriptor protocol field extraction

The ice has the feature to extract protocol fields into flex descriptor
by programming per queue. However, the dynamic field for proto_ext are
allocated by PMD, it is the responsibility of application to reserved
the field, before start DPDK.

Application with parse the offset and proto_ext name to PMD with devargs.
Remove related private API in 'rte_pmd_ice.h' and 'rte_pmd_ice.h' file.

Signed-off-by: Kevin Liu <kevinx.liu@intel.com>
Tested-by: Jin Ling <jin.ling@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
Kevin Liu 2022-08-30 14:30:51 +00:00 committed by Qi Zhang
parent eb944b5906
commit df539aaf35
12 changed files with 123 additions and 339 deletions

View File

@ -44,7 +44,6 @@ The public API headers are grouped by topics:
[KNI](@ref rte_kni.h), [KNI](@ref rte_kni.h),
[ixgbe](@ref rte_pmd_ixgbe.h), [ixgbe](@ref rte_pmd_ixgbe.h),
[i40e](@ref rte_pmd_i40e.h), [i40e](@ref rte_pmd_i40e.h),
[ice](@ref rte_pmd_ice.h),
[iavf](@ref rte_pmd_iavf.h), [iavf](@ref rte_pmd_iavf.h),
[bnxt](@ref rte_pmd_bnxt.h), [bnxt](@ref rte_pmd_bnxt.h),
[cnxk](@ref rte_pmd_cnxk.h), [cnxk](@ref rte_pmd_cnxk.h),

View File

@ -18,7 +18,6 @@ INPUT = @TOPDIR@/doc/api/doxy-api-index.md \
@TOPDIR@/drivers/net/dpaa2 \ @TOPDIR@/drivers/net/dpaa2 \
@TOPDIR@/drivers/net/i40e \ @TOPDIR@/drivers/net/i40e \
@TOPDIR@/drivers/net/iavf \ @TOPDIR@/drivers/net/iavf \
@TOPDIR@/drivers/net/ice \
@TOPDIR@/drivers/net/ixgbe \ @TOPDIR@/drivers/net/ixgbe \
@TOPDIR@/drivers/net/mlx5 \ @TOPDIR@/drivers/net/mlx5 \
@TOPDIR@/drivers/net/softnic \ @TOPDIR@/drivers/net/softnic \

View File

@ -110,29 +110,44 @@ Runtime Config Options
The argument format is:: The argument format is::
-a 18:00.0,proto_xtr=<queues:protocol>[<queues:protocol>...] 18:00.0,proto_xtr=<queues:protocol>[<queues:protocol>...],field_offs=<offset>, \
-a 18:00.0,proto_xtr=<protocol> field_name=<name>
18:00.0,proto_xtr=<protocol>,field_offs=<offset>,field_name=<name>
Queues are grouped by ``(`` and ``)`` within the group. The ``-`` character Queues are grouped by ``(`` and ``)`` within the group. The ``-`` character
is used as a range separator and ``,`` is used as a single number separator. is used as a range separator and ``,`` is used as a single number separator.
The grouping ``()`` can be omitted for single element group. If no queues are The grouping ``()`` can be omitted for single element group. If no queues are
specified, PMD will use this protocol extraction type for all queues. specified, PMD will use this protocol extraction type for all queues.
``field_offs`` is the offset of mbuf dynamic field for protocol extraction data.
``field_name`` is the name of mbuf dynamic field for protocol extraction data.
``field_offs`` and ``field_name`` will be checked whether it is valid. If invalid,
an error print will be returned: ``Invalid field offset or name, no match dynfield``,
and the proto_ext function will not be enabled.
Protocol is : ``vlan, ipv4, ipv6, ipv6_flow, tcp, ip_offset``. Protocol is : ``vlan, ipv4, ipv6, ipv6_flow, tcp, ip_offset``.
.. code-block:: console .. code-block:: console
dpdk-testpmd -a 18:00.0,proto_xtr='[(1,2-3,8-9):tcp,10-13:vlan]' dpdk-testpmd -c 0xff -- -i
port stop 0
port detach 0
port attach 18:00.0,proto_xtr='[(1,2-3,8-9):tcp,10-13:vlan]',field_offs=92,field_name=pmd_dyn
This setting means queues 1, 2-3, 8-9 are TCP extraction, queues 10-13 are This setting means queues 1, 2-3, 8-9 are TCP extraction, queues 10-13 are
VLAN extraction, other queues run with no protocol extraction. VLAN extraction, other queues run with no protocol extraction. The offset of mbuf
dynamic field is 92 for all queues with protocol extraction.
.. code-block:: console .. code-block:: console
dpdk-testpmd -a 18:00.0,proto_xtr=vlan,proto_xtr='[(1,2-3,8-9):tcp,10-23:ipv6]' dpdk-testpmd -c 0xff -- -i
port stop 0
port detach 0
port attach 18:00.0,proto_xtr=vlan,proto_xtr='[(1,2-3,8-9):tcp,10-23:ipv6]', \
field_offs=92,field_name=pmd_dyn
This setting means queues 1, 2-3, 8-9 are TCP extraction, queues 10-23 are This setting means queues 1, 2-3, 8-9 are TCP extraction, queues 10-23 are
IPv6 extraction, other queues use the default VLAN extraction. IPv6 extraction, other queues use the default VLAN extraction. The offset of mbuf
dynamic field is 92 for all queues with protocol extraction.
The extraction metadata is copied into the registered dynamic mbuf field, and The extraction metadata is copied into the registered dynamic mbuf field, and
the related dynamic mbuf flags is set. the related dynamic mbuf flags is set.
@ -211,13 +226,6 @@ Runtime Config Options
IPHDR2 - Outer/Single IPv6 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``.
The ``rte_net_ice_dump_proto_xtr_metadata`` routine shows how to
access the protocol extraction result in ``struct rte_mbuf``.
- ``Hardware debug mask log support`` (default ``0``) - ``Hardware debug mask log support`` (default ``0``)
User can enable the related hardware debug mask such as ICE_DBG_NVM:: User can enable the related hardware debug mask such as ICE_DBG_NVM::

View File

@ -9,7 +9,6 @@
#include <rte_tailq.h> #include <rte_tailq.h>
#include "ice_ethdev.h" #include "ice_ethdev.h"
#include "rte_pmd_ice.h"
#define ICE_BUFF_SEG_HEADER_FLAG 0x1 #define ICE_BUFF_SEG_HEADER_FLAG 0x1
#define ICE_PKG_HDR_HEADR_PART1 1 #define ICE_PKG_HDR_HEADR_PART1 1

View File

@ -21,7 +21,6 @@
#include "base/ice_common.h" #include "base/ice_common.h"
#include "base/ice_ptp_hw.h" #include "base/ice_ptp_hw.h"
#include "rte_pmd_ice.h"
#include "ice_ethdev.h" #include "ice_ethdev.h"
#include "ice_rxtx.h" #include "ice_rxtx.h"
#include "ice_generic_flow.h" #include "ice_generic_flow.h"
@ -30,6 +29,8 @@
#define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support" #define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support"
#define ICE_PIPELINE_MODE_SUPPORT_ARG "pipeline-mode-support" #define ICE_PIPELINE_MODE_SUPPORT_ARG "pipeline-mode-support"
#define ICE_PROTO_XTR_ARG "proto_xtr" #define ICE_PROTO_XTR_ARG "proto_xtr"
#define ICE_FIELD_OFFS_ARG "field_offs"
#define ICE_FIELD_NAME_ARG "field_name"
#define ICE_HW_DEBUG_MASK_ARG "hw_debug_mask" #define ICE_HW_DEBUG_MASK_ARG "hw_debug_mask"
#define ICE_ONE_PPS_OUT_ARG "pps_out" #define ICE_ONE_PPS_OUT_ARG "pps_out"
#define ICE_RX_LOW_LATENCY_ARG "rx_low_latency" #define ICE_RX_LOW_LATENCY_ARG "rx_low_latency"
@ -43,6 +44,8 @@ static const char * const ice_valid_args[] = {
ICE_SAFE_MODE_SUPPORT_ARG, ICE_SAFE_MODE_SUPPORT_ARG,
ICE_PIPELINE_MODE_SUPPORT_ARG, ICE_PIPELINE_MODE_SUPPORT_ARG,
ICE_PROTO_XTR_ARG, ICE_PROTO_XTR_ARG,
ICE_FIELD_OFFS_ARG,
ICE_FIELD_NAME_ARG,
ICE_HW_DEBUG_MASK_ARG, ICE_HW_DEBUG_MASK_ARG,
ICE_ONE_PPS_OUT_ARG, ICE_ONE_PPS_OUT_ARG,
ICE_RX_LOW_LATENCY_ARG, ICE_RX_LOW_LATENCY_ARG,
@ -51,16 +54,8 @@ static const char * const ice_valid_args[] = {
#define PPS_OUT_DELAY_NS 1 #define PPS_OUT_DELAY_NS 1
static const struct rte_mbuf_dynfield ice_proto_xtr_metadata_param = {
.name = "intel_pmd_dynfield_proto_xtr_metadata",
.size = sizeof(uint32_t),
.align = __alignof__(uint32_t),
.flags = 0,
};
struct proto_xtr_ol_flag { struct proto_xtr_ol_flag {
const struct rte_mbuf_dynflag param; const struct rte_mbuf_dynflag param;
uint64_t *ol_flag;
bool required; bool required;
}; };
@ -68,23 +63,17 @@ static bool ice_proto_xtr_hw_support[PROTO_XTR_MAX];
static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = { static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = {
[PROTO_XTR_VLAN] = { [PROTO_XTR_VLAN] = {
.param = { .name = "intel_pmd_dynflag_proto_xtr_vlan" }, .param = { .name = "intel_pmd_dynflag_proto_xtr_vlan" }},
.ol_flag = &rte_net_ice_dynflag_proto_xtr_vlan_mask },
[PROTO_XTR_IPV4] = { [PROTO_XTR_IPV4] = {
.param = { .name = "intel_pmd_dynflag_proto_xtr_ipv4" }, .param = { .name = "intel_pmd_dynflag_proto_xtr_ipv4" }},
.ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv4_mask },
[PROTO_XTR_IPV6] = { [PROTO_XTR_IPV6] = {
.param = { .name = "intel_pmd_dynflag_proto_xtr_ipv6" }, .param = { .name = "intel_pmd_dynflag_proto_xtr_ipv6" }},
.ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv6_mask },
[PROTO_XTR_IPV6_FLOW] = { [PROTO_XTR_IPV6_FLOW] = {
.param = { .name = "intel_pmd_dynflag_proto_xtr_ipv6_flow" }, .param = { .name = "intel_pmd_dynflag_proto_xtr_ipv6_flow" }},
.ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask },
[PROTO_XTR_TCP] = { [PROTO_XTR_TCP] = {
.param = { .name = "intel_pmd_dynflag_proto_xtr_tcp" }, .param = { .name = "intel_pmd_dynflag_proto_xtr_tcp" }},
.ol_flag = &rte_net_ice_dynflag_proto_xtr_tcp_mask },
[PROTO_XTR_IP_OFFSET] = { [PROTO_XTR_IP_OFFSET] = {
.param = { .name = "intel_pmd_dynflag_proto_xtr_ip_offset" }, .param = { .name = "intel_pmd_dynflag_proto_xtr_ip_offset" }}
.ol_flag = &rte_net_ice_dynflag_proto_xtr_ip_offset_mask },
}; };
#define ICE_OS_DEFAULT_PKG_NAME "ICE OS Default Package" #define ICE_OS_DEFAULT_PKG_NAME "ICE OS Default Package"
@ -613,6 +602,45 @@ handle_proto_xtr_arg(__rte_unused const char *key, const char *value,
return 0; return 0;
} }
static int
handle_field_offs_arg(__rte_unused const char *key, const char *value,
void *offs_args)
{
uint8_t *offset = offs_args;
if (value == NULL || offs_args == NULL)
return -EINVAL;
if (!isdigit(*value))
return -1;
*offset = atoi(value);
return 0;
}
static int
handle_field_name_arg(__rte_unused const char *key, const char *value,
void *name_args)
{
char *name = name_args;
int ret;
if (name == NULL || name_args == NULL)
return -EINVAL;
if (isdigit(*value))
return -1;
ret = strlcpy(name, value, RTE_MBUF_DYN_NAMESIZE);
if (ret < 0 || ret >= RTE_MBUF_DYN_NAMESIZE) {
PMD_DRV_LOG(ERR,
"The protocol extraction field name too long : '%s'",
name);
return -1;
}
return 0;
}
static void static void
ice_check_proto_xtr_support(struct ice_hw *hw) ice_check_proto_xtr_support(struct ice_hw *hw)
{ {
@ -1401,7 +1429,7 @@ ice_init_proto_xtr(struct rte_eth_dev *dev)
struct ice_hw *hw = ICE_PF_TO_HW(pf); struct ice_hw *hw = ICE_PF_TO_HW(pf);
const struct proto_xtr_ol_flag *ol_flag; const struct proto_xtr_ol_flag *ol_flag;
bool proto_xtr_enable = false; bool proto_xtr_enable = false;
int offset; int offset, field_offs;
uint16_t i; uint16_t i;
pf->proto_xtr = rte_zmalloc(NULL, pf->lan_nb_qps, 0); pf->proto_xtr = rte_zmalloc(NULL, pf->lan_nb_qps, 0);
@ -1423,27 +1451,35 @@ ice_init_proto_xtr(struct rte_eth_dev *dev)
} }
} }
if (likely(!proto_xtr_enable)) if (likely(!proto_xtr_enable)) {
ad->devargs.xtr_field_offs = -1;
return; return;
}
ice_check_proto_xtr_support(hw); ice_check_proto_xtr_support(hw);
offset = rte_mbuf_dynfield_register(&ice_proto_xtr_metadata_param); /*check mbuf dynfield*/
if (unlikely(offset == -1)) { field_offs = rte_mbuf_dynfield_lookup(ad->devargs.xtr_field_name, NULL);
PMD_DRV_LOG(ERR, if (ad->devargs.xtr_field_offs == field_offs) {
"Protocol extraction metadata is disabled in mbuf with error %d", PMD_DRV_LOG(DEBUG,
-rte_errno); "Protocol extraction metadata offset in mbuf is : %d",
ad->devargs.xtr_field_offs);
} else {
PMD_DRV_LOG(ERR, "Invalid field offset or name, no match dynfield, [%d],[%s]",
ad->devargs.xtr_field_offs, ad->devargs.xtr_field_name);
ad->devargs.xtr_field_offs = -1;
return; return;
} }
PMD_DRV_LOG(DEBUG, PMD_DRV_LOG(DEBUG,
"Protocol extraction metadata offset in mbuf is : %d", "Protocol extraction metadata offset in mbuf is : %d",
offset); ad->devargs.xtr_field_offs);
rte_net_ice_dynfield_proto_xtr_metadata_offs = offset;
for (i = 0; i < RTE_DIM(ice_proto_xtr_ol_flag_params); i++) { for (i = 0; i < RTE_DIM(ice_proto_xtr_ol_flag_params); i++) {
ol_flag = &ice_proto_xtr_ol_flag_params[i]; ol_flag = &ice_proto_xtr_ol_flag_params[i];
ad->devargs.xtr_flag_offs[i] = 0xff;
if (!ol_flag->required) if (!ol_flag->required)
continue; continue;
@ -1451,7 +1487,7 @@ ice_init_proto_xtr(struct rte_eth_dev *dev)
PMD_DRV_LOG(ERR, PMD_DRV_LOG(ERR,
"Protocol extraction type %u is not supported in hardware", "Protocol extraction type %u is not supported in hardware",
i); i);
rte_net_ice_dynfield_proto_xtr_metadata_offs = -1; ad->devargs.xtr_field_offs = -1;
break; break;
} }
@ -1461,14 +1497,15 @@ ice_init_proto_xtr(struct rte_eth_dev *dev)
"Protocol extraction offload '%s' failed to register with error %d", "Protocol extraction offload '%s' failed to register with error %d",
ol_flag->param.name, -rte_errno); ol_flag->param.name, -rte_errno);
rte_net_ice_dynfield_proto_xtr_metadata_offs = -1; ad->devargs.xtr_field_offs = -1;
break; break;
} }
PMD_DRV_LOG(DEBUG, PMD_DRV_LOG(DEBUG,
"Protocol extraction offload '%s' offset in mbuf is : %d", "Protocol extraction offload '%s' offset in mbuf is : %d",
ol_flag->param.name, offset); ol_flag->param.name, offset);
*ol_flag->ol_flag = 1ULL << offset;
ad->devargs.xtr_flag_offs[i] = offset;
} }
} }
@ -2011,6 +2048,16 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
if (ret) if (ret)
goto bail; goto bail;
ret = rte_kvargs_process(kvlist, ICE_FIELD_OFFS_ARG,
&handle_field_offs_arg, &ad->devargs.xtr_field_offs);
if (ret)
goto bail;
ret = rte_kvargs_process(kvlist, ICE_FIELD_NAME_ARG,
&handle_field_name_arg, &ad->devargs.xtr_field_name);
if (ret)
goto bail;
ret = rte_kvargs_process(kvlist, ICE_SAFE_MODE_SUPPORT_ARG, ret = rte_kvargs_process(kvlist, ICE_SAFE_MODE_SUPPORT_ARG,
&parse_bool, &ad->devargs.safe_mode_support); &parse_bool, &ad->devargs.safe_mode_support);
if (ret) if (ret)

View File

@ -565,6 +565,10 @@ struct ice_devargs {
uint8_t proto_xtr[ICE_MAX_QUEUE_NUM]; uint8_t proto_xtr[ICE_MAX_QUEUE_NUM];
uint8_t pin_idx; uint8_t pin_idx;
uint8_t pps_out_ena; uint8_t pps_out_ena;
int xtr_field_offs;
uint8_t xtr_flag_offs[PROTO_XTR_MAX];
/* Name of the field. */
char xtr_field_name[RTE_MBUF_DYN_NAMESIZE];
}; };
/** /**
@ -727,4 +731,7 @@ ice_align_floor(int n)
((phy_type) & ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC) || \ ((phy_type) & ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC) || \
((phy_type) & ICE_PHY_TYPE_HIGH_100G_AUI2)) ((phy_type) & ICE_PHY_TYPE_HIGH_100G_AUI2))
__rte_experimental
int rte_pmd_ice_dump_package(uint16_t port, uint8_t **buff, uint32_t *size);
#endif /* _ICE_ETHDEV_H_ */ #endif /* _ICE_ETHDEV_H_ */

View File

@ -6,7 +6,6 @@
#include <rte_net.h> #include <rte_net.h>
#include <rte_vect.h> #include <rte_vect.h>
#include "rte_pmd_ice.h"
#include "ice_rxtx.h" #include "ice_rxtx.h"
#include "ice_rxtx_vec_common.h" #include "ice_rxtx_vec_common.h"
@ -15,16 +14,11 @@
RTE_MBUF_F_TX_TCP_SEG | \ RTE_MBUF_F_TX_TCP_SEG | \
RTE_MBUF_F_TX_OUTER_IP_CKSUM) RTE_MBUF_F_TX_OUTER_IP_CKSUM)
/* Offset of mbuf dynamic field for protocol extraction data */ /**
int rte_net_ice_dynfield_proto_xtr_metadata_offs = -1; * The mbuf dynamic field pointer for protocol extraction metadata.
*/
/* Mask of mbuf dynamic flags for protocol extraction type */ #define ICE_DYNF_PROTO_XTR_METADATA(m, n) \
uint64_t rte_net_ice_dynflag_proto_xtr_vlan_mask; RTE_MBUF_DYNFIELD((m), (n), uint32_t *)
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 int static int
ice_monitor_callback(const uint64_t value, ice_monitor_callback(const uint64_t value,
@ -160,7 +154,7 @@ ice_rxd_to_pkt_fields_by_comms_aux_v1(struct ice_rx_queue *rxq,
if (metadata) { if (metadata) {
mb->ol_flags |= rxq->xtr_ol_flag; mb->ol_flags |= rxq->xtr_ol_flag;
*RTE_NET_ICE_DYNF_PROTO_XTR_METADATA(mb) = metadata; *ICE_DYNF_PROTO_XTR_METADATA(mb, rxq->xtr_field_offs) = metadata;
} }
} }
#else #else
@ -200,7 +194,7 @@ ice_rxd_to_pkt_fields_by_comms_aux_v2(struct ice_rx_queue *rxq,
if (metadata) { if (metadata) {
mb->ol_flags |= rxq->xtr_ol_flag; mb->ol_flags |= rxq->xtr_ol_flag;
*RTE_NET_ICE_DYNF_PROTO_XTR_METADATA(mb) = metadata; *ICE_DYNF_PROTO_XTR_METADATA(mb, rxq->xtr_field_offs) = metadata;
} }
} }
#else #else
@ -226,29 +220,12 @@ ice_select_rxd_to_pkt_fields_handler(struct ice_rx_queue *rxq, uint32_t rxdid)
switch (rxdid) { switch (rxdid) {
case ICE_RXDID_COMMS_AUX_VLAN: case ICE_RXDID_COMMS_AUX_VLAN:
rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_vlan_mask;
break;
case ICE_RXDID_COMMS_AUX_IPV4: case ICE_RXDID_COMMS_AUX_IPV4:
rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv4_mask;
break;
case ICE_RXDID_COMMS_AUX_IPV6: case ICE_RXDID_COMMS_AUX_IPV6:
rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv6_mask;
break;
case ICE_RXDID_COMMS_AUX_IPV6_FLOW: case ICE_RXDID_COMMS_AUX_IPV6_FLOW:
rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask;
break;
case ICE_RXDID_COMMS_AUX_TCP: case ICE_RXDID_COMMS_AUX_TCP:
rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_tcp_mask;
break;
case ICE_RXDID_COMMS_AUX_IP_OFFSET: case ICE_RXDID_COMMS_AUX_IP_OFFSET:
rxq->xtr_ol_flag = rte_net_ice_dynflag_proto_xtr_ip_offset_mask;
break; break;
case ICE_RXDID_COMMS_GENERIC: case ICE_RXDID_COMMS_GENERIC:
/* fallthrough */ /* fallthrough */
case ICE_RXDID_COMMS_OVS: case ICE_RXDID_COMMS_OVS:
@ -260,7 +237,7 @@ ice_select_rxd_to_pkt_fields_handler(struct ice_rx_queue *rxq, uint32_t rxdid)
break; break;
} }
if (!rte_net_ice_dynf_proto_xtr_metadata_avail()) if (rxq->xtr_field_offs == -1)
rxq->xtr_ol_flag = 0; rxq->xtr_ol_flag = 0;
} }
@ -346,7 +323,7 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)
return -EINVAL; return -EINVAL;
} }
ice_select_rxd_to_pkt_fields_handler(rxq, rxdid); rxq->rxdid = rxdid;
/* Enable Flexible Descriptors in the queue context which /* Enable Flexible Descriptors in the queue context which
* allows this driver to select a specific receive descriptor format * allows this driver to select a specific receive descriptor format
@ -1121,6 +1098,10 @@ ice_rx_queue_setup(struct rte_eth_dev *dev,
rxq->rx_deferred_start = rx_conf->rx_deferred_start; rxq->rx_deferred_start = rx_conf->rx_deferred_start;
rxq->proto_xtr = pf->proto_xtr != NULL ? rxq->proto_xtr = pf->proto_xtr != NULL ?
pf->proto_xtr[queue_idx] : PROTO_XTR_NONE; pf->proto_xtr[queue_idx] : PROTO_XTR_NONE;
if (rxq->proto_xtr != PROTO_XTR_NONE &&
ad->devargs.xtr_flag_offs[rxq->proto_xtr] != 0xff)
rxq->xtr_ol_flag = 1ULL << ad->devargs.xtr_flag_offs[rxq->proto_xtr];
rxq->xtr_field_offs = ad->devargs.xtr_field_offs;
/* Allocate the maximum number of RX ring hardware descriptor. */ /* Allocate the maximum number of RX ring hardware descriptor. */
len = ICE_MAX_RING_DESC; len = ICE_MAX_RING_DESC;

View File

@ -88,6 +88,7 @@ struct ice_rx_queue {
bool q_set; /* indicate if rx queue has been configured */ bool q_set; /* indicate if rx queue has been configured */
bool rx_deferred_start; /* don't start this queue in dev start */ bool rx_deferred_start; /* don't start this queue in dev start */
uint8_t proto_xtr; /* Protocol extraction from flexible descriptor */ uint8_t proto_xtr; /* Protocol extraction from flexible descriptor */
int xtr_field_offs; /*Protocol extraction matedata offset*/
uint64_t xtr_ol_flag; /* Protocol extraction offload flag */ uint64_t xtr_ol_flag; /* Protocol extraction offload flag */
uint32_t rxdid; /* Receive Flex Descriptor profile ID */ uint32_t rxdid; /* Receive Flex Descriptor profile ID */
ice_rx_release_mbufs_t rx_rel_mbufs; ice_rx_release_mbufs_t rx_rel_mbufs;

View File

@ -4,12 +4,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <rte_pmd_ice.h>
#include <cmdline_parse_num.h> #include <cmdline_parse_num.h>
#include <cmdline_parse_string.h> #include <cmdline_parse_string.h>
#include "testpmd.h" #include "testpmd.h"
#include "ice_ethdev.h"
/* Fixed size for ICE ddp runtime configure */ /* Fixed size for ICE ddp runtime configure */
#define ICE_BUFF_SIZE 0x000c9000 #define ICE_BUFF_SIZE 0x000c9000

View File

@ -78,5 +78,3 @@ sources += files(
'ice_dcf_parent.c', 'ice_dcf_parent.c',
'ice_dcf_sched.c', 'ice_dcf_sched.c',
) )
headers = files('rte_pmd_ice.h')

View File

@ -1,247 +0,0 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2019 Intel Corporation
*/
#ifndef _RTE_PMD_ICE_H_
#define _RTE_PMD_ICE_H_
/**
* @file rte_pmd_ice.h
*
* ice PMD specific functions.
*
* @b EXPERIMENTAL: this API may change, or be removed, without prior notice
*
*/
#include <stdio.h>
#include <rte_mbuf.h>
#include <rte_mbuf_dyn.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* The supported network protocol extraction metadata format.
*/
union rte_net_ice_proto_xtr_metadata {
uint32_t metadata;
struct {
uint16_t data0;
uint16_t data1;
} raw;
struct {
uint16_t stag_vid:12,
stag_dei:1,
stag_pcp:3;
uint16_t ctag_vid:12,
ctag_dei:1,
ctag_pcp:3;
} vlan;
struct {
uint16_t protocol:8,
ttl:8;
uint16_t tos:8,
ihl:4,
version:4;
} ipv4;
struct {
uint16_t hoplimit:8,
nexthdr:8;
uint16_t flowhi4:4,
tc:8,
version:4;
} ipv6;
struct {
uint16_t flowlo16;
uint16_t flowhi4:4,
tc:8,
version:4;
} ipv6_flow;
struct {
uint16_t fin:1,
syn:1,
rst:1,
psh:1,
ack:1,
urg:1,
ece:1,
cwr:1,
res1:4,
doff:4;
uint16_t rsvd;
} tcp;
uint32_t ip_ofs;
};
/* Offset of mbuf dynamic field for protocol extraction data */
extern int rte_net_ice_dynfield_proto_xtr_metadata_offs;
/* Mask of mbuf dynamic flags for protocol extraction type */
extern uint64_t rte_net_ice_dynflag_proto_xtr_vlan_mask;
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.
*/
#define RTE_NET_ICE_DYNF_PROTO_XTR_METADATA(m) \
RTE_MBUF_DYNFIELD((m), \
rte_net_ice_dynfield_proto_xtr_metadata_offs, \
uint32_t *)
/**
* The mbuf dynamic flag for VLAN protocol extraction metadata, it is valid
* when dev_args 'proto_xtr' has 'vlan' specified.
*/
#define RTE_PKT_RX_DYNF_PROTO_XTR_VLAN \
(rte_net_ice_dynflag_proto_xtr_vlan_mask)
/**
* The mbuf dynamic flag for IPv4 protocol extraction metadata, it is valid
* when dev_args 'proto_xtr' has 'ipv4' specified.
*/
#define RTE_PKT_RX_DYNF_PROTO_XTR_IPV4 \
(rte_net_ice_dynflag_proto_xtr_ipv4_mask)
/**
* The mbuf dynamic flag for IPv6 protocol extraction metadata, it is valid
* when dev_args 'proto_xtr' has 'ipv6' specified.
*/
#define RTE_PKT_RX_DYNF_PROTO_XTR_IPV6 \
(rte_net_ice_dynflag_proto_xtr_ipv6_mask)
/**
* The mbuf dynamic flag for IPv6 with flow protocol extraction metadata, it is
* valid when dev_args 'proto_xtr' has 'ipv6_flow' specified.
*/
#define RTE_PKT_RX_DYNF_PROTO_XTR_IPV6_FLOW \
(rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask)
/**
* The mbuf dynamic flag for TCP protocol extraction metadata, it is valid
* when dev_args 'proto_xtr' has 'tcp' specified.
*/
#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.
*
* @return
* True if registered, false otherwise.
*/
__rte_experimental
static __rte_always_inline int
rte_net_ice_dynf_proto_xtr_metadata_avail(void)
{
return rte_net_ice_dynfield_proto_xtr_metadata_offs != -1;
}
/**
* Get the mbuf dynamic field for protocol extraction metadata.
*
* @param m
* The pointer to the mbuf.
* @return
* The saved protocol extraction metadata.
*/
__rte_experimental
static __rte_always_inline uint32_t
rte_net_ice_dynf_proto_xtr_metadata_get(struct rte_mbuf *m)
{
return *RTE_NET_ICE_DYNF_PROTO_XTR_METADATA(m);
}
/**
* Dump the mbuf dynamic field for protocol extraction metadata.
*
* @param m
* The pointer to the mbuf.
*/
__rte_experimental
static inline void
rte_net_ice_dump_proto_xtr_metadata(struct rte_mbuf *m)
{
union rte_net_ice_proto_xtr_metadata data;
if (!rte_net_ice_dynf_proto_xtr_metadata_avail())
return;
data.metadata = rte_net_ice_dynf_proto_xtr_metadata_get(m);
if (m->ol_flags & RTE_PKT_RX_DYNF_PROTO_XTR_VLAN)
printf(" - Protocol Extraction:[0x%04x:0x%04x],vlan,stag=%u:%u:%u,ctag=%u:%u:%u",
data.raw.data0, data.raw.data1,
data.vlan.stag_pcp,
data.vlan.stag_dei,
data.vlan.stag_vid,
data.vlan.ctag_pcp,
data.vlan.ctag_dei,
data.vlan.ctag_vid);
else if (m->ol_flags & RTE_PKT_RX_DYNF_PROTO_XTR_IPV4)
printf(" - Protocol Extraction:[0x%04x:0x%04x],ipv4,ver=%u,hdrlen=%u,tos=%u,ttl=%u,proto=%u",
data.raw.data0, data.raw.data1,
data.ipv4.version,
data.ipv4.ihl,
data.ipv4.tos,
data.ipv4.ttl,
data.ipv4.protocol);
else if (m->ol_flags & RTE_PKT_RX_DYNF_PROTO_XTR_IPV6)
printf(" - Protocol Extraction:[0x%04x:0x%04x],ipv6,ver=%u,tc=%u,flow_hi4=0x%x,nexthdr=%u,hoplimit=%u",
data.raw.data0, data.raw.data1,
data.ipv6.version,
data.ipv6.tc,
data.ipv6.flowhi4,
data.ipv6.nexthdr,
data.ipv6.hoplimit);
else if (m->ol_flags & RTE_PKT_RX_DYNF_PROTO_XTR_IPV6_FLOW)
printf(" - Protocol Extraction:[0x%04x:0x%04x],ipv6_flow,ver=%u,tc=%u,flow=0x%x%04x",
data.raw.data0, data.raw.data1,
data.ipv6_flow.version,
data.ipv6_flow.tc,
data.ipv6_flow.flowhi4,
data.ipv6_flow.flowlo16);
else if (m->ol_flags & RTE_PKT_RX_DYNF_PROTO_XTR_TCP)
printf(" - Protocol Extraction:[0x%04x:0x%04x],tcp,doff=%u,flags=%s%s%s%s%s%s%s%s",
data.raw.data0, data.raw.data1,
data.tcp.doff,
data.tcp.cwr ? "C" : "",
data.tcp.ece ? "E" : "",
data.tcp.urg ? "U" : "",
data.tcp.ack ? "A" : "",
data.tcp.psh ? "P" : "",
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);
}
__rte_experimental
int rte_pmd_ice_dump_package(uint16_t port, uint8_t **buff, uint32_t *size);
#ifdef __cplusplus
}
#endif
#endif /* _RTE_PMD_ICE_H_ */

View File

@ -6,12 +6,5 @@ EXPERIMENTAL {
global: global:
# added in 19.11 # added in 19.11
rte_net_ice_dynfield_proto_xtr_metadata_offs;
rte_net_ice_dynflag_proto_xtr_vlan_mask;
rte_net_ice_dynflag_proto_xtr_ipv4_mask;
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;
rte_pmd_ice_dump_package; rte_pmd_ice_dump_package;
}; };