[dpdk-dev] [PATCH 11/18] net/ixgbe: parse n-tuple filter
From: wei zhao1Add rule validate function and check if the rule is a n-tuple rule, and get the n-tuple info. Signed-off-by: wei zhao1 Signed-off-by: Wenzhuo Lu --- drivers/net/ixgbe/ixgbe_ethdev.c | 349 +++ 1 file changed, 349 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index f84ca17..d3768c6 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -61,6 +61,8 @@ #include #include #include +#include +#include #include "ixgbe_logs.h" #include "base/ixgbe_api.h" @@ -393,6 +395,26 @@ static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, static int ixgbe_filter_restore(struct rte_eth_dev *dev); static void ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev); int ixgbe_flush_all_filter(struct rte_eth_dev *dev); +static enum +rte_flow_error_type cons_parse_ntuple_filter(const struct rte_flow_attr *attr, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[], + struct rte_eth_ntuple_filter *filter); +static enum +rte_flow_error_type ixgbe_parse_ntuple_filter(const struct rte_flow_attr *attr, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[], + struct rte_eth_ntuple_filter *filter); +enum rte_flow_error_type +ixgbe_flow_rule_validate(__rte_unused struct rte_eth_dev *dev, + const struct rte_flow_attr *attr, + const struct rte_flow_item pattern[], + const struct rte_flow_action actions[]); +int ixgbe_flow_validate(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); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -778,6 +800,14 @@ static const struct rte_ixgbe_xstats_name_off rte_ixgbevf_stats_strings[] = { #define IXGBEVF_NB_XSTATS (sizeof(rte_ixgbevf_stats_strings) / \ sizeof(rte_ixgbevf_stats_strings[0])) +static const struct rte_flow_ops ixgbe_flow_ops = { + ixgbe_flow_validate, + NULL, + NULL, + NULL, + NULL, +}; + /** * Atomically reads the link status information from global * structure rte_eth_dev. @@ -6311,6 +6341,11 @@ ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev, case RTE_ETH_FILTER_L2_TUNNEL: ret = ixgbe_dev_l2_tunnel_filter_handle(dev, filter_op, arg); break; + case RTE_ETH_FILTER_GENERIC: + if (filter_op != RTE_ETH_FILTER_GET) + return -EINVAL; + *(const void **)arg = _flow_ops; + break; default: PMD_DRV_LOG(WARNING, "Filter type (%d) not supported", filter_type); @@ -7995,6 +8030,320 @@ ixgbe_flush_all_filter(struct rte_eth_dev *dev) return 0; } +static inline uint32_t +rte_be_to_cpu_24(uint32_t x) +{ + return ((x & 0x00ffUL) << 16) | + (x & 0xff00UL) | + ((x & 0x00ffUL) >> 16); +} +#define IXGBE_MIN_N_TUPLE_PRIO 1 +#define IXGBE_MAX_N_TUPLE_PRIO 7 +#define PATTERN_SKIP_VOID(filter, filter_struct, ret)\ + do {\ + if (!pattern) {\ + memset(filter, 0, sizeof(filter_struct));\ + return ret;\ + } \ + item = pattern + i;\ + while (item->type == RTE_FLOW_ITEM_TYPE_VOID) {\ + i++;\ + item = pattern + i;\ + } \ + } while (0) + +#define ACTION_SKIP_VOID(filter, filter_struct, ret)\ + do {\ + if (!actions) {\ + memset(filter, 0, sizeof(filter_struct));\ + return ret;\ + } \ + act = actions + i;\ + while (act->type == RTE_FLOW_ACTION_TYPE_VOID) {\ + i++;\ + act = actions + i;\ + } \ + } while (0) + +/** + * Please aware there's an asumption for all the parsers. + * rte_flow_item is using big endian, rte_flow_attr and + * rte_flow_action are using CPU order. + * Because the pattern is used to describe the packets, + * normally the packets should use network order. + */ + +/** + * Parse the rule to see if it is
[dpdk-dev] [PATCH 00/18] net/ixgbe: Consistent filter API
From: wei zhao1The patches mainly finish following functions: 1) Store and restore all kinds of filters. 2) Parse all kinds of filters. 3) Add flow validate function. 4) Add flow create function. 5) Add flow destroy function. 6) Add flow flush function. wei zhao1 (18): net/ixgbe: store SYN filter net/ixgbe: store flow director filter net/ixgbe: store L2 tunnel filter net/ixgbe: restore n-tuple filter net/ixgbe: restore ether type filter net/ixgbe: restore SYN filter net/ixgbe: restore flow director filter net/ixgbe: restore L2 tunnel filter net/ixgbe: store and restore L2 tunnel configuration net/ixgbe: flush all the filters net/ixgbe: parse n-tuple filter net/ixgbe: parse ethertype filter net/ixgbe: parse SYN filter net/ixgbe: parse L2 tunnel filter net/ixgbe: parse flow director filter net/ixgbe: create consistent filter net/ixgbe: destroy consistent filter net/ixgbe: flush consistent filter drivers/net/ixgbe/ixgbe_ethdev.c | 2570 -- drivers/net/ixgbe/ixgbe_ethdev.h | 173 ++- drivers/net/ixgbe/ixgbe_fdir.c | 403 -- drivers/net/ixgbe/ixgbe_pf.c | 26 +- 4 files changed, 2982 insertions(+), 190 deletions(-) -- 2.5.5
[dpdk-dev] [PATCH v2] mempool: remove a redundant socket_id assignment
From: zhao weiThere is a redundant repetition mempool socket_id assignment in the file rte_mempool.c in function rte_mempool_create_empty.The statement "mp->socket_id = socket_id;"appear twice in line 821 and 824.One of them is redundant, so delete it. Fixes: 85226f9c526b ("mempool:introduce a function to create an empty pool") Signed-off-by: zhao wei Acked-by: John McNamara Acked-by: Olivier Matz --- lib/librte_mempool/rte_mempool.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index aa513b9..1c2aed8 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -818,7 +818,6 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size, goto exit_unlock; } mp->mz = mz; - mp->socket_id = socket_id; mp->size = n; mp->flags = flags; mp->socket_id = socket_id; -- 2.5.5
[dpdk-dev] [PATCH v2] mempool: remove a redundant word "for" in comment
From: zhao weiThere is a redundant repetition word "for" in commnet line of the file rte_mempool.h after the definition of RTE_MEMPOOL_OPS_NAMESIZE. The word "for"appear twice in line 359 and 360.One of them is redundant, so delete it. Fixes: 449c49b93a6b (" mempool: support handler operations") Signed-off-by: zhao wei Acked-by: John McNamara --- lib/librte_mempool/rte_mempool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 440f3b1..911102b 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -357,7 +357,7 @@ void rte_mempool_check_cookies(const struct rte_mempool *mp, * Prototype for implementation specific data provisioning function. * * The function should provide the implementation specific memory for - * for use by the other mempool ops functions in a given mempool ops struct. + * use by the other mempool ops functions in a given mempool ops struct. * E.g. the default ops provides an instance of the rte_ring for this purpose. * it will most likely point to a different type of data structure, and * will be transparent to the application programmer. -- 2.5.5
[dpdk-dev] [PATCH] lib/librte_mempool: a redundant word in comment
From: zhao weiThere is a redundant repetition word "for" in commnet line the file rte_mempool.h after the definition of RTE_MEMPOOL_OPS_NAMESIZE. The word "for"appear twice in line 359 and 360.One of them is redundant, so delete it. Fixes: 449c49b93a6b ("lib/librte_mempool: mempool: support handler operations") Signed-off-by: zhao wei --- lib/librte_mempool/rte_mempool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 440f3b1..911102b 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -357,7 +357,7 @@ void rte_mempool_check_cookies(const struct rte_mempool *mp, * Prototype for implementation specific data provisioning function. * * The function should provide the implementation specific memory for - * for use by the other mempool ops functions in a given mempool ops struct. + * use by the other mempool ops functions in a given mempool ops struct. * E.g. the default ops provides an instance of the rte_ring for this purpose. * it will most likely point to a different type of data structure, and * will be transparent to the application programmer. -- 2.5.5
[dpdk-dev] [PATCH] lib/librte_mempool: a redundant of socket_id assignment
From: zhao weiThere is a redundant repetition mempool socket_id assignment in the file rte_mempool.c in function rte_mempool_create_empty.The statement "mp->socket_id = socket_id;"appear twice in line 821 and 824.One of them is redundant, so delete it. Fixes: 85226f9c526b ("lib/librte_mempool: mempool:introduce a function to create an empty pool") Signed-off-by: zhao wei --- lib/librte_mempool/rte_mempool.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index aa513b9..1c2aed8 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -818,7 +818,6 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size, goto exit_unlock; } mp->mz = mz; - mp->socket_id = socket_id; mp->size = n; mp->flags = flags; mp->socket_id = socket_id; -- 2.5.5
[dpdk-dev] [PATCH] net/ixgbe: fix link never come up problem with x552
From: zhao weiThe links never coming up with DPDK16.11 when bring up x552 NIC, device id is 15ac.This is caused by delete some code which casing removes X550em SFP iXFI setup for the drivers in function ixgbe_setup_mac_link_sfp_x550em().Fix methord is recover the deleted code. Fixes: 1726b9cd9c40 ("net/ixgbe/base: remove X550em SFP iXFI setup") Signed-off-by: zhao wei --- drivers/net/ixgbe/base/ixgbe_x550.c | 57 ++--- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c index 87d4302..acb8140 100644 --- a/drivers/net/ixgbe/base/ixgbe_x550.c +++ b/drivers/net/ixgbe/base/ixgbe_x550.c @@ -2762,18 +2762,53 @@ s32 ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw, if (ret_val != IXGBE_SUCCESS) return ret_val; - /* Configure internal PHY for KR/KX. */ - ixgbe_setup_kr_speed_x550em(hw, speed); - - /* Configure CS4227 LINE side to proper mode. */ - reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB + - (hw->bus.lan_id << 12); - if (setup_linear) - reg_val = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1; - else + if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) { + /* Configure CS4227 LINE side to 10G SR. */ + reg_slice = IXGBE_CS4227_LINE_SPARE22_MSB + + (hw->bus.lan_id << 12); + reg_val = IXGBE_CS4227_SPEED_10G; + ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, + reg_val); + + reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB + + (hw->bus.lan_id << 12); reg_val = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1; - ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, - reg_val); + ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, + reg_val); + + /* Configure CS4227 for HOST connection rate then type. */ + reg_slice = IXGBE_CS4227_HOST_SPARE22_MSB + + (hw->bus.lan_id << 12); + reg_val = (speed & IXGBE_LINK_SPEED_10GB_FULL) ? + IXGBE_CS4227_SPEED_10G : IXGBE_CS4227_SPEED_1G; + ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, + reg_val); + + reg_slice = IXGBE_CS4227_HOST_SPARE24_LSB + + (hw->bus.lan_id << 12); + if (setup_linear) + reg_val = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1; + else + reg_val = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1; + ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, + reg_val); + + /* Setup XFI internal link. */ + ret_val = ixgbe_setup_ixfi_x550em(hw, ); + } else { + /* Configure internal PHY for KR/KX. */ + ixgbe_setup_kr_speed_x550em(hw, speed); + + /* Configure CS4227 LINE side to proper mode. */ + reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB + + (hw->bus.lan_id << 12); + if (setup_linear) + reg_val = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1; + else + reg_val = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1; + ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, + reg_val); + } return ret_val; } -- 2.5.5
[dpdk-dev] [PATCH] net/ixgbe: fix link never come up problem with x552
From: zhao weiThe links never coming up with DPDK16.11 when bring up x552 NIC, device id is 15ac.This is caused by delete some code which casing removes X550em SFP iXFI setup for the drivers in function ixgbe_setup_mac_link_sfp_x550em().Fix methord is recover the deleted code. Fixes: 1726b9cd9c40 ("net/ixgbe/base: remove X550em SFP iXFI setup") Signed-off-by: zhao wei --- drivers/net/ixgbe/base/ixgbe_x550.c | 57 ++--- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c index 87d4302..acb8140 100644 --- a/drivers/net/ixgbe/base/ixgbe_x550.c +++ b/drivers/net/ixgbe/base/ixgbe_x550.c @@ -2762,18 +2762,53 @@ s32 ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw, if (ret_val != IXGBE_SUCCESS) return ret_val; - /* Configure internal PHY for KR/KX. */ - ixgbe_setup_kr_speed_x550em(hw, speed); - - /* Configure CS4227 LINE side to proper mode. */ - reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB + - (hw->bus.lan_id << 12); - if (setup_linear) - reg_val = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1; - else + if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) { + /* Configure CS4227 LINE side to 10G SR. */ + reg_slice = IXGBE_CS4227_LINE_SPARE22_MSB + + (hw->bus.lan_id << 12); + reg_val = IXGBE_CS4227_SPEED_10G; + ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, + reg_val); + + reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB + + (hw->bus.lan_id << 12); reg_val = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1; - ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, - reg_val); + ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, + reg_val); + + /* Configure CS4227 for HOST connection rate then type. */ + reg_slice = IXGBE_CS4227_HOST_SPARE22_MSB + + (hw->bus.lan_id << 12); + reg_val = (speed & IXGBE_LINK_SPEED_10GB_FULL) ? + IXGBE_CS4227_SPEED_10G : IXGBE_CS4227_SPEED_1G; + ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, + reg_val); + + reg_slice = IXGBE_CS4227_HOST_SPARE24_LSB + + (hw->bus.lan_id << 12); + if (setup_linear) + reg_val = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1; + else + reg_val = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1; + ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, + reg_val); + + /* Setup XFI internal link. */ + ret_val = ixgbe_setup_ixfi_x550em(hw, ); + } else { + /* Configure internal PHY for KR/KX. */ + ixgbe_setup_kr_speed_x550em(hw, speed); + + /* Configure CS4227 LINE side to proper mode. */ + reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB + + (hw->bus.lan_id << 12); + if (setup_linear) + reg_val = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1; + else + reg_val = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1; + ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice, + reg_val); + } return ret_val; } -- 2.5.5