Skip to content

Commit

Permalink
net/i40e: add flow validate function
Browse files Browse the repository at this point in the history
This patch adds i40e_flow_validation function to check if
a flow is valid according to the flow pattern.
i40e_flow_parse_ethertype_filter is added first, it also
gets the ethertype info.
i40e_flow.c is added to handle all generic filter events.

Signed-off-by: Beilei Xing <[email protected]>
Acked-by: Jingjing Wu <[email protected]>
  • Loading branch information
beileix authored and Ferruh Yigit committed Jan 17, 2017
1 parent 38e9fa6 commit 86eb05d
Show file tree
Hide file tree
Showing 4 changed files with 523 additions and 5 deletions.
1 change: 1 addition & 0 deletions drivers/net/i40e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ endif
SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_ethdev_vf.c
SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_pf.c
SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_fdir.c
SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_flow.c

# vector PMD driver needs SSE4.1 support
ifeq ($(findstring RTE_MACHINE_CPUFLAG_SSE4_1,$(CFLAGS)),)
Expand Down
10 changes: 5 additions & 5 deletions drivers/net/i40e/i40e_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,6 @@
#define I40E_INSET_IPV6_HOP_LIMIT_MASK 0x000CFF00UL
#define I40E_INSET_IPV6_NEXT_HDR_MASK 0x000C00FFUL

#define I40E_GL_SWT_L2TAGCTRL(_i) (0x001C0A70 + ((_i) * 4))
#define I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_SHIFT 16
#define I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_MASK \
I40E_MASK(0xFFFF, I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_SHIFT)

/* PCI offset for querying capability */
#define PCI_DEV_CAP_REG 0xA4
/* PCI offset for enabling/disabling Extended Tag */
Expand Down Expand Up @@ -8573,6 +8568,11 @@ i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
case RTE_ETH_FILTER_FDIR:
ret = i40e_fdir_ctrl_func(dev, filter_op, arg);
break;
case RTE_ETH_FILTER_GENERIC:
if (filter_op != RTE_ETH_FILTER_GET)
return -EINVAL;
*(const void **)arg = &i40e_flow_ops;
break;
default:
PMD_DRV_LOG(WARNING, "Filter type (%d) not supported",
filter_type);
Expand Down
25 changes: 25 additions & 0 deletions drivers/net/i40e/i40e_ethdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <rte_time.h>
#include <rte_kvargs.h>
#include <rte_hash.h>
#include <rte_flow_driver.h>

#define I40E_VLAN_TAG_SIZE 4

Expand Down Expand Up @@ -189,6 +190,11 @@ enum i40e_flxpld_layer_idx {
#define FLOATING_VEB_SUPPORTED_FW_MAJ 5
#define FLOATING_VEB_SUPPORTED_FW_MIN 0

#define I40E_GL_SWT_L2TAGCTRL(_i) (0x001C0A70 + ((_i) * 4))
#define I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_SHIFT 16
#define I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_MASK \
I40E_MASK(0xFFFF, I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_SHIFT)

struct i40e_adapter;

/**
Expand Down Expand Up @@ -629,6 +635,25 @@ struct i40e_adapter {
struct rte_timecounter tx_tstamp_tc;
};

extern const struct rte_flow_ops i40e_flow_ops;

union i40e_filter_t {
struct rte_eth_ethertype_filter ethertype_filter;
struct rte_eth_fdir_filter fdir_filter;
struct rte_eth_tunnel_filter_conf tunnel_filter;
};

typedef int (*parse_filter_t)(struct rte_eth_dev *dev,
const struct rte_flow_attr *attr,
const struct rte_flow_item pattern[],
const struct rte_flow_action actions[],
struct rte_flow_error *error,
union i40e_filter_t *filter);
struct i40e_valid_pattern {
enum rte_flow_item_type *items;
parse_filter_t parse_filter;
};

int i40e_dev_switch_queues(struct i40e_pf *pf, bool on);
int i40e_vsi_release(struct i40e_vsi *vsi);
struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf,
Expand Down
Loading

0 comments on commit 86eb05d

Please sign in to comment.