Skip to content

Commit

Permalink
net/i40e: support flexible payload parsing for FDIR
Browse files Browse the repository at this point in the history
This patch adds flexible payload parsing support for
flow director filter.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
  • Loading branch information
beileix authored and Ferruh Yigit committed Jun 12, 2017
1 parent 30965ca commit 6ced3dd
Show file tree
Hide file tree
Showing 3 changed files with 331 additions and 23 deletions.
23 changes: 23 additions & 0 deletions drivers/net/i40e/i40e_ethdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,24 @@ struct i40e_vmdq_info {
struct i40e_vsi *vsi;
};

#define I40E_FDIR_MAX_FLEXLEN 16 /**< Max length of flexbytes. */
#define I40E_MAX_FLX_SOURCE_OFF 480
#define NONUSE_FLX_PIT_DEST_OFF 63
#define NONUSE_FLX_PIT_FSIZE 1
#define I40E_FLX_OFFSET_IN_FIELD_VECTOR 50
#define MK_FLX_PIT(src_offset, fsize, dst_offset) ( \
(((src_offset) << I40E_PRTQF_FLX_PIT_SOURCE_OFF_SHIFT) & \
I40E_PRTQF_FLX_PIT_SOURCE_OFF_MASK) | \
(((fsize) << I40E_PRTQF_FLX_PIT_FSIZE_SHIFT) & \
I40E_PRTQF_FLX_PIT_FSIZE_MASK) | \
((((dst_offset) == NONUSE_FLX_PIT_DEST_OFF ? \
NONUSE_FLX_PIT_DEST_OFF : \
((dst_offset) + I40E_FLX_OFFSET_IN_FIELD_VECTOR)) << \
I40E_PRTQF_FLX_PIT_DEST_OFF_SHIFT) & \
I40E_PRTQF_FLX_PIT_DEST_OFF_MASK))
#define I40E_WORD(hi, lo) (uint16_t)((((hi) << 8) & 0xFF00) | ((lo) & 0xFF))
#define I40E_FLEX_WORD_MASK(off) (0x80 >> (off))

/*
* Structure to store flex pit for flow diretor.
*/
Expand All @@ -442,6 +460,7 @@ struct i40e_fdir_flex_pit {

struct i40e_fdir_flex_mask {
uint8_t word_mask; /**< Bit i enables word i of flexible payload */
uint8_t nb_bitmask;
struct {
uint8_t offset;
uint16_t mask;
Expand Down Expand Up @@ -479,6 +498,10 @@ struct i40e_fdir_info {
struct i40e_fdir_filter_list fdir_list;
struct i40e_fdir_filter **hash_map;
struct rte_hash *hash_table;

/* Mark if flex pit and mask is set */
bool flex_pit_flag[I40E_MAX_FLXPLD_LAYER];
bool flex_mask_flag[I40E_FILTER_PCTYPE_MAX];
};

/* Ethertype filter number HW supports */
Expand Down
19 changes: 0 additions & 19 deletions drivers/net/i40e/i40e_fdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,6 @@
#define I40E_COUNTER_PF 2
/* Statistic counter index for one pf */
#define I40E_COUNTER_INDEX_FDIR(pf_id) (0 + (pf_id) * I40E_COUNTER_PF)
#define I40E_MAX_FLX_SOURCE_OFF 480
#define I40E_FLX_OFFSET_IN_FIELD_VECTOR 50

#define NONUSE_FLX_PIT_DEST_OFF 63
#define NONUSE_FLX_PIT_FSIZE 1
#define MK_FLX_PIT(src_offset, fsize, dst_offset) ( \
(((src_offset) << I40E_PRTQF_FLX_PIT_SOURCE_OFF_SHIFT) & \
I40E_PRTQF_FLX_PIT_SOURCE_OFF_MASK) | \
(((fsize) << I40E_PRTQF_FLX_PIT_FSIZE_SHIFT) & \
I40E_PRTQF_FLX_PIT_FSIZE_MASK) | \
((((dst_offset) == NONUSE_FLX_PIT_DEST_OFF ? \
NONUSE_FLX_PIT_DEST_OFF : \
((dst_offset) + I40E_FLX_OFFSET_IN_FIELD_VECTOR)) << \
I40E_PRTQF_FLX_PIT_DEST_OFF_SHIFT) & \
I40E_PRTQF_FLX_PIT_DEST_OFF_MASK))

#define I40E_FDIR_FLOWS ( \
(1 << RTE_ETH_FLOW_FRAG_IPV4) | \
Expand All @@ -112,8 +97,6 @@
(1 << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER) | \
(1 << RTE_ETH_FLOW_L2_PAYLOAD))

#define I40E_FLEX_WORD_MASK(off) (0x80 >> (off))

static int i40e_fdir_filter_programming(struct i40e_pf *pf,
enum i40e_filter_pctype pctype,
const struct rte_eth_fdir_filter *filter,
Expand Down Expand Up @@ -381,8 +364,6 @@ i40e_init_flx_pld(struct i40e_pf *pf)
}
}

#define I40E_WORD(hi, lo) (uint16_t)((((hi) << 8) & 0xFF00) | ((lo) & 0xFF))

#define I40E_VALIDATE_FLEX_PIT(flex_pit1, flex_pit2) do { \
if ((flex_pit2).src_offset < \
(flex_pit1).src_offset + (flex_pit1).size) { \
Expand Down

0 comments on commit 6ced3dd

Please sign in to comment.