MPSL enabling
PATCH 1/6 net/i40e: fix a typo in flow
In reply to Beilei XingFrom: Rami Rosen <[email protected]>
This patch fixes a trivial typo in i40e_flow.c.
--- drivers/net/i40e/i40e_flow.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_flow.c +3 -3
@@ -1309,7 +1309,7 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern,case RTE_FLOW_ITEM_TYPE_IPV4 : filter->ip_type =RTE_TUNNEL_IPTYPE_IPV4 ;/* IPv4 is used to describe protocol, -* spec amd mask should be NULL. +* spec and mask should be NULL. */ if (item->spec || item->mask) { rte_flow_error_set(error, EINVAL,
@@ -1322,7 +1322,7 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern,case RTE_FLOW_ITEM_TYPE_IPV6 : filter->ip_type =RTE_TUNNEL_IPTYPE_IPV6 ;/* IPv6 is used to describe protocol, -* spec amd mask should be NULL. +* spec and mask should be NULL. */ if (item->spec || item->mask) { rte_flow_error_set(error, EINVAL,
@@ -1334,7 +1334,7 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern,break ;case RTE_FLOW_ITEM_TYPE_UDP :/* UDP is used to describe protocol, -* spec amd mask should be NULL. +* spec and mask should be NULL. */ if (item->spec || item->mask) { rte_flow_error_set(error, EINVAL,
Signature · 1 line
2.5.5
PATCH 1/1 MPSL enabling
--- app/test-pmd/cmdline_flow.c | 23 ++++ app/test-pmd/config.c | 1 + drivers/net/i40e/i40e_flow.c | 245 +++++++++++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_flow.h | 42 ++++++++ 4 files changed, 311 insertions(+)
app/test-pmd/cmdline_flow.c +23 -0
@@ -159,6 +159,8 @@ enum index {ITEM_SCTP_CKSUM ,ITEM_VXLAN ,ITEM_VXLAN_VNI , +ITEM_MPLS , +ITEM_MPLS_LABEL ,/* Validate/create actions. */ ACTIONS,
@@ -432,6 +434,7 @@ static const enum index next_item[] = {ITEM_TCP ,ITEM_SCTP ,ITEM_VXLAN , +ITEM_MPLS , ZERO, };
@@ -538,6 +541,12 @@ static const enum index item_vxlan[] = { ZERO, }; +static const enum index item_mpls[] = { +ITEM_MPLS_LABEL , +ITEM_NEXT , +ZERO , +}; +static const enum index next_action[] = {ACTION_END ,ACTION_VOID ,
@@ -1279,6 +1288,20 @@ static const struct token token_list[] = { .next = NEXT(item_vxlan, NEXT_ENTRY(UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, vni)), }, + [ITEM_MPLS] = { + .name = "mpls", + .help = "match MPLS header", + .priv = PRIV_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)), + .next = NEXT(item_mpls), + .call = parse_vc, + }, + [ITEM_MPLS_LABEL] = { + .name = "label", + .help = "MPLS label", + .next = NEXT(item_mpls, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_mpls, + label_tc_s_ttl)), + },/* Validate/create actions. */ [ACTIONS] = { .name = "actions",
app/test-pmd/config.c +1 -0
@@ -963,6 +963,7 @@ static const struct {MK_FLOW_ITEM (TCP ,sizeof (struct rte_flow_item_tcp )),MK_FLOW_ITEM (SCTP ,sizeof (struct rte_flow_item_sctp )),MK_FLOW_ITEM (VXLAN ,sizeof (struct rte_flow_item_vxlan )), + MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)), };/** Compute storage space needed by item specification. */
drivers/net/i40e/i40e_flow.c +245 -0
275 lines not on this page · raw message
lib/librte_ether/rte_flow.h +42 -0
54 lines not on this page · raw message
Signature · 1 line
2.5.5
PATCH 1/2 net/i40e: change tunnel filter function name
Change tunnel filter function name to VXLAN filter function, prepare for NVGRE filter function.
--- drivers/net/i40e/i40e_flow.c | 56 ++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 36 deletions(-)
drivers/net/i40e/i40e_flow.c +20 -36
@@ -90,10 +90,6 @@ static int i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,const struct rte_flow_action *actions, struct rte_flow_error *error, struct rte_eth_fdir_filter *filter); -static int i40e_flow_parse_tunnel_pattern(__rte_unused struct rte_eth_dev *dev, -const struct rte_flow_item *pattern, -struct rte_flow_error *error, -struct rte_eth_tunnel_filter_conf *filter); static int i40e_flow_parse_tunnel_action(struct rte_eth_dev *dev, const struct rte_flow_action *actions, struct rte_flow_error *error,
@@ -112,12 +108,12 @@ static int i40e_flow_parse_fdir_filter(struct rte_eth_dev *dev,const struct rte_flow_action actions[], struct rte_flow_error *error, union i40e_filter_t *filter); -static int i40e_flow_parse_tunnel_filter (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); +static int i40e_flow_parse_vxlan_filter (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);static int i40e_flow_destroy_ethertype_filter (struct i40e_pf *pf,struct i40e_ethertype_filter *filter); static int i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf,
@@ -303,10 +299,10 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = { { pattern_fdir_ipv6_sctp, i40e_flow_parse_fdir_filter }, { pattern_fdir_ipv6_sctp_ext, i40e_flow_parse_fdir_filter },/* tunnel */ - { pattern_vxlan_1, i40e_flow_parse_tunnel_filter }, - { pattern_vxlan_2, i40e_flow_parse_tunnel_filter }, - { pattern_vxlan_3, i40e_flow_parse_tunnel_filter }, - { pattern_vxlan_4, i40e_flow_parse_tunnel_filter }, + { pattern_vxlan_1, i40e_flow_parse_vxlan_filter }, + { pattern_vxlan_2, i40e_flow_parse_vxlan_filter }, + { pattern_vxlan_3, i40e_flow_parse_vxlan_filter }, + { pattern_vxlan_4, i40e_flow_parse_vxlan_filter }, };#define NEXT_ITEM_OF_ACTION (act, actions, index) \
@@ -1205,7 +1201,8 @@ i40e_check_tenant_id_mask(const uint8_t *mask)* filled with 0. */ static int -i40e_flow_parse_vxlan_pattern (const struct rte_flow_item *pattern, +i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev, +const struct rte_flow_item *pattern,struct rte_flow_error *error,struct rte_eth_tunnel_filter_conf *filter) {
@@ -1469,32 +1466,19 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern, }static int -i40e_flow_parse_tunnel_pattern(__rte_unused struct rte_eth_dev *dev, -const struct rte_flow_item *pattern, -struct rte_flow_error *error, -struct rte_eth_tunnel_filter_conf *filter) -{ -int ret; - - ret =i40e_flow_parse_vxlan_pattern (pattern, error, filter); - -return ret; -} - -static int -i40e_flow_parse_tunnel_filter (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) +i40e_flow_parse_vxlan_filter (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 rte_eth_tunnel_filter_conf *tunnel_filter = &filter->tunnel_filter;int ret; - ret =i40e_flow_parse_tunnel_pattern (dev, pattern, - error, tunnel_filter); + ret =i40e_flow_parse_vxlan_pattern (dev, pattern, + error, tunnel_filter);if (ret)return ret;
Signature · 1 line
2.5.5
PATCH 1/1 ppp implemantation
In reply to Beilei Xing--- app/test-pmd/cmdline.c | 57 ++++++++ app/test-pmd/config.c | 62 +++++++++ app/test-pmd/testpmd.h | 3 + drivers/net/i40e/base/i40e_adminq_cmd.h | 32 +++++ drivers/net/i40e/base/i40e_common.c | 236 +++++++++++++++++++++++++++++++- drivers/net/i40e/base/i40e_prototype.h | 17 +++ drivers/net/i40e/base/i40e_type.h | 79 +++++++++++ drivers/net/i40e/i40e_ethdev.c | 68 +++++++++ drivers/net/i40e/rte_pmd_i40e.h | 1 + 9 files changed, 554 insertions(+), 1 deletion(-)
app/test-pmd/cmdline.c +57 -0
@@ -12395,6 +12395,62 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = { }, }; +/* Write Pipeline Personalization Profile */ +struct cmd_write_ppp_result { +cmdline_fixed_string_t write; +cmdline_fixed_string_t ppp; +uint8_t port_id; +char filename[]; +}; + +cmdline_parse_token_string_t cmd_write_ppp_write = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, write, "write"); +cmdline_parse_token_string_t cmd_write_ppp_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, ppp, "ppp"); +cmdline_parse_token_num_t cmd_write_ppp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_write_ppp_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_write_ppp_filename = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, filename, NULL); + +static void +cmd_write_ppp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_write_ppp_result *res = parsed_result; +uint8_t *buff; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + + buff =open_package_file (res->filename); +if (!buff) +return ; + + ret =i40e_process_package (res->port_id, buff); +if (ret <0 ) +printf ("Failed to write profile.\n" ); + +close_package_file (buff); +} + +cmdline_parse_inst_t cmd_write_ppp = { + .f = cmd_write_ppp_parsed, + .data =NULL , + .help_str ="write ppp <port_id> <profile_name>" , + .tokens = { + (void *)&cmd_write_ppp_write, + (void *)&cmd_write_ppp_ppp, + (void *)&cmd_write_ppp_port_id, + (void *)&cmd_write_ppp_filename, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -12570,6 +12626,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, + (cmdline_parse_inst_t *)&cmd_write_ppp, NULL, };
app/test-pmd/config.c +62 -0
65 lines not on this page · raw message
app/test-pmd/testpmd.h +3 -0
@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);void mcast_addr_remove (uint8_t port_id,struct ether_addr *mc_addr);void port_dcb_info_display (uint8_t port_id); +uint8_t *open_package_file (const char *file_path); +int close_package_file (uint8_t *buf); +enum print_warning {ENABLED_WARN =0 ,DISABLED_WARN
drivers/net/i40e/base/i40e_adminq_cmd.h +32 -0
@@ -198,6 +198,10 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_add_mirror_rule =0x0260 , i40e_aqc_opc_delete_mirror_rule =0x0261 , +/* Support Pipeline Personalization Profile */ + i40e_aqc_opc_write_personalization_profile =0x0270 , + i40e_aqc_opc_get_personalization_profile_list =0x0271 , +/* DCB commands */ i40e_aqc_opc_dcb_ignore_pfc =0x0301 , i40e_aqc_opc_dcb_updated = 0x0302,
@@ -1441,6 +1445,34 @@ struct i40e_aqc_add_delete_mirror_rule_completion {I40E_CHECK_CMD_LENGTH (i40e_aqc_add_delete_mirror_rule_completion); +/* Pipeline Personalization Profile */ +struct i40e_aqc_write_ppp { +u8 reserved[4 ]; +__le32 profile_track_id; +__le32 addr_high; +__le32 addr_low; +}; + +I40E_CHECK_CMD_LENGTH (i40e_aqc_write_ppp); + +struct i40e_aqc_write_ppp_resp { +__le32 error_offset; +__le32 error_info; +__le32 addr_high; +__le32 addr_low; +}; + +struct i40e_aqc_get_ppp_list { +u8 flags; +#define I40E_AQC_WR_PPP_GET_CONF 0x1 +#define I40E_AQC_WR_PPP_GET_RDPU_CONF 0x2 +u8 reserved[7 ]; +__le32 addr_high; +__le32 addr_low; +}; + +I40E_CHECK_CMD_LENGTH (i40e_aqc_get_ppp_list); +/* DCB 0x03xx*/ /* PFC Ignore (direct 0x0301)
drivers/net/i40e/base/i40e_common.c +235 -1
240 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +17 -0
@@ -555,4 +555,21 @@ enum i40e_status_code i40e_write_phy_register(struct i40e_hw *hw,u8 i40e_get_phy_address (struct i40e_hw *hw,u8 dev_num);enum i40e_status_code i40e_blink_phy_link_led (struct i40e_hw *hw,u32 time,u32 interval); +enum i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +u16 buff_size,u32 track_id, +u32 *error_offset,u32 *error_info, +struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code i40e_aq_get_ppp_list (struct i40e_hw *hw,void *buff, +u16 buff_size,u8 flags, +struct i40e_asq_cmd_details *cmd_details); +struct i40e_generic_seg_header * +i40e_find_segment_in_package (u32 segment_type, +struct i40e_package_header *pkg_header); +enum i40e_status_code +i40e_write_profile (struct i40e_hw *hw,struct i40e_profile_segment *i40e_seg, +u32 track_id); +enum i40e_status_code +i40e_add_pinfo_to_list (struct i40e_hw *hw, +struct i40e_profile_segment *profile, +u8 *profile_info_sec,u32 track_id);#endif /* _I40E_PROTOTYPE_H_ */
drivers/net/i40e/base/i40e_type.h +79 -0
83 lines not on this page · raw message
drivers/net/i40e/i40e_ethdev.c +68 -0
77 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e.h +1 -0
@@ -332,4 +332,5 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,int rte_pmd_i40e_reset_vf_stats (uint8_t port,uint16_t vf_id); +int i40e_process_package (uint8_t port,uint8_t *buff);#endif /* _PMD_I40E_H_ */
Signature · 1 line
2.5.5
PATCH 2/2 net/i40e: parse NVGRE filter
In reply to Beilei XingThis patch adds i40e_flow_parse_nvgre_filter to check if a rule is a NVGRE rule according to items of the flow pattern, and the function also gets the tunnel info.
--- drivers/net/i40e/i40e_flow.c | 335 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 335 insertions(+)
drivers/net/i40e/i40e_flow.c +335 -0
@@ -114,6 +114,12 @@ static int i40e_flow_parse_vxlan_filter(struct rte_eth_dev *dev,const struct rte_flow_action actions[], struct rte_flow_error *error, union i40e_filter_t *filter); +static int i40e_flow_parse_nvgre_filter (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);static int i40e_flow_destroy_ethertype_filter (struct i40e_pf *pf,struct i40e_ethertype_filter *filter); static int i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf,
@@ -278,6 +284,40 @@ static enum rte_flow_item_type pattern_vxlan_4[] = { RTE_FLOW_ITEM_TYPE_END, }; +static enum rte_flow_item_type pattern_nvgre_1[] = { +RTE_FLOW_ITEM_TYPE_ETH , +RTE_FLOW_ITEM_TYPE_IPV4 , +RTE_FLOW_ITEM_TYPE_NVGRE , +RTE_FLOW_ITEM_TYPE_ETH , +RTE_FLOW_ITEM_TYPE_END , +}; + +static enum rte_flow_item_type pattern_nvgre_2[] = { +RTE_FLOW_ITEM_TYPE_ETH , +RTE_FLOW_ITEM_TYPE_IPV6 , +RTE_FLOW_ITEM_TYPE_NVGRE , +RTE_FLOW_ITEM_TYPE_ETH , +RTE_FLOW_ITEM_TYPE_END , +}; + +static enum rte_flow_item_type pattern_nvgre_3[] = { +RTE_FLOW_ITEM_TYPE_ETH , +RTE_FLOW_ITEM_TYPE_IPV4 , +RTE_FLOW_ITEM_TYPE_NVGRE , +RTE_FLOW_ITEM_TYPE_ETH , +RTE_FLOW_ITEM_TYPE_VLAN , +RTE_FLOW_ITEM_TYPE_END , +}; + +static enum rte_flow_item_type pattern_nvgre_4[] = { +RTE_FLOW_ITEM_TYPE_ETH , +RTE_FLOW_ITEM_TYPE_IPV6 , +RTE_FLOW_ITEM_TYPE_NVGRE , +RTE_FLOW_ITEM_TYPE_ETH , +RTE_FLOW_ITEM_TYPE_VLAN , +RTE_FLOW_ITEM_TYPE_END , +}; +static struct i40e_valid_pattern i40e_supported_patterns[] = {/* Ethertype */ { pattern_ethertype, i40e_flow_parse_ethertype_filter },
@@ -303,6 +343,10 @@ static struct i40e_valid_pattern i40e_supported_patterns[] = { { pattern_vxlan_2, i40e_flow_parse_vxlan_filter }, { pattern_vxlan_3, i40e_flow_parse_vxlan_filter }, { pattern_vxlan_4, i40e_flow_parse_vxlan_filter }, + { pattern_nvgre_1, i40e_flow_parse_nvgre_filter }, + { pattern_nvgre_2, i40e_flow_parse_nvgre_filter }, + { pattern_nvgre_3, i40e_flow_parse_nvgre_filter }, + { pattern_nvgre_4, i40e_flow_parse_nvgre_filter }, };#define NEXT_ITEM_OF_ACTION (act, actions, index) \
@@ -1495,6 +1539,297 @@ i40e_flow_parse_vxlan_filter(struct rte_eth_dev *dev,return ret; } +/* 1. Last in item should be NULL as range is not supported. +* 2. Supported filter types: IMAC_IVLAN_TENID, IMAC_IVLAN, +* IMAC_TENID, OMAC_TENID_IMAC and IMAC. +* 3. Mask of fields which need to be matched should be +* filled with 1. +* 4. Mask of fields which needn't to be matched should be +* filled with 0. +*/ +static int +i40e_flow_parse_nvgre_pattern(__rte_unused struct rte_eth_dev *dev, +const struct rte_flow_item *pattern, +struct rte_flow_error *error, +struct rte_eth_tunnel_filter_conf *filter) +{ +const struct rte_flow_item *item = pattern; +const struct rte_flow_item_eth *eth_spec; +const struct rte_flow_item_eth *eth_mask; +const struct rte_flow_item_eth *o_eth_spec =NULL ; +const struct rte_flow_item_eth *o_eth_mask =NULL ; +const struct rte_flow_item_nvgre *nvgre_spec =NULL ; +const struct rte_flow_item_nvgre *nvgre_mask =NULL ; +const struct rte_flow_item_eth *i_eth_spec =NULL ; +const struct rte_flow_item_eth *i_eth_mask =NULL ; +const struct rte_flow_item_vlan *vlan_spec =NULL ; +const struct rte_flow_item_vlan *vlan_mask =NULL ; +bool is_tni_masked =0 ; +enum rte_flow_item_type item_type; +bool nvgre_flag =0 ; +uint32_t tenant_id_be =0 ; + +for (; item->type !=RTE_FLOW_ITEM_TYPE_END ; item++) { +if (item->last) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Not support range" ); +return -rte_errno; + } + item_type = item->type; +switch (item_type) { +case RTE_FLOW_ITEM_TYPE_ETH : + eth_spec = (const struct rte_flow_item_eth *)item->spec; + eth_mask = (const struct rte_flow_item_eth *)item->mask; +if ((!eth_spec && eth_mask) || + (eth_spec && !eth_mask)) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Invalid ether spec/mask" ); +return -rte_errno; + } + +if (eth_spec && eth_mask) { +/* DST address of inner MAC shouldn't be masked. +* SRC address of Inner MAC should be masked. +*/ +if (!is_broadcast_ether_addr (ð_mask->dst) || + !is_zero_ether_addr (ð_mask->src) || + eth_mask->type) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Invalid ether spec/mask" ); +return -rte_errno; + } + +if (!nvgre_flag) +rte_memcpy (&filter->outer_mac, + ð_spec->dst, +ETHER_ADDR_LEN ); +else +rte_memcpy (&filter->inner_mac, + ð_spec->dst, +ETHER_ADDR_LEN ); + } + +if (!nvgre_flag) { + o_eth_spec = eth_spec; + o_eth_mask = eth_mask; + }else { + i_eth_spec = eth_spec; + i_eth_mask = eth_mask; + } + +break ; +case RTE_FLOW_ITEM_TYPE_VLAN : + vlan_spec = + (const struct rte_flow_item_vlan *)item->spec; + vlan_mask = + (const struct rte_flow_item_vlan *)item->mask; +if (nvgre_flag) { + vlan_spec = + (const struct rte_flow_item_vlan *)item->spec; + vlan_mask = + (const struct rte_flow_item_vlan *)item->mask; +if (!(vlan_spec && vlan_mask)) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Invalid vlan item" ); +return -rte_errno; + } + }else { +if (vlan_spec || vlan_mask) +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Invalid vlan item" ); +return -rte_errno; + } +break ; +case RTE_FLOW_ITEM_TYPE_IPV4 : + filter->ip_type =RTE_TUNNEL_IPTYPE_IPV4 ; +/* IPv4 is used to describe protocol, +* spec amd mask should be NULL. +*/ +if (item->spec || item->mask) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Invalid IPv4 item" ); +return -rte_errno; + } +break ; +case RTE_FLOW_ITEM_TYPE_IPV6 : + filter->ip_type =RTE_TUNNEL_IPTYPE_IPV6 ; +/* IPv6 is used to describe protocol, +* spec amd mask should be NULL. +*/ +if (item->spec || item->mask) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Invalid IPv6 item" ); +return -rte_errno; + } +break ; +case RTE_FLOW_ITEM_TYPE_NVGRE : + nvgre_spec = + (const struct rte_flow_item_nvgre *)item->spec; + nvgre_mask = + (const struct rte_flow_item_nvgre *)item->mask; +/* Check if NVGRE item is used to describe protocol. +* If yes, both spec and mask should be NULL. +* If no, either spec or mask shouldn't be NULL. +*/ +if ((!nvgre_spec && nvgre_mask) || + (nvgre_spec && !nvgre_mask)) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Invalid NVGRE item" ); +return -rte_errno; + } + +/* Check if TNI is masked. */ +if (nvgre_mask) { + is_tni_masked = +i40e_check_tenant_id_mask (nvgre_mask->tni); +if (is_tni_masked <0 ) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item, +"Invalid TNI mask" ); +return -rte_errno; + } + } + nvgre_flag =1 ; +break ; +default : +break ; + } + } + +/* Check specification and mask to get the filter type */ +if (vlan_spec && vlan_mask && + (vlan_mask->tci ==rte_cpu_to_be_16 (I40E_TCI_MASK ))) { +/* If there's inner vlan */ + filter->inner_vlan =rte_be_to_cpu_16 (vlan_spec->tci) + &I40E_TCI_MASK ; +if (nvgre_spec && nvgre_mask && !is_tni_masked) { +/* If there's nvgre */ +rte_memcpy (((uint8_t *)&tenant_id_be +1 ), + nvgre_spec->tni,3 ); + filter->tenant_id =rte_be_to_cpu_32 (tenant_id_be); +if (!o_eth_spec && !o_eth_mask && + i_eth_spec && i_eth_mask) + filter->filter_type = +RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID ; +else { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , +NULL , +"Invalid filter type" ); +return -rte_errno; + } + }else if (!nvgre_spec && !nvgre_mask) { +/* If there's no nvgre */ +if (!o_eth_spec && !o_eth_mask && + i_eth_spec && i_eth_mask) + filter->filter_type = +RTE_TUNNEL_FILTER_IMAC_IVLAN ; +else { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , +NULL , +"Invalid filter type" ); +return -rte_errno; + } + }else { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , +NULL , +"Invalid filter type" ); +return -rte_errno; + } + }else if ((!vlan_spec && !vlan_mask) || + (vlan_spec && vlan_mask && vlan_mask->tci ==0x0 )) { +/* If there's no inner vlan */ +if (nvgre_spec && nvgre_mask && !is_tni_masked) { +/* If there's nvgre */ +rte_memcpy (((uint8_t *)&tenant_id_be +1 ), + nvgre_spec->tni,3 ); + filter->tenant_id =rte_be_to_cpu_32 (tenant_id_be); +if (!o_eth_spec && !o_eth_mask && + i_eth_spec && i_eth_mask) + filter->filter_type = +RTE_TUNNEL_FILTER_IMAC_TENID ; +else if (o_eth_spec && o_eth_mask && + i_eth_spec && i_eth_mask) + filter->filter_type = +RTE_TUNNEL_FILTER_OMAC_TENID_IMAC ; + }else if (!nvgre_spec && !nvgre_mask) { +/* If there's no nvgre */ +if (!o_eth_spec && !o_eth_mask && + i_eth_spec && i_eth_mask) { + filter->filter_type =ETH_TUNNEL_FILTER_IMAC ; + }else { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM ,NULL , +"Invalid filter type" ); +return -rte_errno; + } + }else { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM ,NULL , +"Invalid filter type" ); +return -rte_errno; + } + }else { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM ,NULL , +"Not supported by tunnel filter." ); +return -rte_errno; + } + + filter->tunnel_type =RTE_TUNNEL_TYPE_NVGRE ; + +return 0 ; +} + +static int +i40e_flow_parse_nvgre_filter (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 rte_eth_tunnel_filter_conf *tunnel_filter = + &filter->tunnel_filter; +int ret; + + ret =i40e_flow_parse_nvgre_pattern (dev, pattern, + error, tunnel_filter); +if (ret) +return ret; + + ret =i40e_flow_parse_tunnel_action (dev, actions, error, tunnel_filter); +if (ret) +return ret; + + ret =i40e_flow_parse_attr (attr, error); +if (ret) +return ret; + + cons_filter_type =RTE_ETH_FILTER_TUNNEL ; + +return ret; +} + static int i40e_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
Signature · 1 line
2.5.5
PATCH 1/1 PPP prototype
In reply to Beilei XingFrom: Qi Zhang <[email protected]>
--- app/test-pmd/cmdline.c | 57 ++++++++++++ app/test-pmd/config.c | 114 +++++++++++++++++++++++ app/test-pmd/testpmd.h | 3 + drivers/net/i40e/base/i40e_adminq_cmd.h | 33 +++++++ drivers/net/i40e/base/i40e_common.c | 160 +++++++++++++++++++++++++++++++- drivers/net/i40e/base/i40e_prototype.h | 12 +++ drivers/net/i40e/base/i40e_type.h | 69 ++++++++++++++ drivers/net/i40e/i40e_ethdev.c | 55 +++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 1 + 9 files changed, 503 insertions(+), 1 deletion(-)
app/test-pmd/cmdline.c +57 -0
@@ -12395,6 +12395,62 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = { }, }; +/* Write Pipeline Personalization Profile */ +struct cmd_write_ppp_result { +cmdline_fixed_string_t write; +cmdline_fixed_string_t ppp; +uint8_t port_id; +char filename[]; +}; + +cmdline_parse_token_string_t cmd_write_ppp_write = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, write, "write"); +cmdline_parse_token_string_t cmd_write_ppp_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, ppp, "ppp"); +cmdline_parse_token_num_t cmd_write_ppp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_write_ppp_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_write_ppp_filename = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, filename, NULL); + +static void +cmd_write_ppp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_write_ppp_result *res = parsed_result; +uint8_t *buff; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + + buff =open_package_file (res->filename); +if (!buff) +return ; + + ret =i40e_process_package (res->port_id, buff); +if (ret <0 ) +printf ("Failed to write profile.\n" ); + +close_package_file (buff); +} + +cmdline_parse_inst_t cmd_write_ppp = { + .f = cmd_write_ppp_parsed, + .data =NULL , + .help_str ="write ppp <port_id> <profile_name>" , + .tokens = { + (void *)&cmd_write_ppp_write, + (void *)&cmd_write_ppp_ppp, + (void *)&cmd_write_ppp_port_id, + (void *)&cmd_write_ppp_filename, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -12570,6 +12626,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, + (cmdline_parse_inst_t *)&cmd_write_ppp, NULL, };
app/test-pmd/config.c +114 -0
123 lines not on this page · raw message
app/test-pmd/testpmd.h +3 -0
@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);void mcast_addr_remove (uint8_t port_id,struct ether_addr *mc_addr);void port_dcb_info_display (uint8_t port_id); +uint8_t *open_package_file (const char *file_path); +int close_package_file (uint8_t *buf); +enum print_warning {ENABLED_WARN =0 ,DISABLED_WARN
drivers/net/i40e/base/i40e_adminq_cmd.h +33 -0
@@ -198,6 +198,10 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_add_mirror_rule =0x0260 , i40e_aqc_opc_delete_mirror_rule =0x0261 , +/* Support Pipeline Personalization Profile */ + i40e_aqc_opc_write_personalization_profile =0x0270 , + i40e_aqc_opc_read_personalization_profile_list =0x0271 , +/* DCB commands */ i40e_aqc_opc_dcb_ignore_pfc =0x0301 , i40e_aqc_opc_dcb_updated = 0x0302,
@@ -1441,6 +1445,35 @@ struct i40e_aqc_add_delete_mirror_rule_completion {I40E_CHECK_CMD_LENGTH (i40e_aqc_add_delete_mirror_rule_completion); +/* Pipeline Personalization Profile */ +struct i40e_aqc_write_ppp { +u8 flags; +#define I40E_AQ_WR_PPP_ADD_TRACK_ID 0x01 +#define I40E_AQ_WR_PPP_REMOVE_TRACK_ID 0x02 +u8 reserved[3 ]; +__le32 profile_track_id; +__le32 addr_high; +__le32 addr_low; +}; + +I40E_CHECK_CMD_LENGTH (i40e_aqc_write_ppp); + +struct i40e_aqc_write_ppp_resp { +__le32 error_offset; +__le32 error_info; +__le32 addr_high; +__le32 addr_low; +}; + +struct i40e_aqc_read_ppp { +u8 flags; +u8 reserved[7 ]; +__le32 addr_high; +__le32 addr_low; +}; + +I40E_CHECK_CMD_LENGTH (i40e_aqc_read_ppp); +/* DCB 0x03xx*/ /* PFC Ignore (direct 0x0301)
drivers/net/i40e/base/i40e_common.c +159 -1
164 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +12 -0
@@ -555,4 +555,16 @@ enum i40e_status_code i40e_write_phy_register(struct i40e_hw *hw,u8 i40e_get_phy_address (struct i40e_hw *hw,u8 dev_num);enum i40e_status_code i40e_blink_phy_link_led (struct i40e_hw *hw,u32 time,u32 interval); +enum i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +u16 buff_size,u32 track_id, +struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code i40e_aq_read_ppp (struct i40e_hw *hw, +void *buff,u16 buff_size, +struct i40e_asq_cmd_details *cmd_details); +struct i40e_generic_seg_header * +i40e_find_segment_in_package (u32 segment_type, +struct i40e_package_header *pkg_header); +enum i40e_status_code +i40e_write_profile (struct i40e_hw *hw,struct i40e_profile_segment *i40e_seg, +u32 track_id);#endif /* _I40E_PROTOTYPE_H_ */
drivers/net/i40e/base/i40e_type.h +69 -0
73 lines not on this page · raw message
drivers/net/i40e/i40e_ethdev.c +55 -0
64 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e.h +1 -0
@@ -332,4 +332,5 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,int rte_pmd_i40e_reset_vf_stats (uint8_t port,uint16_t vf_id); +int i40e_process_package (uint8_t port,uint8_t *buff);#endif /* _PMD_I40E_H_ */
Signature · 1 line
2.7.4
PATCH 1/1 ppp implemantation
In reply to Beilei Xing--- app/test-pmd/cmdline.c | 57 ++++++++++++ app/test-pmd/config.c | 62 +++++++++++++ app/test-pmd/testpmd.h | 3 + drivers/net/i40e/base/i40e_adminq_cmd.h | 33 +++++++ drivers/net/i40e/base/i40e_common.c | 160 +++++++++++++++++++++++++++++++- drivers/net/i40e/base/i40e_prototype.h | 12 +++ drivers/net/i40e/base/i40e_type.h | 69 ++++++++++++++ drivers/net/i40e/i40e_ethdev.c | 55 +++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 1 + 9 files changed, 451 insertions(+), 1 deletion(-)
app/test-pmd/cmdline.c +57 -0
@@ -12395,6 +12395,62 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = { }, }; +/* Write Pipeline Personalization Profile */ +struct cmd_write_ppp_result { +cmdline_fixed_string_t write; +cmdline_fixed_string_t ppp; +uint8_t port_id; +char filename[]; +}; + +cmdline_parse_token_string_t cmd_write_ppp_write = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, write, "write"); +cmdline_parse_token_string_t cmd_write_ppp_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, ppp, "ppp"); +cmdline_parse_token_num_t cmd_write_ppp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_write_ppp_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_write_ppp_filename = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, filename, NULL); + +static void +cmd_write_ppp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_write_ppp_result *res = parsed_result; +uint8_t *buff; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + + buff =open_package_file (res->filename); +if (!buff) +return ; + + ret =i40e_process_package (res->port_id, buff); +if (ret <0 ) +printf ("Failed to write profile.\n" ); + +close_package_file (buff); +} + +cmdline_parse_inst_t cmd_write_ppp = { + .f = cmd_write_ppp_parsed, + .data =NULL , + .help_str ="write ppp <port_id> <profile_name>" , + .tokens = { + (void *)&cmd_write_ppp_write, + (void *)&cmd_write_ppp_ppp, + (void *)&cmd_write_ppp_port_id, + (void *)&cmd_write_ppp_filename, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -12570,6 +12626,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, + (cmdline_parse_inst_t *)&cmd_write_ppp, NULL, };
app/test-pmd/config.c +62 -0
65 lines not on this page · raw message
app/test-pmd/testpmd.h +3 -0
@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);void mcast_addr_remove (uint8_t port_id,struct ether_addr *mc_addr);void port_dcb_info_display (uint8_t port_id); +uint8_t *open_package_file (const char *file_path); +int close_package_file (uint8_t *buf); +enum print_warning {ENABLED_WARN =0 ,DISABLED_WARN
drivers/net/i40e/base/i40e_adminq_cmd.h +33 -0
@@ -198,6 +198,10 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_add_mirror_rule =0x0260 , i40e_aqc_opc_delete_mirror_rule =0x0261 , +/* Support Pipeline Personalization Profile */ + i40e_aqc_opc_write_personalization_profile =0x0270 , + i40e_aqc_opc_read_personalization_profile_list =0x0271 , +/* DCB commands */ i40e_aqc_opc_dcb_ignore_pfc =0x0301 , i40e_aqc_opc_dcb_updated = 0x0302,
@@ -1441,6 +1445,35 @@ struct i40e_aqc_add_delete_mirror_rule_completion {I40E_CHECK_CMD_LENGTH (i40e_aqc_add_delete_mirror_rule_completion); +/* Pipeline Personalization Profile */ +struct i40e_aqc_write_ppp { +u8 flags; +#define I40E_AQ_WR_PPP_ADD_TRACK_ID 0x01 +#define I40E_AQ_WR_PPP_REMOVE_TRACK_ID 0x02 +u8 reserved[3 ]; +__le32 profile_track_id; +__le32 addr_high; +__le32 addr_low; +}; + +I40E_CHECK_CMD_LENGTH (i40e_aqc_write_ppp); + +struct i40e_aqc_write_ppp_resp { +__le32 error_offset; +__le32 error_info; +__le32 addr_high; +__le32 addr_low; +}; + +struct i40e_aqc_read_ppp { +u8 flags; +u8 reserved[7 ]; +__le32 addr_high; +__le32 addr_low; +}; + +I40E_CHECK_CMD_LENGTH (i40e_aqc_read_ppp); +/* DCB 0x03xx*/ /* PFC Ignore (direct 0x0301)
drivers/net/i40e/base/i40e_common.c +159 -1
164 lines not on this page · raw message
drivers/net/i40e/base/i40e_prototype.h +12 -0
@@ -555,4 +555,16 @@ enum i40e_status_code i40e_write_phy_register(struct i40e_hw *hw,u8 i40e_get_phy_address (struct i40e_hw *hw,u8 dev_num);enum i40e_status_code i40e_blink_phy_link_led (struct i40e_hw *hw,u32 time,u32 interval); +enum i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +u16 buff_size,u32 track_id, +struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code i40e_aq_read_ppp (struct i40e_hw *hw, +void *buff,u16 buff_size, +struct i40e_asq_cmd_details *cmd_details); +struct i40e_generic_seg_header * +i40e_find_segment_in_package (u32 segment_type, +struct i40e_package_header *pkg_header); +enum i40e_status_code +i40e_write_profile (struct i40e_hw *hw,struct i40e_profile_segment *i40e_seg, +u32 track_id);#endif /* _I40E_PROTOTYPE_H_ */
drivers/net/i40e/base/i40e_type.h +69 -0
73 lines not on this page · raw message
drivers/net/i40e/i40e_ethdev.c +55 -0
64 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e.h +1 -0
@@ -332,4 +332,5 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,int rte_pmd_i40e_reset_vf_stats (uint8_t port,uint16_t vf_id); +int i40e_process_package (uint8_t port,uint8_t *buff);#endif /* _PMD_I40E_H_ */
Signature · 1 line
2.5.5
cover net/i40e: support pipeline personalization profile
In reply to Beilei XingAdd APIs and driver to support load/get
i40e PPP (Pipeline Personalization Profile)
since PPP will be supported from FVL6 NVM.
Beilei Xing (5):
net/i40e: support pipeline personalization profile net/i40e: add ppp processing
app/testpmd: add command for writing personalization profile net/i40e: add get all loaded profiles
app/testpmd: add command for getting loaded profiles
Rami Rosen (1):
net/i40e: fix a typo in flow
app/test-pmd/cmdline.c | 121 +++++++++++++++ app/test-pmd/config.c | 54 +++++++ app/test-pmd/testpmd.h | 4 + drivers/net/i40e/i40e_ethdev.c | 332 ++++++++++++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 132 ++++++++++++++++ drivers/net/i40e/i40e_flow.c | 6 +- drivers/net/i40e/rte_pmd_i40e.h | 14 ++ 7 files changed, 660 insertions(+), 3 deletions(-)
Signature · 1 line
2.5.5
PATCH 2/6 net/i40e: support pipeline personalization profile
In reply to Beilei XingAdd admin queue functions for Pipeline Personalization Profile AQ commands defined in DCR 287:
- Write Recipe Command buffer (Opcode: 0x0270)
- Get Applied Profiles list (Opcode: 0x0271)
This patch will be moved to base driver in future.
--- drivers/net/i40e/i40e_ethdev.c | 237 +++++++++++++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 127 ++++++++++++++++++++++ 2 files changed, 364 insertions(+)
drivers/net/i40e/i40e_ethdev.c +237 -0
@@ -11219,3 +11219,240 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,return 0 ; } + +/** +* i40e_aq_write_ppp - Write pipeline personalization profile (ppp) +* @hw: pointer to the hw struct +* @buff: command buffer (size in bytes = buff_size) +* @buff_size: buffer size in bytes +* @track_id: package tracking id +* @error_offset: returns error offset +* @error_info: returns error information +* @cmd_details: pointer to command details structure or NULL +**/ +enum +i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +uint16_t buff_size,uint32_t track_id, +uint32_t *error_offset,uint32_t *error_info, +struct i40e_asq_cmd_details *cmd_details) +{ +struct i40e_aq_desc desc; +struct i40e_aqc_write_personalization_profile *cmd = + (struct i40e_aqc_write_personalization_profile *)&desc.params.raw; +struct i40e_aqc_write_ppp_resp *resp; +enum i40e_status_code status; + +i40e_fill_default_direct_cmd_desc (&desc, + i40e_aqc_opc_write_personalization_profile); + + desc.flags |=CPU_TO_LE16 (I40E_AQ_FLAG_BUF |I40E_AQ_FLAG_RD ); +if (buff_size >I40E_AQ_LARGE_BUF ) + desc.flags |=CPU_TO_LE16 ((uint16_t )I40E_AQ_FLAG_LB ); + + desc.datalen =CPU_TO_LE16 (buff_size); + + cmd->profile_track_id =CPU_TO_LE32 (track_id); + + status =i40e_asq_send_command (hw, &desc, buff, buff_size, cmd_details); +if (!status) { + resp = (struct i40e_aqc_write_ppp_resp *)&desc.params.raw; +if (error_offset) + *error_offset =LE32_TO_CPU (resp->error_offset); +if (error_info) + *error_info =LE32_TO_CPU (resp->error_info); + } + +return status; +} + +/** +* i40e_aq_get_ppp_list - Read pipeline personalization profile (ppp) +* @hw: pointer to the hw struct +* @buff: command buffer (size in bytes = buff_size) +* @buff_size: buffer size in bytes +* @cmd_details: pointer to command details structure or NULL +**/ +enum +i40e_status_code i40e_aq_get_ppp_list (struct i40e_hw *hw,void *buff, +uint16_t buff_size,uint8_t flags, +struct i40e_asq_cmd_details *cmd_details) +{ +struct i40e_aq_desc desc; +struct i40e_aqc_get_applied_profiles *cmd = + (struct i40e_aqc_get_applied_profiles *)&desc.params.raw; +enum i40e_status_code status; + +i40e_fill_default_direct_cmd_desc (&desc, + i40e_aqc_opc_get_personalization_profile_list); + + desc.flags |=CPU_TO_LE16 ((u16 )I40E_AQ_FLAG_BUF ); +if (buff_size >I40E_AQ_LARGE_BUF ) + desc.flags |=CPU_TO_LE16 ((uint16_t )I40E_AQ_FLAG_LB ); + desc.datalen =CPU_TO_LE16 (buff_size); + + cmd->flags = flags; + + status =i40e_asq_send_command (hw, &desc, buff, buff_size, cmd_details); + +return status; +} + +/** +* i40e_find_segment_in_package +* @segment_type: the segment type to search for (i.e., SEGMENT_TYPE_I40E) +* @pkg_hdr: pointer to the package header to be searched +* +* This function searches a package file for a particular segment type. On +* success it returns a pointer to the segment header, otherwise it will +* return NULL. +*/ +struct i40e_generic_seg_header * +i40e_find_segment_in_package (uint32_t segment_type, +struct i40e_package_header *pkg_hdr) +{ +struct i40e_generic_seg_header *segment; +uint32_t i; + +PMD_DRV_LOG (INFO ,"i40e_find_segment_in_package" ); +PMD_DRV_LOG (INFO ,"Package version: %d.%d.%d.%d" , + pkg_hdr->version.major, + pkg_hdr->version.minor, + pkg_hdr->version.update, + pkg_hdr->version.draft); + +/* Search all package segments for the requested segment type */ +for (i =0 ; i < pkg_hdr->segment_count; i++) { + segment = + (struct i40e_generic_seg_header *)((uint8_t *)pkg_hdr + + pkg_hdr->segment_offset[i]); + +if (segment->type == segment_type) +return segment; + } + +return NULL ; +} + +/** +* i40e_write_profile +* @hw: pointer to the hardware structure +* @profile: pointer to the profile segment of the package to be downloaded +* @track_id: package tracking id +* +* Handles the download of a complete package. +*/ +enum i40e_status_code +i40e_write_profile (struct i40e_hw *hw,struct i40e_profile_segment *profile, +uint32_t track_id) +{ +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_section_table *sec_tbl; +struct i40e_profile_section_header *sec =NULL ; +uint32_t dev_cnt; +uint32_t vendor_dev_id; +uint32_t *nvm; +uint32_t section_size =0 ; +uint32_t offset =0 , info =0 ; +uint32_t i; + +PMD_DRV_LOG (INFO ,"i40e_write_profile" ); +PMD_DRV_LOG (INFO ,"Segment version: %d.%d.%d.%d" , + profile->header.version.major, + profile->header.version.minor, + profile->header.version.update, + profile->header.version.draft); +PMD_DRV_LOG (INFO ,"Seg: type 0x%X, size %d, name %s" , +LE32_TO_CPU (profile->header.type), +LE32_TO_CPU (profile->header.size), + profile->header.name); + +if (!track_id) { +PMD_DRV_LOG (ERR ,"Track_id can't be 0." ); +return I40E_NOT_SUPPORTED ; + } + + dev_cnt = profile->device_table_count; + +for (i =0 ; i < dev_cnt; i++) { + vendor_dev_id = profile->device_table[i].vendor_dev_id; +if ((vendor_dev_id >>16 ) ==I40E_INTEL_VENDOR_ID ) +if (hw->device_id == (vendor_dev_id &0xFFFF )) +break ; + } +if (i == dev_cnt) { +PMD_DRV_LOG (ERR ,"Device doesn't support PPP" ); +return I40E_ERR_DEVICE_NOT_SUPPORTED ; + } + + nvm = (uint32_t *)&profile->device_table[dev_cnt]; + sec_tbl = (struct i40e_section_table *)&nvm[nvm[0 ] +1 ]; + +for (i =0 ; i < sec_tbl->section_count; i++) { + sec = (struct i40e_profile_section_header *) + ((uint8_t *)profile + + sec_tbl->section_offset[i]); + +/* Skip 'AQ', 'note' and 'name' sections */ +if (sec->section.type !=SECTION_TYPE_MMIO ) +continue ; + + section_size = sec->section.size + +sizeof (struct i40e_profile_section_header ); + +/* Write profile */ + status =i40e_aq_write_ppp (hw, (void *)sec, + (uint16_t )section_size, + track_id, &offset, &info,NULL ); +if (status) { +PMD_DRV_LOG (ERR ,"Failed to write profile: " +"offset %d, info %d" , + offset, info); +break ; + } + } + +return status; +} + +/** +* i40e_add_pinfo_to_list +* @hw: pointer to the hardware structure +* @profile: pointer to the profile segment of the package +* @profile_info_sec: buffer for information section +* @track_id: package tracking id +* +* Register a profile to the list of loaded profiles. +*/ +enum i40e_status_code +i40e_add_pinfo_to_list (struct i40e_hw *hw, +struct i40e_profile_segment *profile, +uint8_t *profile_info_sec,uint32_t track_id) +{ +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec =NULL ; +struct i40e_profile_info *pinfo; +uint32_t offset =0 , info =0 ; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; + pinfo->version = profile->version; + pinfo->op =I40E_PPP_ADD_TRACKID ; +memcpy (pinfo->name, profile->name,I40E_PPP_NAME_SIZE ); + + status =i40e_aq_write_ppp (hw, (void *)sec, sec->data_end, + track_id, &offset, &info,NULL ); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add to list: " +"offset %d, info %d" , + offset, info); + +return status; +}
drivers/net/i40e/i40e_ethdev.h +127 -0
139 lines not on this page · raw message
Signature · 1 line
2.5.5
PATCH 3/6 net/i40e: add ppp processing
In reply to Beilei XingAdd loading profile function.
--- drivers/net/i40e/i40e_ethdev.c | 59 +++++++++++++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 7 +++++ 2 files changed, 66 insertions(+)
drivers/net/i40e/i40e_ethdev.c +59 -0
@@ -11456,3 +11456,62 @@ i40e_add_pinfo_to_list(struct i40e_hw *hw,return status; } + +int +i40e_process_package (uint8_t port,uint8_t *buff) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port]; +struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +enum i40e_status_code status; + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_METADATA , + pkg_hdr); +if (!metadata_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find metadata segment header" ); +return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment *)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_I40E , + pkg_hdr); +if (!profile_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find profile segment header" ); +return -EINVAL ; + } + +/* Write profile to HW */ + status =i40e_write_profile (hw, + (struct i40e_profile_segment *)profile_seg_hdr, + track_id); +if (!status) +printf ("Write profile successfully.\n" ); + +/* Add the profile info to the list of loaded profiles */ + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); + status =i40e_add_pinfo_to_list (hw, + (struct i40e_profile_segment *)profile_seg_hdr, + profile_info_sec, track_id); +if (!status) +printf ("Add profile info successfully.\n" ); + +rte_free (profile_info_sec); + +return status; +}
drivers/net/i40e/rte_pmd_i40e.h +7 -0
@@ -332,4 +332,11 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,int rte_pmd_i40e_reset_vf_stats (uint8_t port,uint16_t vf_id); +/** +* i40e_process_package - Load package +* @port: port id +* @buff: buffer of package +**/ +int i40e_process_package (uint8_t port,uint8_t *buff); +#endif /* _PMD_I40E_H_ */
Signature · 1 line
2.5.5
PATCH 4/6 app/testpmd: add command for writing personalization profile
In reply to Beilei XingThis patch is to add testpmd CLI for writing personalization profile.
--- app/test-pmd/cmdline.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 3 +++ 3 files changed, 118 insertions(+)
app/test-pmd/cmdline.c +61 -0
@@ -12395,6 +12395,66 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = { }, }; +/* Write Pipeline Personalization Profile */ +struct cmd_write_ppp_result { +cmdline_fixed_string_t write; +cmdline_fixed_string_t ppp; +uint8_t port_id; +char filename[]; +}; + +cmdline_parse_token_string_t cmd_write_ppp_write = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, write, "write"); +cmdline_parse_token_string_t cmd_write_ppp_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, ppp, "ppp"); +cmdline_parse_token_num_t cmd_write_ppp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_write_ppp_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_write_ppp_filename = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, filename, NULL); + +static void +cmd_write_ppp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_write_ppp_result *res = parsed_result; +uint8_t *buff; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +if (!all_ports_stopped ()) { +printf ("Please stop all ports first\n" ); +return ; + } + + buff =open_package_file (res->filename); +if (!buff) +return ; + + ret =i40e_process_package (res->port_id, buff); +if (ret <0 ) +printf ("Failed to write profile.\n" ); + +close_package_file (buff); +} + +cmdline_parse_inst_t cmd_write_ppp = { + .f = cmd_write_ppp_parsed, + .data =NULL , + .help_str ="write ppp <port_id> <profile_name>" , + .tokens = { + (void *)&cmd_write_ppp_write, + (void *)&cmd_write_ppp_ppp, + (void *)&cmd_write_ppp_port_id, + (void *)&cmd_write_ppp_filename, +NULL , + }, +};/* ******************************************************************************** */ /* list of instructions */
@@ -12570,6 +12630,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, + (cmdline_parse_inst_t *)&cmd_write_ppp, NULL, };
app/test-pmd/config.c +54 -0
57 lines not on this page · raw message
app/test-pmd/testpmd.h +3 -0
@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);void mcast_addr_remove (uint8_t port_id,struct ether_addr *mc_addr);void port_dcb_info_display (uint8_t port_id); +uint8_t *open_package_file (const char *file_path); +int close_package_file (uint8_t *buf); +enum print_warning {ENABLED_WARN =0 ,DISABLED_WARN
Signature · 1 line
2.5.5
PATCH 5/6 net/i40e: add get all loaded profiles
In reply to Beilei XingThis patch is to add get all loaded profiles function.
--- drivers/net/i40e/i40e_ethdev.c | 36 ++++++++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 5 +++++ drivers/net/i40e/rte_pmd_i40e.h | 7 +++++++ 3 files changed, 48 insertions(+)
drivers/net/i40e/i40e_ethdev.c +36 -0
@@ -11515,3 +11515,39 @@ i40e_process_package(uint8_t port, uint8_t *buff)return status; } + +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 +int +i40e_get_ppp_list (uint8_t port,uint8_t *buff) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port]; +struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct i40e_profile_list *p_list; +struct i40e_profile_info *p_info; +uint32_t p_num, i; +enum i40e_status_code status =I40E_SUCCESS ; + + status =i40e_aq_get_ppp_list (hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 ), +0 ,NULL ); +if (status <0 ) +return status; + + p_list = (struct i40e_profile_list *)buff; + p_num = p_list->p_count; +printf ("Profile number is: %d\n\n" , p_num); + +for (i =0 ; i < p_num; i++) { + p_info = &p_list->p_info[i]; +printf ("Profile %d:\n" , i); +printf ("Track id: 0x%x\n" , p_info->track_id); +printf ("Version: %d.%d.%d.%d \n\n" , + p_info->version.major, + p_info->version.minor, + p_info->version.update, + p_info->version.draft); + } + +return status; +}
drivers/net/i40e/i40e_ethdev.h +5 -0
@@ -839,6 +839,11 @@ struct i40e_profile_info {uint8_t name[I40E_PPP_NAME_SIZE ]; }; +struct i40e_profile_list { +uint32_t p_count; +struct i40e_profile_info p_info[1 ]; +}; +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,
drivers/net/i40e/rte_pmd_i40e.h +7 -0
@@ -339,4 +339,11 @@ int rte_pmd_i40e_reset_vf_stats(uint8_t port,**/ int i40e_process_package (uint8_t port,uint8_t *buff); +/** +* i40e_get_ppp_list - Get loaded profiles +* @port: port id +* @buff: buffer for response +**/ +int i40e_get_ppp_list (uint8_t port,uint8_t *buff); +#endif /* _PMD_I40E_H_ */
Signature · 1 line
2.5.5
PATCH 6/6 app/testpmd: add command for getting loaded profiles
In reply to Beilei XingThis patch is to add testpmd CLI for getting all loaded profiles.
--- app/test-pmd/cmdline.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 1 + 2 files changed, 61 insertions(+)
app/test-pmd/cmdline.c +60 -0
@@ -12455,6 +12455,65 @@ cmdline_parse_inst_t cmd_write_ppp = { NULL, }, }; + +/* Get Pipeline Personalization Profile list*/ +#define PROFILE_INFO_SIZE 48 +#define MAX_PROFILE_NUM 16 + +struct cmd_get_ppp_list_result { +cmdline_fixed_string_t get; +cmdline_fixed_string_t ppp; +cmdline_fixed_string_t list; +uint8_t port_id; +}; + +cmdline_parse_token_string_t cmd_get_ppp_list_get = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, get, "get"); +cmdline_parse_token_string_t cmd_get_ppp_list_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, ppp, "ppp"); +cmdline_parse_token_string_t cmd_get_ppp_list_list = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, list, "list"); +cmdline_parse_token_num_t cmd_get_ppp_list_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_get_ppp_list_result, port_id, UINT8); + +static void +cmd_get_ppp_list_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_get_ppp_list_result *res = parsed_result; +uint8_t *buff; +int ret; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + + buff = (uint8_t *)malloc (PROFILE_INFO_SIZE *MAX_PROFILE_NUM +4 ); +if (!buff) +printf ("%s: Failed to malloc buffer\n" , __func__); + + ret =i40e_get_ppp_list (res->port_id, buff); +if (ret <0 ) +printf ("Failed to get ppp list\n" ); + +free (buff); +} + +cmdline_parse_inst_t cmd_get_ppp_list = { + .f = cmd_get_ppp_list_parsed, + .data =NULL , + .help_str ="get ppp list <port_id>" , + .tokens = { + (void *)&cmd_get_ppp_list_get, + (void *)&cmd_get_ppp_list_ppp, + (void *)&cmd_get_ppp_list_list, + (void *)&cmd_get_ppp_list_port_id, +NULL , + }, +};/* ******************************************************************************** */ /* list of instructions */
@@ -12631,6 +12690,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, (cmdline_parse_inst_t *)&cmd_write_ppp, + (cmdline_parse_inst_t *)&cmd_get_ppp_list, NULL, };
app/test-pmd/testpmd.h +1 -0
@@ -624,6 +624,7 @@ void port_dcb_info_display(uint8_t port_id);uint8_t *open_package_file (const char *file_path);int close_package_file (uint8_t *buf); +void get_ppp_list (uint8_t port_id);enum print_warning {ENABLED_WARN =0 ,
Signature · 1 line
2.5.5
v2 cover net/i40e: support pipeline personalization profile
In reply to Beilei XingAdd APIs and driver to support load/get
i40e PPP (Pipeline Personalization Profile)
since PPP will be supported from FVL6 NVM.
v2 change:
Correct patch num.
Beilei Xing (5):
net/i40e: support pipeline personalization profile net/i40e: add ppp processing
app/testpmd: add command for writing personalization profile net/i40e: add get all loaded profiles
app/testpmd: add command for getting loaded profiles
app/test-pmd/cmdline.c | 121 +++++++++++++++ app/test-pmd/config.c | 54 +++++++ app/test-pmd/testpmd.h | 4 + drivers/net/i40e/i40e_ethdev.c | 332 ++++++++++++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 132 ++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 14 ++ 6 files changed, 657 insertions(+)
Signature · 1 line
2.5.5
PATCH v2 1/5 net/i40e: support pipeline personalization profile
Add admin queue functions for Pipeline Personalization Profile AQ commands defined in DCR 287:
- Write Recipe Command buffer (Opcode: 0x0270)
- Get Applied Profiles list (Opcode: 0x0271)
This patch will be moved to base driver in future.
--- drivers/net/i40e/i40e_ethdev.c | 237 +++++++++++++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 127 ++++++++++++++++++++++ 2 files changed, 364 insertions(+)
drivers/net/i40e/i40e_ethdev.c +237 -0
@@ -11219,3 +11219,240 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,return 0 ; } + +/** +* i40e_aq_write_ppp - Write pipeline personalization profile (ppp) +* @hw: pointer to the hw struct +* @buff: command buffer (size in bytes = buff_size) +* @buff_size: buffer size in bytes +* @track_id: package tracking id +* @error_offset: returns error offset +* @error_info: returns error information +* @cmd_details: pointer to command details structure or NULL +**/ +enum +i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +uint16_t buff_size,uint32_t track_id, +uint32_t *error_offset,uint32_t *error_info, +struct i40e_asq_cmd_details *cmd_details) +{ +struct i40e_aq_desc desc; +struct i40e_aqc_write_personalization_profile *cmd = + (struct i40e_aqc_write_personalization_profile *)&desc.params.raw; +struct i40e_aqc_write_ppp_resp *resp; +enum i40e_status_code status; + +i40e_fill_default_direct_cmd_desc (&desc, + i40e_aqc_opc_write_personalization_profile); + + desc.flags |=CPU_TO_LE16 (I40E_AQ_FLAG_BUF |I40E_AQ_FLAG_RD ); +if (buff_size >I40E_AQ_LARGE_BUF ) + desc.flags |=CPU_TO_LE16 ((uint16_t )I40E_AQ_FLAG_LB ); + + desc.datalen =CPU_TO_LE16 (buff_size); + + cmd->profile_track_id =CPU_TO_LE32 (track_id); + + status =i40e_asq_send_command (hw, &desc, buff, buff_size, cmd_details); +if (!status) { + resp = (struct i40e_aqc_write_ppp_resp *)&desc.params.raw; +if (error_offset) + *error_offset =LE32_TO_CPU (resp->error_offset); +if (error_info) + *error_info =LE32_TO_CPU (resp->error_info); + } + +return status; +} + +/** +* i40e_aq_get_ppp_list - Read pipeline personalization profile (ppp) +* @hw: pointer to the hw struct +* @buff: command buffer (size in bytes = buff_size) +* @buff_size: buffer size in bytes +* @cmd_details: pointer to command details structure or NULL +**/ +enum +i40e_status_code i40e_aq_get_ppp_list (struct i40e_hw *hw,void *buff, +uint16_t buff_size,uint8_t flags, +struct i40e_asq_cmd_details *cmd_details) +{ +struct i40e_aq_desc desc; +struct i40e_aqc_get_applied_profiles *cmd = + (struct i40e_aqc_get_applied_profiles *)&desc.params.raw; +enum i40e_status_code status; + +i40e_fill_default_direct_cmd_desc (&desc, + i40e_aqc_opc_get_personalization_profile_list); + + desc.flags |=CPU_TO_LE16 ((u16 )I40E_AQ_FLAG_BUF ); +if (buff_size >I40E_AQ_LARGE_BUF ) + desc.flags |=CPU_TO_LE16 ((uint16_t )I40E_AQ_FLAG_LB ); + desc.datalen =CPU_TO_LE16 (buff_size); + + cmd->flags = flags; + + status =i40e_asq_send_command (hw, &desc, buff, buff_size, cmd_details); + +return status; +} + +/** +* i40e_find_segment_in_package +* @segment_type: the segment type to search for (i.e., SEGMENT_TYPE_I40E) +* @pkg_hdr: pointer to the package header to be searched +* +* This function searches a package file for a particular segment type. On +* success it returns a pointer to the segment header, otherwise it will +* return NULL. +*/ +struct i40e_generic_seg_header * +i40e_find_segment_in_package (uint32_t segment_type, +struct i40e_package_header *pkg_hdr) +{ +struct i40e_generic_seg_header *segment; +uint32_t i; + +PMD_DRV_LOG (INFO ,"i40e_find_segment_in_package" ); +PMD_DRV_LOG (INFO ,"Package version: %d.%d.%d.%d" , + pkg_hdr->version.major, + pkg_hdr->version.minor, + pkg_hdr->version.update, + pkg_hdr->version.draft); + +/* Search all package segments for the requested segment type */ +for (i =0 ; i < pkg_hdr->segment_count; i++) { + segment = + (struct i40e_generic_seg_header *)((uint8_t *)pkg_hdr + + pkg_hdr->segment_offset[i]); + +if (segment->type == segment_type) +return segment; + } + +return NULL ; +} + +/** +* i40e_write_profile +* @hw: pointer to the hardware structure +* @profile: pointer to the profile segment of the package to be downloaded +* @track_id: package tracking id +* +* Handles the download of a complete package. +*/ +enum i40e_status_code +i40e_write_profile (struct i40e_hw *hw,struct i40e_profile_segment *profile, +uint32_t track_id) +{ +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_section_table *sec_tbl; +struct i40e_profile_section_header *sec =NULL ; +uint32_t dev_cnt; +uint32_t vendor_dev_id; +uint32_t *nvm; +uint32_t section_size =0 ; +uint32_t offset =0 , info =0 ; +uint32_t i; + +PMD_DRV_LOG (INFO ,"i40e_write_profile" ); +PMD_DRV_LOG (INFO ,"Segment version: %d.%d.%d.%d" , + profile->header.version.major, + profile->header.version.minor, + profile->header.version.update, + profile->header.version.draft); +PMD_DRV_LOG (INFO ,"Seg: type 0x%X, size %d, name %s" , +LE32_TO_CPU (profile->header.type), +LE32_TO_CPU (profile->header.size), + profile->header.name); + +if (!track_id) { +PMD_DRV_LOG (ERR ,"Track_id can't be 0." ); +return I40E_NOT_SUPPORTED ; + } + + dev_cnt = profile->device_table_count; + +for (i =0 ; i < dev_cnt; i++) { + vendor_dev_id = profile->device_table[i].vendor_dev_id; +if ((vendor_dev_id >>16 ) ==I40E_INTEL_VENDOR_ID ) +if (hw->device_id == (vendor_dev_id &0xFFFF )) +break ; + } +if (i == dev_cnt) { +PMD_DRV_LOG (ERR ,"Device doesn't support PPP" ); +return I40E_ERR_DEVICE_NOT_SUPPORTED ; + } + + nvm = (uint32_t *)&profile->device_table[dev_cnt]; + sec_tbl = (struct i40e_section_table *)&nvm[nvm[0 ] +1 ]; + +for (i =0 ; i < sec_tbl->section_count; i++) { + sec = (struct i40e_profile_section_header *) + ((uint8_t *)profile + + sec_tbl->section_offset[i]); + +/* Skip 'AQ', 'note' and 'name' sections */ +if (sec->section.type !=SECTION_TYPE_MMIO ) +continue ; + + section_size = sec->section.size + +sizeof (struct i40e_profile_section_header ); + +/* Write profile */ + status =i40e_aq_write_ppp (hw, (void *)sec, + (uint16_t )section_size, + track_id, &offset, &info,NULL ); +if (status) { +PMD_DRV_LOG (ERR ,"Failed to write profile: " +"offset %d, info %d" , + offset, info); +break ; + } + } + +return status; +} + +/** +* i40e_add_pinfo_to_list +* @hw: pointer to the hardware structure +* @profile: pointer to the profile segment of the package +* @profile_info_sec: buffer for information section +* @track_id: package tracking id +* +* Register a profile to the list of loaded profiles. +*/ +enum i40e_status_code +i40e_add_pinfo_to_list (struct i40e_hw *hw, +struct i40e_profile_segment *profile, +uint8_t *profile_info_sec,uint32_t track_id) +{ +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec =NULL ; +struct i40e_profile_info *pinfo; +uint32_t offset =0 , info =0 ; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; + pinfo->version = profile->version; + pinfo->op =I40E_PPP_ADD_TRACKID ; +memcpy (pinfo->name, profile->name,I40E_PPP_NAME_SIZE ); + + status =i40e_aq_write_ppp (hw, (void *)sec, sec->data_end, + track_id, &offset, &info,NULL ); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add to list: " +"offset %d, info %d" , + offset, info); + +return status; +}
drivers/net/i40e/i40e_ethdev.h +127 -0
139 lines not on this page · raw message
Signature · 1 line
2.5.5
PATCH v2 2/5 net/i40e: add ppp processing
In reply to Beilei XingAdd loading profile function.
--- drivers/net/i40e/i40e_ethdev.c | 59 +++++++++++++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 7 +++++ 2 files changed, 66 insertions(+)
drivers/net/i40e/i40e_ethdev.c +59 -0
@@ -11456,3 +11456,62 @@ i40e_add_pinfo_to_list(struct i40e_hw *hw,return status; } + +int +i40e_process_package (uint8_t port,uint8_t *buff) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port]; +struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +enum i40e_status_code status; + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_METADATA , + pkg_hdr); +if (!metadata_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find metadata segment header" ); +return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment *)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_I40E , + pkg_hdr); +if (!profile_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find profile segment header" ); +return -EINVAL ; + } + +/* Write profile to HW */ + status =i40e_write_profile (hw, + (struct i40e_profile_segment *)profile_seg_hdr, + track_id); +if (!status) +printf ("Write profile successfully.\n" ); + +/* Add the profile info to the list of loaded profiles */ + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); + status =i40e_add_pinfo_to_list (hw, + (struct i40e_profile_segment *)profile_seg_hdr, + profile_info_sec, track_id); +if (!status) +printf ("Add profile info successfully.\n" ); + +rte_free (profile_info_sec); + +return status; +}
drivers/net/i40e/rte_pmd_i40e.h +7 -0
@@ -332,4 +332,11 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,int rte_pmd_i40e_reset_vf_stats (uint8_t port,uint16_t vf_id); +/** +* i40e_process_package - Load package +* @port: port id +* @buff: buffer of package +**/ +int i40e_process_package (uint8_t port,uint8_t *buff); +#endif /* _PMD_I40E_H_ */
Signature · 1 line
2.5.5
PATCH v2 3/5 app/testpmd: add command for writing personalization profile
In reply to Beilei XingThis patch is to add testpmd CLI for writing personalization profile.
--- app/test-pmd/cmdline.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 3 +++ 3 files changed, 118 insertions(+)
app/test-pmd/cmdline.c +61 -0
@@ -12395,6 +12395,66 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = { }, }; +/* Write Pipeline Personalization Profile */ +struct cmd_write_ppp_result { +cmdline_fixed_string_t write; +cmdline_fixed_string_t ppp; +uint8_t port_id; +char filename[]; +}; + +cmdline_parse_token_string_t cmd_write_ppp_write = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, write, "write"); +cmdline_parse_token_string_t cmd_write_ppp_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, ppp, "ppp"); +cmdline_parse_token_num_t cmd_write_ppp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_write_ppp_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_write_ppp_filename = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, filename, NULL); + +static void +cmd_write_ppp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_write_ppp_result *res = parsed_result; +uint8_t *buff; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +if (!all_ports_stopped ()) { +printf ("Please stop all ports first\n" ); +return ; + } + + buff =open_package_file (res->filename); +if (!buff) +return ; + + ret =i40e_process_package (res->port_id, buff); +if (ret <0 ) +printf ("Failed to write profile.\n" ); + +close_package_file (buff); +} + +cmdline_parse_inst_t cmd_write_ppp = { + .f = cmd_write_ppp_parsed, + .data =NULL , + .help_str ="write ppp <port_id> <profile_name>" , + .tokens = { + (void *)&cmd_write_ppp_write, + (void *)&cmd_write_ppp_ppp, + (void *)&cmd_write_ppp_port_id, + (void *)&cmd_write_ppp_filename, +NULL , + }, +};/* ******************************************************************************** */ /* list of instructions */
@@ -12570,6 +12630,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, + (cmdline_parse_inst_t *)&cmd_write_ppp, NULL, };
app/test-pmd/config.c +54 -0
57 lines not on this page · raw message
app/test-pmd/testpmd.h +3 -0
@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);void mcast_addr_remove (uint8_t port_id,struct ether_addr *mc_addr);void port_dcb_info_display (uint8_t port_id); +uint8_t *open_package_file (const char *file_path); +int close_package_file (uint8_t *buf); +enum print_warning {ENABLED_WARN =0 ,DISABLED_WARN
Signature · 1 line
2.5.5
PATCH v2 4/5 net/i40e: add get all loaded profiles
In reply to Beilei XingThis patch is to add get all loaded profiles function.
--- drivers/net/i40e/i40e_ethdev.c | 36 ++++++++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 5 +++++ drivers/net/i40e/rte_pmd_i40e.h | 7 +++++++ 3 files changed, 48 insertions(+)
drivers/net/i40e/i40e_ethdev.c +36 -0
@@ -11515,3 +11515,39 @@ i40e_process_package(uint8_t port, uint8_t *buff)return status; } + +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 +int +i40e_get_ppp_list (uint8_t port,uint8_t *buff) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port]; +struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct i40e_profile_list *p_list; +struct i40e_profile_info *p_info; +uint32_t p_num, i; +enum i40e_status_code status =I40E_SUCCESS ; + + status =i40e_aq_get_ppp_list (hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 ), +0 ,NULL ); +if (status <0 ) +return status; + + p_list = (struct i40e_profile_list *)buff; + p_num = p_list->p_count; +printf ("Profile number is: %d\n\n" , p_num); + +for (i =0 ; i < p_num; i++) { + p_info = &p_list->p_info[i]; +printf ("Profile %d:\n" , i); +printf ("Track id: 0x%x\n" , p_info->track_id); +printf ("Version: %d.%d.%d.%d \n\n" , + p_info->version.major, + p_info->version.minor, + p_info->version.update, + p_info->version.draft); + } + +return status; +}
drivers/net/i40e/i40e_ethdev.h +5 -0
@@ -839,6 +839,11 @@ struct i40e_profile_info {uint8_t name[I40E_PPP_NAME_SIZE ]; }; +struct i40e_profile_list { +uint32_t p_count; +struct i40e_profile_info p_info[1 ]; +}; +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,
drivers/net/i40e/rte_pmd_i40e.h +7 -0
@@ -339,4 +339,11 @@ int rte_pmd_i40e_reset_vf_stats(uint8_t port,**/ int i40e_process_package (uint8_t port,uint8_t *buff); +/** +* i40e_get_ppp_list - Get loaded profiles +* @port: port id +* @buff: buffer for response +**/ +int i40e_get_ppp_list (uint8_t port,uint8_t *buff); +#endif /* _PMD_I40E_H_ */
Signature · 1 line
2.5.5
PATCH v2 5/5 app/testpmd: add command for getting loaded profiles
In reply to Beilei XingThis patch is to add testpmd CLI for getting all loaded profiles.
--- app/test-pmd/cmdline.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 1 + 2 files changed, 61 insertions(+)
app/test-pmd/cmdline.c +60 -0
@@ -12455,6 +12455,65 @@ cmdline_parse_inst_t cmd_write_ppp = { NULL, }, }; + +/* Get Pipeline Personalization Profile list*/ +#define PROFILE_INFO_SIZE 48 +#define MAX_PROFILE_NUM 16 + +struct cmd_get_ppp_list_result { +cmdline_fixed_string_t get; +cmdline_fixed_string_t ppp; +cmdline_fixed_string_t list; +uint8_t port_id; +}; + +cmdline_parse_token_string_t cmd_get_ppp_list_get = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, get, "get"); +cmdline_parse_token_string_t cmd_get_ppp_list_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, ppp, "ppp"); +cmdline_parse_token_string_t cmd_get_ppp_list_list = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, list, "list"); +cmdline_parse_token_num_t cmd_get_ppp_list_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_get_ppp_list_result, port_id, UINT8); + +static void +cmd_get_ppp_list_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_get_ppp_list_result *res = parsed_result; +uint8_t *buff; +int ret; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + + buff = (uint8_t *)malloc (PROFILE_INFO_SIZE *MAX_PROFILE_NUM +4 ); +if (!buff) +printf ("%s: Failed to malloc buffer\n" , __func__); + + ret =i40e_get_ppp_list (res->port_id, buff); +if (ret <0 ) +printf ("Failed to get ppp list\n" ); + +free (buff); +} + +cmdline_parse_inst_t cmd_get_ppp_list = { + .f = cmd_get_ppp_list_parsed, + .data =NULL , + .help_str ="get ppp list <port_id>" , + .tokens = { + (void *)&cmd_get_ppp_list_get, + (void *)&cmd_get_ppp_list_ppp, + (void *)&cmd_get_ppp_list_list, + (void *)&cmd_get_ppp_list_port_id, +NULL , + }, +};/* ******************************************************************************** */ /* list of instructions */
@@ -12631,6 +12690,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, (cmdline_parse_inst_t *)&cmd_write_ppp, + (cmdline_parse_inst_t *)&cmd_get_ppp_list, NULL, };
app/test-pmd/testpmd.h +1 -0
@@ -624,6 +624,7 @@ void port_dcb_info_display(uint8_t port_id);uint8_t *open_package_file (const char *file_path);int close_package_file (uint8_t *buf); +void get_ppp_list (uint8_t port_id);enum print_warning {ENABLED_WARN =0 ,
Signature · 1 line
2.5.5
Re: [PATCH 0/6] net/i40e: support pipeline personalization profile
In reply to Beilei XingSorry for the mistake for the patch thread, which includes other irrelevant patches. Please ignore these patches, and just focus on the PPP v2 patchset. Sorry for any inconvenient.
Thanks
Beilei
Quoted 34 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Beilei Xing
Sent: Friday, March 3, 2017 3:26 PM
To: Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH 0/6] net/i40e: support pipeline personalization profileAdd APIs and driver to support load/get
i40e PPP (Pipeline Personalization Profile) since PPP will be supported from FVL6 NVM.Beilei Xing (5):
net/i40e: support pipeline personalization profile net/i40e: add ppp processing
app/testpmd: add command for writing personalization profile net/i40e: add get all loaded profiles
app/testpmd: add command for getting loaded profilesRami Rosen (1):
net/i40e: fix a typo in flowapp/test-pmd/cmdline.c | 121 +++++++++++++++ app/test-pmd/config.c | 54 +++++++ app/test-pmd/testpmd.h | 4 + drivers/net/i40e/i40e_ethdev.c | 332 ++++++++++++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 132 ++++++++++++++++ drivers/net/i40e/i40e_flow.c | 6 +- drivers/net/i40e/rte_pmd_i40e.h | 14 ++ 7 files changed, 660 insertions(+), 3 deletions(-)--
2.5.5
Re: [PATCH] ppp implemantation
In reply to Beilei XingGiven that this patch is not about point-to-point protocol, i.e. the best-known expansion of "PPP", I think you need to clarify the acronym in the commit message, at minimum, if not also in the commit title.
/Bruce
Quoted 677 lines · Beilei Xing
Signed-off-by Beilei Xing <[email protected]>--- app/test-pmd/cmdline.c | 57 ++++++++ app/test-pmd/config.c | 62 +++++++++ app/test-pmd/testpmd.h | 3 + drivers/net/i40e/base/i40e_adminq_cmd.h | 32 +++++ drivers/net/i40e/base/i40e_common.c | 236 +++++++++++++++++++++++++++++++- drivers/net/i40e/base/i40e_prototype.h | 17 +++ drivers/net/i40e/base/i40e_type.h | 79 +++++++++++ drivers/net/i40e/i40e_ethdev.c | 68 +++++++++ drivers/net/i40e/rte_pmd_i40e.h | 1 + 9 files changed, 554 insertions(+), 1 deletion(-)app/test-pmd/cmdline.c +57
-0@@ -12395,6 +12395,62 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = { }, }; +/* Write Pipeline Personalization Profile */ +struct cmd_write_ppp_result { +cmdline_fixed_string_t write; +cmdline_fixed_string_t ppp; +uint8_t port_id; +char filename[]; +}; + +cmdline_parse_token_string_t cmd_write_ppp_write = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, write, "write"); +cmdline_parse_token_string_t cmd_write_ppp_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, ppp, "ppp"); +cmdline_parse_token_num_t cmd_write_ppp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_write_ppp_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_write_ppp_filename = + TOKEN_STRING_INITIALIZER(struct cmd_write_ppp_result, filename, NULL); + +static void +cmd_write_ppp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_write_ppp_result *res = parsed_result; +uint8_t *buff; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + + buff =open_package_file (res->filename); +if (!buff) +return ; + + ret =i40e_process_package (res->port_id, buff); +if (ret <0 ) +printf ("Failed to write profile.\n" ); + +close_package_file (buff); +} + +cmdline_parse_inst_t cmd_write_ppp = { + .f = cmd_write_ppp_parsed, + .data =NULL , + .help_str ="write ppp <port_id> <profile_name>" , + .tokens = { + (void *)&cmd_write_ppp_write, + (void *)&cmd_write_ppp_ppp, + (void *)&cmd_write_ppp_port_id, + (void *)&cmd_write_ppp_filename, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */ @@ -12570,6 +12626,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, + (cmdline_parse_inst_t *)&cmd_write_ppp, NULL, };app/test-pmd/config.c +62
-0@@ -3245,3 +3245,65 @@ port_dcb_info_display(uint8_t port_id)printf ("\t%4d" , dcb_info.tc_queue.tc_txq[0 ][i].nb_queue);printf ("\n" ); } + +uint8_t * +open_package_file (const char *file_path) +{ +FILE *fh =fopen (file_path,"rb" ); +uint32_t pkg_size; +uint8_t *buf =NULL ; +int ret =0 ; + +if (fh ==NULL ) { +printf ("%s: Failed to open %s\n" , __func__, file_path); +return buf; + } + + ret =fseek (fh,0 ,SEEK_END ); +if (ret <0 ) { +fclose (fh); +printf ("%s: File operations failed\n" , __func__); +return buf; + } + + pkg_size =ftell (fh); + + buf = (uint8_t *)malloc (pkg_size); +if (!buf) { +fclose (fh); +printf ("%s: Failed to malloc memory\n" , __func__); +return buf; + } + + ret =fseek (fh,0 ,SEEK_SET ); +if (ret <0 ) { +fclose (fh); +printf ("%s: File operations failed\n" , __func__); +close_package_file (buf); +return NULL ; + } +fread (buf,1 , pkg_size, fh); + +for (uint32_t i =0 ; i < pkg_size; i++) { +if (!(i %16 )) +printf (" " ); +printf (" 0x%02X," , buf[i]); +if (!((i +1 ) %16 )) +printf ("\n" ); + } + +fclose (fh); + +return buf; +} + +int +close_package_file (uint8_t *buf) +{ +if (buf) { +free ((void *)buf); +return 0 ; + } + +return -1 ; +}app/test-pmd/testpmd.h +3
-0@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);void mcast_addr_remove (uint8_t port_id,struct ether_addr *mc_addr);void port_dcb_info_display (uint8_t port_id); +uint8_t *open_package_file (const char *file_path); +int close_package_file (uint8_t *buf); +enum print_warning {ENABLED_WARN =0 ,DISABLED_WARN drivers/net/i40e/base/i40e_adminq_cmd.h +32
-0@@ -198,6 +198,10 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_add_mirror_rule =0x0260 , i40e_aqc_opc_delete_mirror_rule =0x0261 , +/* Support Pipeline Personalization Profile */ + i40e_aqc_opc_write_personalization_profile =0x0270 , + i40e_aqc_opc_get_personalization_profile_list =0x0271 , +/* DCB commands */ i40e_aqc_opc_dcb_ignore_pfc =0x0301 , i40e_aqc_opc_dcb_updated = 0x0302,@@ -1441,6 +1445,34 @@ struct i40e_aqc_add_delete_mirror_rule_completion {I40E_CHECK_CMD_LENGTH (i40e_aqc_add_delete_mirror_rule_completion); +/* Pipeline Personalization Profile */ +struct i40e_aqc_write_ppp { +u8 reserved[4 ]; +__le32 profile_track_id; +__le32 addr_high; +__le32 addr_low; +}; + +I40E_CHECK_CMD_LENGTH (i40e_aqc_write_ppp); + +struct i40e_aqc_write_ppp_resp { +__le32 error_offset; +__le32 error_info; +__le32 addr_high; +__le32 addr_low; +}; + +struct i40e_aqc_get_ppp_list { +u8 flags; +#define I40E_AQC_WR_PPP_GET_CONF 0x1 +#define I40E_AQC_WR_PPP_GET_RDPU_CONF 0x2 +u8 reserved[7 ]; +__le32 addr_high; +__le32 addr_low; +}; + +I40E_CHECK_CMD_LENGTH (i40e_aqc_get_ppp_list); +/* DCB 0x03xx*/ /* PFC Ignore (direct 0x0301) drivers/net/i40e/base/i40e_common.c +235
-1@@ -6997,4 +6997,238 @@ enum i40e_status_code i40e_aq_clear_all_wol_filters(struct i40e_hw *hw, status =i40e_asq_send_command (hw, &desc,NULL ,0 , cmd_details);return status; -} +} + +/** +* i40e_aq_write_ppp - Write pipeline personalization profile (ppp) +* @hw: pointer to the hw struct +* @buff: command buffer (size in bytes = buff_size) +* @buff_size: buffer size in bytes +* @track_id: package tracking id +* @error_offset: returns error offset +* @error_info: returns error information +* @cmd_details: pointer to command details structure or NULL +**/ +enum +i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +u16 buff_size,u32 track_id, +u32 *error_offset,u32 *error_info, +struct i40e_asq_cmd_details *cmd_details) +{ +struct i40e_aq_desc desc; +struct i40e_aqc_write_ppp *cmd = + (struct i40e_aqc_write_ppp *)&desc.params.raw; +struct i40e_aqc_write_ppp_resp *resp; +enum i40e_status_code status; + +i40e_fill_default_direct_cmd_desc (&desc, + i40e_aqc_opc_write_personalization_profile); + + desc.flags |=CPU_TO_LE16 (I40E_AQ_FLAG_BUF |I40E_AQ_FLAG_RD ); +if (buff_size >I40E_AQ_LARGE_BUF ) + desc.flags |=CPU_TO_LE16 ((u16 )I40E_AQ_FLAG_LB ); + + desc.datalen =CPU_TO_LE16 (buff_size); + + cmd->profile_track_id =CPU_TO_LE32 (track_id); + + status =i40e_asq_send_command (hw, &desc, buff, buff_size, cmd_details); +if (!status) { + resp = (struct i40e_aqc_write_ppp_resp *)&desc.params.raw; +if (error_offset) + *error_offset =LE32_TO_CPU (resp->error_offset); +if (error_info) + *error_info =LE32_TO_CPU (resp->error_info); + } + +return status; +} + +/** +* i40e_aq_get_ppp_list - Read pipeline personalization profile (ppp) +* @hw: pointer to the hw struct +* @buff: command buffer (size in bytes = buff_size) +* @buff_size: buffer size in bytes +* @cmd_details: pointer to command details structure or NULL +**/ +enum +i40e_status_code i40e_aq_get_ppp_list (struct i40e_hw *hw,void *buff, +u16 buff_size,u8 flags, +struct i40e_asq_cmd_details *cmd_details) +{ +struct i40e_aq_desc desc; +struct i40e_aqc_get_ppp_list *cmd = + (struct i40e_aqc_get_ppp_list *)&desc.params.raw; +enum i40e_status_code status; + +i40e_fill_default_direct_cmd_desc (&desc, + i40e_aqc_opc_get_personalization_profile_list); + +if (buff_size >I40E_AQ_LARGE_BUF ) + desc.flags |=CPU_TO_LE16 ((u16 )I40E_AQ_FLAG_LB ); + desc.datalen =CPU_TO_LE16 (buff_size); + + cmd->flags = flags; + + status =i40e_asq_send_command (hw, &desc, buff, buff_size, cmd_details); + +return status; +} + +/** +* i40e_find_segment_in_package +* @segment_type: the segment type to search for (i.e., SEGMENT_TYPE_I40E) +* @pkg_hdr: pointer to the package header to be searched +* +* This function searches a package file for a particular segment type. On +* success it returns a pointer to the segment header, otherwise it will +* return NULL. +*/ +struct i40e_generic_seg_header * +i40e_find_segment_in_package (u32 segment_type, +struct i40e_package_header *pkg_hdr) +{ +struct i40e_generic_seg_header *segment; +u32 i; + +PMD_DRV_LOG (INFO ,"i40e_find_segment_in_package" ); +PMD_DRV_LOG (INFO ,"Package version: %d.%d.%d.%d" , + pkg_hdr->version.major, + pkg_hdr->version.minor, + pkg_hdr->version.update, + pkg_hdr->version.draft); + +/* Search all package segments for the requested segment type */ +for (i =0 ; i < pkg_hdr->segment_count; i++) { + segment = + (struct i40e_generic_seg_header *)((u8 *)pkg_hdr + + pkg_hdr->segment_offset[i]); + +if (segment->type == segment_type) +return segment; + } + +return NULL ; +} + +/** +* i40e_write_profile +* @hw: pointer to the hardware structure +* @profile: pointer to the profile segment of the package to be downloaded +* @track_id: package tracking id +* +* Handles the download of a complete package. +*/ +enum i40e_status_code +i40e_write_profile (struct i40e_hw *hw,struct i40e_profile_segment *profile, +u32 track_id) +{ +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_section_table *sec_tbl; +struct i40e_profile_section_header *sec =NULL ; +u32 dev_cnt; +u32 vendor_dev_id; +u32 *nvm; +u32 section_size =0 ; +u32 offset =0 , info =0 ; +u32 i; + +PMD_DRV_LOG (INFO ,"i40e_write_profile" ); +PMD_DRV_LOG (INFO ,"Segment version: %d.%d.%d.%d" , + profile->header.version.major, + profile->header.version.minor, + profile->header.version.update, + profile->header.version.draft); +PMD_DRV_LOG (INFO ,"Seg: type 0x%X, size %d, name %s" , +LE32_TO_CPU (profile->header.type), +LE32_TO_CPU (profile->header.size), + profile->header.name); + +if (!track_id) { +PMD_DRV_LOG (ERR ,"Track_id can't be 0." ); +return I40E_NOT_SUPPORTED ; + } + + dev_cnt = profile->device_table_count; + +for (i =0 ; i < dev_cnt; i++) { + vendor_dev_id = profile->device_table[i].vendor_dev_id; +if ((vendor_dev_id >>16 ) ==I40E_INTEL_VENDOR_ID ) +if (hw->device_id == (vendor_dev_id &0xFFFF )) +break ; + } +if (i == dev_cnt) { +PMD_DRV_LOG (ERR ,"Device doesn't support PPP" ); +return I40E_ERR_DEVICE_NOT_SUPPORTED ; + } + + nvm = (u32 *)&profile->device_table[dev_cnt]; + sec_tbl = (struct i40e_section_table *)&nvm[nvm[0 ] +1 ]; + +for (i =0 ; i < sec_tbl->section_count; i++) { + sec = (struct i40e_profile_section_header *)((u8 *)profile + + sec_tbl->section_offset[i]); + +/* Skip 'AQ', 'note' and 'name' sections */ +if (sec->section.type !=SECTION_TYPE_MMIO ) +continue ; + + section_size = sec->section.size + +sizeof (struct i40e_profile_section_header ); + +/* Write profile */ + status =i40e_aq_write_ppp (hw, (void *)sec, (u16 )section_size, + track_id, &offset, &info,NULL ); +if (status) { +PMD_DRV_LOG (ERR ,"Failed to write profile: " +"offset %d, info %d" , + offset, info); +break ; + } + } + +return status; +} + +/** +* i40e_add_pinfo_to_list +* @hw: pointer to the hardware structure +* @profile: pointer to the profile segment of the package +* @profile_info_sec: buffer for information section +* @track_id: package tracking id +* +* Register a profile to the list of loaded profiles. +*/ +enum i40e_status_code +i40e_add_pinfo_to_list (struct i40e_hw *hw, +struct i40e_profile_segment *profile, +u8 *profile_info_sec,u32 track_id) +{ +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec =NULL ; +struct i40e_profile_info *pinfo; +u32 offset =0 , info =0 ; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; + pinfo->version = profile->version; + pinfo->op =I40E_PPP_ADD_TRACKID ; +memcpy (pinfo->name, profile->name,I40E_PPP_NAME_SIZE ); + + status =i40e_aq_write_ppp (hw, (void *)sec, sec->data_end, + track_id, &offset, &info,NULL ); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add to list: " +"offset %d, info %d" , + offset, info); + +return status; +}drivers/net/i40e/base/i40e_prototype.h +17
-0@@ -555,4 +555,21 @@ enum i40e_status_code i40e_write_phy_register(struct i40e_hw *hw,u8 i40e_get_phy_address (struct i40e_hw *hw,u8 dev_num);enum i40e_status_code i40e_blink_phy_link_led (struct i40e_hw *hw,u32 time,u32 interval); +enum i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +u16 buff_size,u32 track_id, +u32 *error_offset,u32 *error_info, +struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code i40e_aq_get_ppp_list (struct i40e_hw *hw,void *buff, +u16 buff_size,u8 flags, +struct i40e_asq_cmd_details *cmd_details); +struct i40e_generic_seg_header * +i40e_find_segment_in_package (u32 segment_type, +struct i40e_package_header *pkg_header); +enum i40e_status_code +i40e_write_profile (struct i40e_hw *hw,struct i40e_profile_segment *i40e_seg, +u32 track_id); +enum i40e_status_code +i40e_add_pinfo_to_list (struct i40e_hw *hw, +struct i40e_profile_segment *profile, +u8 *profile_info_sec,u32 track_id);#endif /* _I40E_PROTOTYPE_H_ */ drivers/net/i40e/base/i40e_type.h +79
-0@@ -1878,4 +1878,83 @@ struct i40e_lldp_variables {#define I40E_FLEX_56_MASK (0x1ULL << I40E_FLEX_56_SHIFT)#define I40E_FLEX_57_SHIFT 6#define I40E_FLEX_57_MASK (0x1ULL << I40E_FLEX_57_SHIFT) + +/* Version format for PPP */ +struct i40e_ppp_version { +u8 major; +u8 minor; +u8 update; +u8 draft; +}; + +#define I40E_PPP_NAME_SIZE 32 + +/* Package header */ +struct i40e_package_header { +struct i40e_ppp_version version; +u32 segment_count; +u32 segment_offset[1 ]; +}; + +/* Generic segment header */ +struct i40e_generic_seg_header { +#define SEGMENT_TYPE_METADATA 0x00000001 +#define SEGMENT_TYPE_NOTES 0x00000002 +#define SEGMENT_TYPE_I40E 0x00000011 +#define SEGMENT_TYPE_X722 0x00000012 +u32 type; +struct i40e_ppp_version version; +u32 size; +char name[I40E_PPP_NAME_SIZE ]; +}; + +struct i40e_metadata_segment { +struct i40e_generic_seg_header header; +struct i40e_ppp_version version; +u32 track_id; +char name[I40E_PPP_NAME_SIZE ]; +}; + +struct i40e_device_id_entry { +u32 vendor_dev_id; +u32 sub_vendor_dev_id; +}; + +struct i40e_profile_segment { +struct i40e_generic_seg_header header; +struct i40e_ppp_version version; +char name[I40E_PPP_NAME_SIZE ]; +u32 device_table_count; +struct i40e_device_id_entry device_table[1 ]; +}; + +struct i40e_section_table { +u32 section_count; +u32 section_offset[1 ]; +}; + +struct i40e_profile_section_header { +u16 tbl_size; +u16 data_end; +struct { +#define SECTION_TYPE_INFO 0x0000010 +#define SECTION_TYPE_MMIO 0x0000800 +#define SECTION_TYPE_AQ 0x0000801 +#define SECTION_TYPE_NOTE 0x8000000 +#define SECTION_TYPE_NAME 0x8000001 +u32 type; +u32 offset; +u32 size; + } section; +}; + +struct i40e_profile_info { +u32 track_id; +struct i40e_ppp_version version; +u8 op; +#define I40E_PPP_ADD_TRACKID 0x01 +#define I40E_PPP_REMOVE_TRACKID 0x02 +u8 reserved[7 ]; +u8 name[I40E_PPP_NAME_SIZE ]; +};#endif /* _I40E_TYPE_H_ */ drivers/net/i40e/i40e_ethdev.c +68
-0@@ -39,6 +39,10 @@#include <stdarg.h> #include <inttypes.h> #include <assert.h> +#include <sys/stat.h> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> #include <rte_string_fns.h> #include <rte_pci.h> @@ -11212,3 +11216,67 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,return 0 ; } + +/** +* i40e_process_package - Load package +* @port: port id +* @buff: buffer of package +**/ +int +i40e_process_package (uint8_t port,uint8_t *buff) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port]; +struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +enum i40e_status_code status; + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_METADATA , + pkg_hdr); +if (!metadata_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find metadata segment header" ); +return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment *)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_I40E , + pkg_hdr); +if (!profile_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find profile segment header" ); +return -EINVAL ; + } + +/* Write profile to HW */ + status =i40e_write_profile (hw, + (struct i40e_profile_segment *)profile_seg_hdr, + track_id); +if (!status) +printf ("Write profile successfully.\n" ); + +/* Add the profile info to the list of loaded profiles */ + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); + status =i40e_add_pinfo_to_list (hw, + (struct i40e_profile_segment *)profile_seg_hdr, + profile_info_sec, track_id); +if (!status) +printf ("Add profile info successfully.\n" ); + +rte_free (profile_info_sec); + +return status; +}drivers/net/i40e/rte_pmd_i40e.h +1
-0@@ -332,4 +332,5 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,int rte_pmd_i40e_reset_vf_stats (uint8_t port,uint16_t vf_id); +int i40e_process_package (uint8_t port,uint8_t *buff);#endif /* _PMD_I40E_H_ */ Signature · 1 line
2.5.5
Re: [PATCH] ppp implemantation
Quoted 6 lines · Bruce Richardson
Given that this patch is not about point-to-point protocol, i.e. the best-known expansion of "PPP", I think you need to clarify the acronym in the commit message, at minimum, if not also in the commit title.
/Bruce
Never mind, I see your updated patchset has already been sent with better titles.
/Bruce
Quoted 14 lines · Beilei Xing
Quoted 13 lines
Signed-off-by Beilei Xing <[email protected]>--- app/test-pmd/cmdline.c | 57 ++++++++ app/test-pmd/config.c | 62 +++++++++ app/test-pmd/testpmd.h | 3 + drivers/net/i40e/base/i40e_adminq_cmd.h | 32 +++++ drivers/net/i40e/base/i40e_common.c | 236 +++++++++++++++++++++++++++++++- drivers/net/i40e/base/i40e_prototype.h | 17 +++ drivers/net/i40e/base/i40e_type.h | 79 +++++++++++ drivers/net/i40e/i40e_ethdev.c | 68 +++++++++ drivers/net/i40e/rte_pmd_i40e.h | 1 + 9 files changed, 554 insertions(+), 1 deletion(-)
Re: [PATCH v2 0/5] net/i40e: support pipeline personalization profile
In reply to Beilei XingQuoted 2 lines · Beilei Xing
Add APIs and driver to support load/get
i40e PPP (Pipeline Personalization Profile)
Can you please describe what is "Pipeline Personalisation Profile" is? If possible please provide some links to documents. And please feel free to update NIC document about these details.
What are the use cases, what are the benefits of this feature?
And can you please update release notes to announce about added feature?
Quoted 11 lines
since PPP will be supported from FVL6 NVM.
v2 change:
Correct patch num.Beilei Xing (5):
net/i40e: support pipeline personalization profile net/i40e: add ppp processing
app/testpmd: add command for writing personalization profile net/i40e: add get all loaded profiles
app/testpmd: add command for getting loaded profiles
<...>
Re: [PATCH v2 1/5] net/i40e: support pipeline personalization profile
In reply to Beilei XingQuoted 2 lines · Beilei Xing
Add admin queue functions for Pipeline Personalization Profile AQ commands defined in DCR 287:
You can drop DCR reference here.
Quoted 5 lines
- Write Recipe Command buffer (Opcode:
0x0270)
- Get Applied Profiles list (Opcode:0x0271)
This patch will be moved to base driver in future.Signed-off-by Beilei Xing <[email protected]>
<...>
Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +6
-0+ +/** +* i40e_aq_write_ppp - Write pipeline personalization profile (ppp) +* @hw: pointer to the hw struct +* @buff: command buffer (size in bytes = buff_size) +* @buff_size: buffer size in bytes
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port, · line 11237
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+* @track_id: package tracking id +* @error_offset: returns error offset +* @error_info: returns error information +* @cmd_details: pointer to command details structure or NULL +**/ +enum +i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +uint16_t buff_size,uint32_t track_id, +uint32_t *error_offset,uint32_t *error_info, +struct i40e_asq_cmd_details *cmd_details)
Is there a reason to not make these functions "static" ?
What do you think making function calls more consistent, below is "i40e_aq_get_ppp_list", so thi can be "i40e_aq_ppp_write"
And since this is NIC driver, ppp cane be confused with "Point-to-Point Protocol", is there any possible abbreviation or capitalization to prevent confusion?
<...>
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port, · line 11311
Quoted 12 lines
drivers/net/i40e/i40e_ethdev.c +12
-0+/** +* i40e_find_segment_in_package +* @segment_type: the segment type to search for (i.e., SEGMENT_TYPE_I40E) +* @pkg_hdr: pointer to the package header to be searched +* +* This function searches a package file for a particular segment type. On +* success it returns a pointer to the segment header, otherwise it will +* return NULL. +*/ +struct i40e_generic_seg_header * +i40e_find_segment_in_package (uint32_t segment_type, +struct i40e_package_header *pkg_hdr)
This function name is also generic, what segment, what package. if this is related to the ppp, please use relevant function name.
<...>
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port, · line 11346
Quoted 12 lines
drivers/net/i40e/i40e_ethdev.c +12
-0+ +/** +* i40e_write_profile +* @hw: pointer to the hardware structure +* @profile: pointer to the profile segment of the package to be downloaded +* @track_id: package tracking id +* +* Handles the download of a complete package. +*/ +enum i40e_status_code +i40e_write_profile (struct i40e_hw *hw,struct i40e_profile_segment *profile, +uint32_t track_id)
What about having "ppp" in API, like i40e_ppp_write()?
<...>
drivers/net/i40e/i40e_ethdev.h struct i40e_valid_pattern { · line 823
Quoted 7 lines
drivers/net/i40e/i40e_ethdev.h +7
-0+struct i40e_profile_section_header { +uint16_t tbl_size; +uint16_t data_end; +struct { +#define SECTION_TYPE_INFO 0x0000010 +#define SECTION_TYPE_MMIO 0x0000800 +#define SECTION_TYPE_AQ 0x0000801
unaligned
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.h +8
-0+#define SECTION_TYPE_NOTE 0x80000000 +#define SECTION_TYPE_NAME 0x80000001 +uint32_t type; +uint32_t offset; +uint32_t size; + } section; +}; +
<...>
Quoted 11 lines
drivers/net/i40e/i40e_ethdev.h +7
-0@@ -805,6 +915,23 @@ int i40e_dev_tunnel_filter_set(struct i40e_pf *pf,struct rte_eth_tunnel_filter_conf *tunnel_filter, uint8_t add);int i40e_fdir_flush (struct rte_eth_dev *dev); +enum i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +uint16_t buff_size,uint32_t track_id, +uint32_t *error_offset,uint32_t *error_info, +struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code i40e_aq_get_ppp_list (struct i40e_hw *hw,void *buff, +uint16_t buff_size,uint8_t flags, +struct i40e_asq_cmd_details *cmd_details);
drivers/net/i40e/i40e_ethdev.h int i40e_dev_tunnel_filter_set(struct i40e_pf *pf, · line 934
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.h +10
-0+struct i40e_generic_seg_header * +i40e_find_segment_in_package (uint32_t segment_type, +struct i40e_package_header *pkg_header); +enum i40e_status_code +i40e_write_profile (struct i40e_hw *hw,struct i40e_profile_segment *i40e_seg, +uint32_t track_id); +enum i40e_status_code +i40e_add_pinfo_to_list (struct i40e_hw *hw, +struct i40e_profile_segment *profile, +uint8_t *profile_info_sec,uint32_t track_id);
These declarations can go away if you make functions static.
Quoted 4 lines
drivers/net/i40e/i40e_ethdev.h +0
-0#define I40E_DEV_TO_PCI (eth_dev) \ RTE_DEV_TO_PCI((eth_dev)->device)
Re: [PATCH v2 2/5] net/i40e: add ppp processing
In reply to Beilei XingQuoted 6 lines · Beilei Xing
Add loading profile function.
Signed-off-by Beilei Xing <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 59 +++++++++++++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 7 +++++
Also you need to update *version.map file for new API.
<...>
drivers/net/i40e/i40e_ethdev.c i40e_add_pinfo_to_list(struct i40e_hw *hw, · line 11461
Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +3
-0+ +int +i40e_process_package (uint8_t port,uint8_t *buff)
Function name is so generic, please pick another one that associated with ppp.
Also please use defined name_space for public API: rte_pmd_i40e_<...>
drivers/net/i40e/i40e_ethdev.c i40e_add_pinfo_to_list(struct i40e_hw *hw, · line 11463
Quoted 2 lines
drivers/net/i40e/i40e_ethdev.c +2
-0+{ +struct rte_eth_dev *dev = &rte_eth_devices[port];
Now this is public API to user applications, no more driver function, so requires more attention. Input values needs to be verified before using them.
Also you need to check if provided port_id if i40e port id.
<...>
Quoted 6 lines
+/**
+ *i40e_process_package- Load package
+ * @port: port id
+ * @buff: buffer of package
+ **/
Please provide proper doxygen tags, these are causing error.
Quoted 4 lines
drivers/net/i40e/rte_pmd_i40e.h +2
-0+int i40e_process_package (uint8_t port,uint8_t *buff); +#endif /* _PMD_I40E_H_ */
Re: [PATCH v2 3/5] app/testpmd: add command for writing personalization profile
In reply to Beilei XingQuoted 4 lines · Beilei Xing
This patch is to add testpmd CLI for writing personalization profile.
Signed-off-by Beilei Xing <[email protected]>
<...>
Quoted 11 lines
app/test-pmd/cmdline.c +11
-0+static void +cmd_write_ppp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_write_ppp_result *res = parsed_result; +uint8_t *buff; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) {
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_vf_vlan_tag = { · line 12435
Quoted 10 lines
app/test-pmd/cmdline.c +10
-0+printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +if (!all_ports_stopped ()) { +printf ("Please stop all ports first\n" ); +return ; + } + + buff =open_package_file (res->filename);
Can you please update function name to indicate package is ppp package
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_vf_vlan_tag = { · line 12439
Quoted 4 lines
app/test-pmd/cmdline.c +4
-0+if (!buff) +return ; + + ret =i40e_process_package (res->port_id, buff);
What if i40e support not compiled into library?
Quoted 6 lines
app/test-pmd/cmdline.c +6
-0+if (ret <0 ) +printf ("Failed to write profile.\n" ); + +close_package_file (buff); +} +
<...>
Re: [PATCH v2 0/5] net/i40e: support pipeline personalization profile
In reply to Ferruh YigitQuoted 9 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, March 8, 2017 7:43 PM
To: Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 0/5] net/i40e: support pipeline personalization profile
Quoted 7 lines
Quoted 2 lines · Beilei Xing
Add APIs and driver to support load/get i40e PPP (Pipeline Personalization Profile)
Can you please describe what is "Pipeline Personalisation Profile" is? If possible please provide some links to documents. And please feel free to update NIC document about these details.
Due to limited resources of X*710 (parser and analyzer configuration tables, number of packet classification types, number of packet types, filters configuration tables, etc.), it's impossible to simultaneously support all protocols/filters required for different parts on network.
To enable protocols/filters extensions for X*710, new Admin Command for loading user defined configurations is added. PPP is a format of extend configuration for X*710, it allows user to load user defined configuration to X*710.
Actually I have no released doc to share, the documents in my hand are draft and can't be forwarded.
Quoted 2 lines
What are the use cases, what are the benefits of this feature?
List of possible use cases for extended X*710 configuration using profiles could include following:
Configuring Analyzer/Parser to support new protocols, for example:
* IP L2TPv3 tunneling protocol
* IPSec ESP/AH protocols
* MPLSoGRE, MPLSoUDP tunnels
* GTP-C/GTP-U tunnels
New PCTYPEs for offloading packet classification to X*710. For example:
* new IP Protocol in addition to TCP/UDP/SCTP
* new TCP/UDP subtypes, like TCP SYN, TCP FIN
* new PCTYPE for tunneled packets like GTP-C, GTP-U
New PTYPEs for packets identification, for example:
* MAC, MPLS, IP4, UDP
* MAC, MPLS, MPLS, IP6, TCP
Fixes for NVM configuration, for example:
* list of enabled stat counters to improve throughput
* parser/analyzer configuration for some corner cases
Quoted 2 lines
And can you please update release notes to announce about added feature?
Yes, will update in next version.
Quoted 14 lines
Quoted 12 lines
since PPP will be supported from FVL6 NVM.
v2 change:
Correct patch num.Beilei Xing (5):
net/i40e: support pipeline personalization profile net/i40e: add ppp processing
app/testpmd: add command for writing personalization profile net/i40e: add get all loaded profiles
app/testpmd: add command for getting loaded profiles<...>
Re: [PATCH v2 1/5] net/i40e: support pipeline personalization profile
In reply to Ferruh YigitQuoted 9 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, March 8, 2017 8:07 PM
To: Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/5] net/i40e: support pipeline personalization profile
Quoted 5 lines
Quoted 2 lines · Beilei Xing
Add admin queue functions for Pipeline Personalization Profile AQ commands defined in DCR 287:
You can drop DCR reference here.
Sorry as the DCR in my hand is also draft and intel confidential. I will share it if it's released.
Quoted 24 lines
Quoted 6 lines
- Write Recipe Command buffer (Opcode:
0x0270)
- Get Applied Profiles list (Opcode:0x0271) This patch will be moved
to base driver in future.Signed-off-by Beilei Xing <[email protected]><...>
Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +4
-0+ +/** +* i40e_aq_write_ppp - Write pipeline personalization profile (ppp) +* @hw: pointer to the hw struct drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port,
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+* @buff: command buffer (size in bytes = buff_size) +* @buff_size: buffer size in bytes +* @track_id: package tracking id +* @error_offset: returns error offset +* @error_info: returns error information +* @cmd_details: pointer to command details structure or NULL **/ +enum i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void +*buff, +uint16_t buff_size,uint32_t track_id, + uint32_t *error_offset, uint32_t
*error_info,
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ struct i40e_asq_cmd_details *cmd_details)Is there a reason to not make these functions "static" ?
No. In fact, I design the patch in base driver first, and follow the base code style. Agree to use "static" if the function is in PMD.
Quoted 7 lines
What do you think making function calls more consistent, below is "
i40e_aq_get_ppp_list", so thi can be "i40e_aq_ppp_write"And since this is NIC driver, ppp cane be confused with "Point-to-Point Protocol", is there any possible abbreviation or capitalization to prevent confusion?
Yes, will consider about it.
Quoted 13 lines
<...>
Quoted 10 lines
(quoted diff) +10
-0+/** + * i40e_find_segment_in_package + * @segment_type: the segment type to search for (i.e., +SEGMENT_TYPE_I40E) + * @pkg_hdr: pointer to the package header to be searched + * + * This function searches a package file for a particular segment +type. On + * success it returns a pointer to the segment header, otherwise it +will
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port, · line 11311
Quoted 5 lines
+ * return NULL.
+ */drivers/net/i40e/i40e_ethdev.c +3
-0+struct i40e_generic_seg_header * +i40e_find_segment_in_package (uint32_t segment_type, +struct i40e_package_header *pkg_hdr)This function name is also generic, what segment, what package. if this is related to the ppp, please use relevant function name.
OK.
Quoted 16 lines
<...>
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port,
Quoted 12 lines
drivers/net/i40e/i40e_ethdev.c +12
-0+ +/** +* i40e_write_profile +* @hw: pointer to the hardware structure +* @profile: pointer to the profile segment of the package to be +downloaded +* @track_id: package tracking id +* +* Handles the download of a complete package. +*/ +enum i40e_status_code +i40e_write_profile(struct i40e_hw *hw, struct i40e_profile_segment*profile,
Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port, · line 11346
Quoted 1 line
drivers/net/i40e/i40e_ethdev.c +1
-0+ uint32_t track_id)What about having "ppp" in API, like
i40e_ppp_write()?
Seems good.
Quoted 38 lines
<...>
drivers/net/i40e/i40e_ethdev.h struct i40e_valid_pattern { · line 823
Quoted 7 lines
drivers/net/i40e/i40e_ethdev.h +7
-0+struct i40e_profile_section_header { +uint16_t tbl_size; +uint16_t data_end; +struct { +#define SECTION_TYPE_INFO 0x0000010 +#define SECTION_TYPE_MMIO 0x0000800 +#define SECTION_TYPE_AQ 0x0000801unaligned
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.h +8
-0+#define SECTION_TYPE_NOTE 0x80000000 +#define SECTION_TYPE_NAME 0x80000001 +uint32_t type; +uint32_t offset; +uint32_t size; + } section; +}; +<...>
drivers/net/i40e/i40e_ethdev.h int i40e_dev_tunnel_filter_set(struct i40e_pf *pf, · line 918
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.h +1
-0@@ -805,6 +915,23 @@ int i40e_dev_tunnel_filter_set(struct i40e_pf *pf,struct rte_eth_tunnel_filter_conf *tunnel_filter, uint8_t add);int i40e_fdir_flush (struct rte_eth_dev *dev); +enum i40e_status_code i40e_aq_write_ppp(struct i40e_hw *hw, void*buff,
drivers/net/i40e/i40e_ethdev.h int i40e_dev_tunnel_filter_set(struct i40e_pf *pf, · line 921
Quoted 3 lines
drivers/net/i40e/i40e_ethdev.h +3
-0+ uint16_t buff_size, uint32_t track_id, + uint32_t *error_offset, uint32_t *error_info, + struct i40e_asq_cmd_details *cmd_details);enum
i40e_status_codedrivers/net/i40e/i40e_ethdev.h int i40e_dev_tunnel_filter_set(struct i40e_pf *pf, · line 924
Quoted 3 lines
drivers/net/i40e/i40e_ethdev.h +3
-0+i40e_aq_get_ppp_list(struct i40e_hw *hw, void *buff, + uint16_t buff_size, uint8_t flags, + struct i40e_asq_cmd_details *cmd_details);struct
Quoted 12 lines
drivers/net/i40e/i40e_ethdev.h int i40e_dev_tunnel_filter_set(struct i40e_pf *pf, · line 934
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.h +10
-0+i40e_generic_seg_header *i40e_find_segment_in_package (uint32_t +segment_type, +struct i40e_package_header *pkg_header);enum +i40e_status_code i40e_write_profile (struct i40e_hw *hw,struct +i40e_profile_segment *i40e_seg, +uint32_t track_id); +enum i40e_status_code +i40e_add_pinfo_to_list (struct i40e_hw *hw, +struct i40e_profile_segment *profile, +uint8_t *profile_info_sec,uint32_t track_id);These declarations can go away if you make functions static.
Yes.
Quoted 5 lines
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.h +0
-0#define I40E_DEV_TO_PCI (eth_dev) \ RTE_DEV_TO_PCI((eth_dev)->device)
v3 cover pipeline personalization profile support
In reply to Beilei XingDue to limited resources of X*710 (parser and analyzer configuration tables, number of packet classification types, number of packet types, filters configuration tables, etc.), it's impossible to simultaneously support all protocols/filters required for different parts on network. To enable protocols/filters extensions for X*710, new Admin Command for loading user defined configurations is added.
PPP is a format of extend configuration for X*710, it allows user to load user defined configuration to X*710.
List of possible use cases for extended X*710 configuration using profiles could include following:
Configuring Analyzer/Parser to support new protocols, e.g.
- IP L2TPv3 tunneling protocol
- IPSec ESP/AH protocols
- MPLSoGRE, MPLSoUDP tunnels
- GTP-C/GTP-U tunnels
New PCTYPEs for offloading packet classification to X*710. e.g.
- new IP Protocol in addition to TCP/UDP/SCTP
- new TCP/UDP subtypes, like TCP SYN, TCP FIN
- new PCTYPE for tunneled packets like GTP-C, GTP-U
New PTYPEs for packets identification, e.g.
- MAC, MPLS, IP4, UDP
- MAC, MPLS, MPLS, IP6, TCP
Fixes for NVM configuration, e.g.
- list of enabled stat counters to improve throughput
- parser/analyzer configuration for some corner cases
Beilei Xing (5):
net/i40e: add pipeline personalization profile processing app/testpmd: add command for loading a profile net/i40e: add get all loaded profiles app/testpmd: add command for getting loaded profiles
doc: add pipeline personalization profile support for i40e
app/test-pmd/cmdline.c | 163 +++++++++++++++++++++ app/test-pmd/config.c | 67 +++++++++ app/test-pmd/testpmd.h | 25 ++++ doc/guides/rel_notes/release_17_05.rst | 4 + drivers/net/i40e/i40e_ethdev.c | 228 ++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 5 + drivers/net/i40e/rte_pmd_i40e.h | 32 +++++ drivers/net/i40e/rte_pmd_i40e_version.map | 7 + 8 files changed, 531 insertions(+)
Signature · 1 line
2.5.5
PATCH v3 1/5 net/i40e: add pipeline personalization profile processing
Add support for adding or removing a pipeline personalization profile package.
--- app/test-pmd/cmdline.c | 1 + drivers/net/i40e/i40e_ethdev.c | 200 ++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 5 + drivers/net/i40e/rte_pmd_i40e.h | 21 ++++ drivers/net/i40e/rte_pmd_i40e_version.map | 6 + 5 files changed, 233 insertions(+)
app/test-pmd/cmdline.c +1 -0
@@ -37,6 +37,7 @@#include <stdio.h> #include <stdint.h> #include <stdarg.h> +#include <stdbool.h> #include <string.h> #include <termios.h> #include <unistd.h>
drivers/net/i40e/i40e_ethdev.c +200 -0
203 lines not on this page · raw message
drivers/net/i40e/i40e_ethdev.h +5 -0
@@ -730,6 +730,11 @@ struct i40e_valid_pattern {parse_filter_t parse_filter; }; +struct i40e_profile_list { +uint32_t p_count; +struct i40e_profile_info p_info[1 ]; +}; +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,
drivers/net/i40e/rte_pmd_i40e.h +21 -0
@@ -332,4 +332,25 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,int rte_pmd_i40e_reset_vf_stats (uint8_t port,uint16_t vf_id); +/** +* Load/Unload a ppp package +* +* @param port +* The port identifier of the Ethernet device. +* @param buff +* buffer of package. +* @param size +* size of buffer. +* @param add +* - (1) load profile. +* - (0) remove profile. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +* - (1) if profile exists. +*/ +int rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +6 -0
@@ -22,3 +22,9 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_tag; } DPDK_2.0; + +DPDK_17.05 { + global: + + rte_pmd_i40e_process_ppp_package; +};
Signature · 1 line
2.5.5
PATCH v3 2/5 app/testpmd: add command for loading a profile
In reply to Beilei XingThis patch is to add testpmd CLI for loading a pipeline personalization profile.
--- app/test-pmd/cmdline.c | 73 +++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 67 +++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 3 ++ drivers/net/i40e/rte_pmd_i40e.h | 1 - 4 files changed, 143 insertions(+), 1 deletion(-)
app/test-pmd/cmdline.c +73 -0
@@ -579,6 +579,9 @@ static void cmd_help_long_parsed(void *parsed_result,"E-tag set filter del e-tag-id (value) port (port_id)\n" " Delete an E-tag forwarding filter on a port\n\n" +"add ppp (port_id) (profile_path)\n" +" Load a profile package on a port\n\n" + ,list_pkt_forwarding_modes () ); }
@@ -12402,6 +12405,75 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = { }, }; +/* Load Pipeline Personalization Profile */ +struct cmd_add_ppp_result { +cmdline_fixed_string_t add; +cmdline_fixed_string_t ppp; +uint8_t port_id; +char filepath[]; +}; + +cmdline_parse_token_string_t cmd_add_ppp_add = + TOKEN_STRING_INITIALIZER(struct cmd_add_ppp_result, add, "add"); +cmdline_parse_token_string_t cmd_add_ppp_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_add_ppp_result, ppp, "ppp"); +cmdline_parse_token_num_t cmd_add_ppp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_add_ppp_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_add_ppp_filepath = + TOKEN_STRING_INITIALIZER(struct cmd_add_ppp_result, filepath, NULL); + +static void +cmd_add_ppp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_add_ppp_result *res = parsed_result; +uint8_t *buff; +uint32_t size; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +if (!all_ports_stopped ()) { +printf ("Please stop all ports first\n" ); +return ; + } + + buff =open_ppp_package_file (res->filepath, &size); +if (!buff) +return ; + +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) { + ret =rte_pmd_i40e_process_ppp_package (res->port_id, + buff, size,1 ); +if (ret <0 ) +printf ("Failed to load profile.\n" ); +else if (ret >0 ) +printf ("Profile has already existed.\n" ); + } +#endif + +close_ppp_package_file (buff); +} + +cmdline_parse_inst_t cmd_add_ppp = { + .f = cmd_add_ppp_parsed, + .data =NULL , + .help_str ="add/remove ppp <port_id> <profile_path>" , + .tokens = { + (void *)&cmd_add_ppp_add, + (void *)&cmd_add_ppp_ppp, + (void *)&cmd_add_ppp_port_id, + (void *)&cmd_add_ppp_filepath, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -12577,6 +12649,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, + (cmdline_parse_inst_t *)&cmd_add_ppp, NULL, };
app/test-pmd/config.c +67 -0
70 lines not on this page · raw message
app/test-pmd/testpmd.h +3 -0
@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);void mcast_addr_remove (uint8_t port_id,struct ether_addr *mc_addr);void port_dcb_info_display (uint8_t port_id); +uint8_t *open_ppp_package_file (const char *file_path,uint32_t *size); +int close_ppp_package_file (uint8_t *buf); +enum print_warning {ENABLED_WARN =0 ,DISABLED_WARN
drivers/net/i40e/rte_pmd_i40e.h +0 -1
@@ -352,5 +352,4 @@ int rte_pmd_i40e_reset_vf_stats(uint8_t port,*/ int rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff,uint32_t size,bool add); -#endif /* _PMD_I40E_H_ */
Signature · 1 line
2.5.5
PATCH v3 3/5 net/i40e: add get all loaded profiles
In reply to Beilei XingThis patch is to add get all loaded profiles function.
--- drivers/net/i40e/i40e_ethdev.c | 28 ++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 12 ++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 41 insertions(+)
drivers/net/i40e/i40e_ethdev.c +28 -0
@@ -11260,6 +11260,9 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,return 0 ; } +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + static void i40e_generate_profile_info_sec(char *name, struct i40e_ppp_version *version, uint32_t track_id, uint8_t *profile_info_sec,
@@ -11459,3 +11462,28 @@ rte_pmd_i40e_process_ppp_package(uint8_t port, uint8_t *buff,rte_free (profile_info_sec);return status; } + +int +rte_pmd_i40e_get_ppp_list (uint8_t port,uint8_t *buff,uint32_t size) +{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + +if (size < (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 )) +return -EINVAL ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + + status =i40e_aq_get_ppp_list (hw, (void *)buff, + size,0 ,NULL ); + +return status; +}
drivers/net/i40e/rte_pmd_i40e.h +12 -0
@@ -352,4 +352,16 @@ int rte_pmd_i40e_reset_vf_stats(uint8_t port,*/ int rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff,uint32_t size,bool add); + +/** +* rte_pmd_i40e_get_ppp_list - Get loaded profile list +* @port: port id +* @buff: buffer for response +* @size: buffer size +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_get_ppp_list (uint8_t port,uint8_t *buff,uint32_t size);#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -27,4 +27,5 @@ DPDK_17.05 { global: rte_pmd_i40e_process_ppp_package; + rte_pmd_i40e_get_ppp_list; };
Signature · 1 line
2.5.5
PATCH v3 4/5 app/testpmd: add command for getting loaded profiles
In reply to Beilei XingThis patch is to add testpmd CLI for getting all loaded profiles.
--- app/test-pmd/cmdline.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 22 +++++++++++++ 2 files changed, 111 insertions(+)
app/test-pmd/cmdline.c +89 -0
@@ -215,6 +215,9 @@ static void cmd_help_long_parsed(void *parsed_result,"read txd (port_id) (queue_id) (txd_id)\n" " Display a TX descriptor of a port TX queue.\n\n" + +"get ppp list (port_id)\n" +" Get ppp profile info list\n\n" ); }
@@ -12474,6 +12477,91 @@ cmdline_parse_inst_t cmd_add_ppp = { }, }; +/* Get Pipeline Personalization Profile list*/ +#define PROFILE_INFO_SIZE 48 +#define MAX_PROFILE_NUM 16 + +struct cmd_get_ppp_list_result { +cmdline_fixed_string_t get; +cmdline_fixed_string_t ppp; +cmdline_fixed_string_t list; +uint8_t port_id; +}; + +cmdline_parse_token_string_t cmd_get_ppp_list_get = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, get, "get"); +cmdline_parse_token_string_t cmd_get_ppp_list_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, ppp, "ppp"); +cmdline_parse_token_string_t cmd_get_ppp_list_list = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, list, "list"); +cmdline_parse_token_num_t cmd_get_ppp_list_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_get_ppp_list_result, port_id, UINT8); + +static void +cmd_get_ppp_list_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_get_ppp_list_result *res = parsed_result; +struct profile_list *p_list; +struct profile_info *p_info; +uint32_t p_num; +uint32_t size; +uint32_t i; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + + size =PROFILE_INFO_SIZE *MAX_PROFILE_NUM +4 ; + p_list = (struct profile_list *)malloc (size); +if (!p_list) +printf ("%s: Failed to malloc buffer\n" , __func__); + +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) { + ret =rte_pmd_i40e_get_ppp_list (res->port_id, + (uint8_t *)p_list, size); +if (ret <0 ) +printf ("Failed to get ppp list\n" ); + } +#endif + +if (!ret) { + p_num = p_list->p_count; +printf ("Profile number is: %d\n\n" , p_num); + +for (i =0 ; i < p_num; i++) { + p_info = &p_list->p_info[i]; +printf ("Profile %d:\n" , i); +printf ("Track id: 0x%x\n" , p_info->track_id); +printf ("Version: %d.%d.%d.%d \n" , + p_info->version.major, + p_info->version.minor, + p_info->version.update, + p_info->version.draft); +printf ("Profile name: %s\n\n" , p_info->name); + } + } + +free (p_list); +} + +cmdline_parse_inst_t cmd_get_ppp_list = { + .f = cmd_get_ppp_list_parsed, + .data =NULL , + .help_str ="get ppp list <port_id>" , + .tokens = { + (void *)&cmd_get_ppp_list_get, + (void *)&cmd_get_ppp_list_ppp, + (void *)&cmd_get_ppp_list_list, + (void *)&cmd_get_ppp_list_port_id, +NULL , + }, +};/* ******************************************************************************** */ /* list of instructions */
@@ -12650,6 +12738,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, (cmdline_parse_inst_t *)&cmd_add_ppp, + (cmdline_parse_inst_t *)&cmd_get_ppp_list, NULL, };
app/test-pmd/testpmd.h +22 -0
@@ -97,6 +97,28 @@ struct pkt_burst_stats { };#endif +#ifdef RTE_LIBRTE_I40E_PMD +#define PPP_NAME_SIZE 32 +struct ppp_version { +uint8_t major; +uint8_t minor; +uint8_t update; +uint8_t draft; +}; + +struct profile_info { +uint32_t track_id; +struct ppp_version version; +uint8_t reserved[8 ]; +uint8_t name[PPP_NAME_SIZE ]; +}; + +struct profile_list { +uint32_t p_count; +struct profile_info p_info[1 ]; +}; +#endif +/** * The data structure associated with a forwarding stream between a receive * port/queue and a transmit port/queue.
Signature · 1 line
2.5.5
PATCH v3 5/5 doc: add pipeline personalization profile support for i40e
In reply to Beilei Xing--- doc/guides/rel_notes/release_17_05.rst | 4 ++++ 1 file changed, 4 insertions(+)
doc/guides/rel_notes/release_17_05.rst +4 -0
@@ -85,6 +85,10 @@ New Features Data Ring, ability to register memory regions. +* **Added pipeline personalization profile support for i40e.** + + * Added loading pipeline personalization profile to i40e FW. + Resolved Issues ---------------
Signature · 1 line
2.5.5
Re: [PATCH v3 1/5] net/i40e: add pipeline personalization profile processing
In reply to Beilei XingHi Beilei,
Quoted 117 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Beilei Xing
Sent: Thursday, March 23, 2017 10:02 AM
To: Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v3 1/5] net/i40e: add pipeline personalization profile processingAdd support for adding or removing a pipeline personalization profile package.
Signed-off-by Beilei Xing <[email protected]>--- app/test-pmd/cmdline.c | 1 + drivers/net/i40e/i40e_ethdev.c | 200 ++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 5 + drivers/net/i40e/rte_pmd_i40e.h | 21 ++++ drivers/net/i40e/rte_pmd_i40e_version.map | 6 + 5 files changed, 233 insertions(+)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-047f935d..6e0625d 100644
app/test-pmd/cmdline.c +1
-0@@ -37,6 +37,7 @@#include <stdio.h> #include <stdint.h> #include <stdarg.h> +#include <stdbool.h> #include <string.h> #include <termios.h> #include <unistd.h> drivers/net/i40e/i40e_ethdev.c +3
-0@@ -11259,3 +11259,203 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,return 0 ; } + +static void +i40e_generate_profile_info_sec(char *name, struct i40e_ppp_version*version,
drivers/net/i40e/i40e_ethdev.c +54
-0+ uint32_t track_id, uint8_t *profile_info_sec, + bool add) +{ + struct i40e_profile_section_header *sec = NULL; +struct i40e_profile_info *pinfo; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; +memcpy (pinfo->name, name,I40E_PPP_NAME_SIZE ); +memcpy (&pinfo->version, version,sizeof (struct i40e_ppp_version )); +if (add) + pinfo->op =I40E_PPP_ADD_TRACKID ; +else + pinfo->op =I40E_PPP_REMOVE_TRACKID ; +} + +static enum i40e_status_code +i40e_add_rm_profile_info (struct i40e_hw *hw,uint8_t *profile_info_sec) +{ +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec; +uint32_t track_id; +uint32_t offset =0 , info =0 ; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + track_id = ((struct i40e_profile_info *)(profile_info_sec + + sec->section.offset))->track_id; + + status =i40e_aq_write_ppp (hw, (void *)sec, sec->data_end, + track_id, &offset, &info,NULL ); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add/remove profile info: " +"offset %d, info %d" , + offset, info); + +return status; +} + +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + +/* Check if the profile info exists */ +static int +i40e_check_profile_info (uint8_t port,uint8_t *profile_info_sec) { +struct rte_eth_dev *dev = &rte_eth_devices[port]; + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-Quoted 1 line
dev_private);drivers/net/i40e/i40e_ethdev.c +7
-0+uint8_t *buff; +struct i40e_profile_list *p_list; +struct i40e_profile_info *pinfo, *p; +int ret; + + buff = rte_zmalloc("i40e_pinfo_list", + (I40E_PROFILE_INFO_SIZE *
I40E_MAX_PROFILE_NUM+ 4),drivers/net/i40e/i40e_ethdev.c +8
-0+ 0); +if (!buff) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return -1 ; + } + + ret = i40e_aq_get_ppp_list(hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM +4),
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port, · line 11344
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+ 0, NULL); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to get profile info list." ); +rte_free (buff); +return -1 ; + } + p_list = (struct i40e_profile_list *)buff; + pinfo = (struct i40e_profile_info *)(profile_info_sec + +sizeof (struct i40e_profile_section_header )); +for (uint32_t i =0 ; i < p_list->p_count; i++) {
There is a compile error in the "for" statement.
dpdk/drivers/net/i40e/i40e_ethdev.c:11561:2: error: 'for' loop initial declarations are only allowed in C99 mode
for (uint32_t i = 0; i < p_list->p_count; i++) {
This is occurring with the following compiler:
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
Quoted 187 lines
drivers/net/i40e/i40e_ethdev.c +55
-0+ p = &p_list->p_info[i]; +if ((pinfo->track_id == p->track_id) && + !memcmp (&pinfo->version, &p->version, +sizeof (struct i40e_ppp_version )) && + !memcmp (&pinfo->name, &p->name, +I40E_PPP_NAME_SIZE )) { +PMD_DRV_LOG (INFO ,"Profile exists." ); +rte_free (buff); +return 1 ; + } + } + +rte_free (buff); +return 0 ; +} + +int +rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add) +{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +int is_exist; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (size < (sizeof (struct i40e_package_header ) + +sizeof (struct i40e_metadata_segment ) + +sizeof (uint32_t ) *2 )) { +PMD_DRV_LOG (ERR ,"Buff is invalid." ); +return -EINVAL ; + } + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +if (pkg_hdr->segment_count <2 ) { + PMD_DRV_LOG(ERR, "Segment_count should be 2 atleast.");
drivers/net/i40e/i40e_ethdev.c +5
-0+return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_METADATA,
drivers/net/i40e/i40e_ethdev.c +3
-0+ pkg_hdr); +if (!metadata_seg_hdr) { + PMD_DRV_LOG(ERR, "Failed to find metadata segmentheader");
drivers/net/i40e/i40e_ethdev.c +7
-0+return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment +*)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_I40E,
drivers/net/i40e/i40e_ethdev.c +3
-0+ pkg_hdr); +if (!profile_seg_hdr) { + PMD_DRV_LOG(ERR, "Failed to find profile segmentheader");
drivers/net/i40e/i40e_ethdev.c +16
-0+return -EINVAL ; + } + + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); +if (!profile_info_sec) { +PMD_DRV_LOG (ERR ,"Failed to allocate memory" ); +return -EINVAL ; + } + +if (add) { + i40e_generate_profile_info_sec( + ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)-Quoted 1 line
version,
drivers/net/i40e/i40e_ethdev.c +11
-0+ track_id, profile_info_sec, 1); + is_exist =i40e_check_profile_info (port, profile_info_sec); +if (is_exist) { +PMD_DRV_LOG (ERR ,"Profile already exists." ); +rte_free (profile_info_sec); +return 1 ; + } + +/* Write profile to HW */ + status = i40e_write_profile(hw, + (struct i40e_profile_segment*)profile_seg_hdr,
drivers/net/i40e/i40e_ethdev.c +7
-0+ track_id); +if (status) +PMD_DRV_LOG (ERR ,"Failed to write profile." ); + }else { + i40e_generate_profile_info_sec( + ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)-Quoted 1 line
version,
drivers/net/i40e/i40e_ethdev.c +11
-0+ track_id, profile_info_sec, 0); + } + + status =i40e_add_rm_profile_info (hw, profile_info_sec); +if (status) +PMD_DRV_LOG (ERR ,"Failed to %s profile info." , + add ?"add" :"remove" ); + +rte_free (profile_info_sec); +return status; +}(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.hindex aebb097..f0be7a3 100644drivers/net/i40e/i40e_ethdev.h +5
-0@@ -730,6 +730,11 @@ struct i40e_valid_pattern {parse_filter_t parse_filter; }; +struct i40e_profile_list { +uint32_t p_count; +struct i40e_profile_info p_info[1 ]; +}; +int i40e_dev_switch_queues (struct i40e_pf *pf,bool on);int
i40e_vsi_release(struct i40e_vsi *vsi); structi40e_vsi*i40e_vsi_setup(structi40e_pf*pf, diff --gita/drivers/net/i40e/rte_pmd_i40e.hb/drivers/net/i40e/rte_pmd_i40e.hindex a0ad88c..7861a56 100644drivers/net/i40e/rte_pmd_i40e.h +21
-0@@ -332,4 +332,25 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port, int rte_pmd_i40e_reset_vf_stats(uint8_t port, uint16_t vf_id); +/** +* Load/Unload a ppp package +* +* @param port +* The port identifier of the Ethernet device. +* @param buff +* buffer of package. +* @param size +* size of buffer. +* @param add +* - (1) load profile. +* - (0) remove profile. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +* - (1) if profile exists. +*/ +int rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add); +#endif /* _PMD_I40E_H_ */ drivers/net/i40e/rte_pmd_i40e_version.map +6
-1@@ -22,3 +22,9 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_tag; } DPDK_2.0; + +DPDK_17.05 { + global: + + rte_pmd_i40e_process_ppp_package; +}; --
Quoted 1 line
2.5.5
Regards,
Bernard.
Re: [PATCH v3 1/5] net/i40e: add pipeline personalization profile processing
Hi Bernard,
Quoted 138 lines
-----Original Message-----
From: Iremonger, Bernard
Sent: Thursday, March 23, 2017 10:50 PM
To: Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v3 1/5] net/i40e: add pipeline personalization profile processingHi Beilei,
Quoted 115 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Beilei Xing
Sent: Thursday, March 23, 2017 10:02 AM
To: Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v3 1/5] net/i40e: add pipeline personalization profile processingAdd support for adding or removing a pipeline personalization profile package.
Signed-off-by Beilei Xing <[email protected]>--- app/test-pmd/cmdline.c | 1 + drivers/net/i40e/i40e_ethdev.c | 200 ++++++++++++++++++++++++++++++ drivers/net/i40e/i40e_ethdev.h | 5 + drivers/net/i40e/rte_pmd_i40e.h | 21 ++++ drivers/net/i40e/rte_pmd_i40e_version.map | 6 + 5 files changed, 233 insertions(+)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-047f935d..6e0625d 100644
app/test-pmd/cmdline.c +1
-0@@ -37,6 +37,7 @@#include <stdio.h> #include <stdint.h> #include <stdarg.h> +#include <stdbool.h> #include <string.h> #include <termios.h> #include <unistd.h> (quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 3702214..7aff9a3 100644drivers/net/i40e/i40e_ethdev.c +3
-0@@ -11259,3 +11259,203 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,return 0 ; } + +static void +i40e_generate_profile_info_sec(char *name, struct i40e_ppp_version*version,
drivers/net/i40e/i40e_ethdev.c +52
-0+ uint32_t track_id, uint8_t *profile_info_sec, + bool add) +{ + struct i40e_profile_section_header *sec = NULL; +struct i40e_profile_info *pinfo; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; +memcpy (pinfo->name, name,I40E_PPP_NAME_SIZE ); +memcpy (&pinfo->version, version,sizeof (struct i40e_ppp_version )); +if (add) + pinfo->op =I40E_PPP_ADD_TRACKID ; +else + pinfo->op =I40E_PPP_REMOVE_TRACKID ; } + +static enum i40e_status_code +i40e_add_rm_profile_info (struct i40e_hw *hw,uint8_t +*profile_info_sec) { +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec; +uint32_t track_id; +uint32_t offset =0 , info =0 ; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + track_id = ((struct i40e_profile_info *)(profile_info_sec + + sec->section.offset))->track_id; + + status =i40e_aq_write_ppp (hw, (void *)sec, sec->data_end, + track_id, &offset, &info,NULL ); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add/remove profile info: " +"offset %d, info %d" , + offset, info); + +return status; +} + +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + +/* Check if the profile info exists */ static int +i40e_check_profile_info (uint8_t port,uint8_t *profile_info_sec) { +struct rte_eth_dev *dev = &rte_eth_devices[port]; + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-Quoted 1 line
dev_private);drivers/net/i40e/i40e_ethdev.c +7
-0+uint8_t *buff; +struct i40e_profile_list *p_list; +struct i40e_profile_info *pinfo, *p; +int ret; + + buff = rte_zmalloc("i40e_pinfo_list", + (I40E_PROFILE_INFO_SIZE *
I40E_MAX_PROFILE_NUM+ 4),drivers/net/i40e/i40e_ethdev.c +8
-0+ 0); +if (!buff) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return -1 ; + } + + ret = i40e_aq_get_ppp_list(hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM +4),
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port, · line 11344
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+ 0, NULL); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to get profile info list." ); +rte_free (buff); +return -1 ; + } + p_list = (struct i40e_profile_list *)buff; + pinfo = (struct i40e_profile_info *)(profile_info_sec + +sizeof (struct i40e_profile_section_header )); +for (uint32_t i =0 ; i < p_list->p_count; i++) {There is a compile error in the "for" statement.
Quoted 7 lines
dpdk/drivers/net/i40e/i40e_ethdev.c:11561:2: error: 'for' loop initial declarations are only allowed in C99 mode
for (uint32_ti = 0; i <p_list->p_count; i++) {This is occurring with the following compiler:
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
Thanks, will fix in next version.
Quoted 194 lines
Quoted 189 lines
drivers/net/i40e/i40e_ethdev.c +55
-0+ p = &p_list->p_info[i]; +if ((pinfo->track_id == p->track_id) && + !memcmp (&pinfo->version, &p->version, +sizeof (struct i40e_ppp_version )) && + !memcmp (&pinfo->name, &p->name, +I40E_PPP_NAME_SIZE )) { +PMD_DRV_LOG (INFO ,"Profile exists." ); +rte_free (buff); +return 1 ; + } + } + +rte_free (buff); +return 0 ; +} + +int +rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add) +{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +int is_exist; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (size < (sizeof (struct i40e_package_header ) + +sizeof (struct i40e_metadata_segment ) + +sizeof (uint32_t ) *2 )) { +PMD_DRV_LOG (ERR ,"Buff is invalid." ); +return -EINVAL ; + } + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +if (pkg_hdr->segment_count <2 ) { + PMD_DRV_LOG(ERR, "Segment_count should be 2 atleast.");
drivers/net/i40e/i40e_ethdev.c +5
-0+return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_METADATA,
drivers/net/i40e/i40e_ethdev.c +3
-0+ pkg_hdr); +if (!metadata_seg_hdr) { + PMD_DRV_LOG(ERR, "Failed to find metadata segmentheader");
drivers/net/i40e/i40e_ethdev.c +7
-0+return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment +*)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_I40E,
drivers/net/i40e/i40e_ethdev.c +3
-0+ pkg_hdr); +if (!profile_seg_hdr) { + PMD_DRV_LOG(ERR, "Failed to find profile segmentheader");
drivers/net/i40e/i40e_ethdev.c +16
-0+return -EINVAL ; + } + + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); +if (!profile_info_sec) { +PMD_DRV_LOG (ERR ,"Failed to allocate memory" ); +return -EINVAL ; + } + +if (add) { + i40e_generate_profile_info_sec( + ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)-Quoted 1 line
version,
drivers/net/i40e/i40e_ethdev.c +11
-0+ track_id, profile_info_sec, 1); + is_exist =i40e_check_profile_info (port, profile_info_sec); +if (is_exist) { +PMD_DRV_LOG (ERR ,"Profile already exists." ); +rte_free (profile_info_sec); +return 1 ; + } + +/* Write profile to HW */ + status = i40e_write_profile(hw, + (struct i40e_profile_segment*)profile_seg_hdr,
drivers/net/i40e/i40e_ethdev.c +7
-0+ track_id); +if (status) +PMD_DRV_LOG (ERR ,"Failed to write profile." ); + }else { + i40e_generate_profile_info_sec( + ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)-Quoted 1 line
version,
drivers/net/i40e/i40e_ethdev.c +11
-0+ track_id, profile_info_sec, 0); + } + + status =i40e_add_rm_profile_info (hw, profile_info_sec); +if (status) +PMD_DRV_LOG (ERR ,"Failed to %s profile info." , + add ?"add" :"remove" ); + +rte_free (profile_info_sec); +return status; +}(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.hindex aebb097..f0be7a3 100644drivers/net/i40e/i40e_ethdev.h +5
-0@@ -730,6 +730,11 @@ struct i40e_valid_pattern {parse_filter_t parse_filter; }; +struct i40e_profile_list { +uint32_t p_count; +struct i40e_profile_info p_info[1 ]; +}; +int i40e_dev_switch_queues (struct i40e_pf *pf,bool on);int
i40e_vsi_release(struct i40e_vsi *vsi); structi40e_vsi*i40e_vsi_setup(structi40e_pf*pf, diff --gita/drivers/net/i40e/rte_pmd_i40e.hb/drivers/net/i40e/rte_pmd_i40e.hindex a0ad88c..7861a56 100644drivers/net/i40e/rte_pmd_i40e.h +21
-0@@ -332,4 +332,25 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port, int rte_pmd_i40e_reset_vf_stats(uint8_t port, uint16_t vf_id); +/** +* Load/Unload a ppp package +* +* @param port +* The port identifier of the Ethernet device. +* @param buff +* buffer of package. +* @param size +* size of buffer. +* @param add +* - (1) load profile. +* - (0) remove profile. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +* - (1) if profile exists. +*/ +int rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add); +#endif /* _PMD_I40E_H_ */ drivers/net/i40e/rte_pmd_i40e_version.map +6
-1@@ -22,3 +22,9 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_tag; } DPDK_2.0; + +DPDK_17.05 { + global: + + rte_pmd_i40e_process_ppp_package; +}; --Quoted 1 line
2.5.5
Regards,
Bernard.
v4 cover pipeline personalization profile support
In reply to Beilei XingDue to limited resources of X*710 (parser and analyzer configuration tables, number of packet classification types, number of packet types, filters configuration tables, etc.), it's impossible to simultaneously support all protocols/filters required for different parts on network. To enable protocols/filters extensions for X*710, new Admin Command for loading user defined configurations is added.
PPP is a format of extend configuration for X*710, it allows user to load user defined configuration to X*710.
List of possible use cases for extended X*710 configuration using profiles could include following:
Configuring Analyzer/Parser to support new protocols, e.g.
- IP L2TPv3 tunneling protocol
- IPSec ESP/AH protocols
- MPLSoGRE, MPLSoUDP tunnels
- GTP-C/GTP-U tunnels
New PCTYPEs for offloading packet classification to X*710. e.g.
- new IP Protocol in addition to TCP/UDP/SCTP
- new TCP/UDP subtypes, like TCP SYN, TCP FIN
- new PCTYPE for tunneled packets like GTP-C, GTP-U
New PTYPEs for packets identification, e.g.
- MAC, MPLS, IP4, UDP
- MAC, MPLS, MPLS, IP6, TCP
Fixes for NVM configuration, e.g.
- list of enabled stat counters to improve throughput
- parser/analyzer configuration for some corner cases
v4 changes:
Fix compile error with gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3). Move ppp related structures to rte_pmd_i40e.h.
Not support remove PPP temporarily.
v3 changes:
Move ppp AQ command code to base code.
Beilei Xing (5):
net/i40e: add pipeline personalization profile processing app/testpmd: add command for loading a profile net/i40e: add get all loaded profiles app/testpmd: add command for getting loaded profiles
doc: add pipeline personalization profile support for i40e
app/test-pmd/cmdline.c | 165 ++++++++++++++++++++++ app/test-pmd/config.c | 67 +++++++++ app/test-pmd/testpmd.h | 3 + doc/guides/rel_notes/release_17_05.rst | 4 + drivers/net/i40e/i40e_ethdev.c | 226 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 63 +++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 7 + 7 files changed, 535 insertions(+)
Signature · 1 line
2.5.5
PATCH v4 1/5 net/i40e: add pipeline personalization profile processing
Add support for adding a pipeline personalization profile package.
--- app/test-pmd/cmdline.c | 1 + drivers/net/i40e/i40e_ethdev.c | 198 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 51 ++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 6 + 4 files changed, 256 insertions(+)
app/test-pmd/cmdline.c +1 -0
@@ -37,6 +37,7 @@#include <stdio.h> #include <stdint.h> #include <stdarg.h> +#include <stdbool.h> #include <string.h> #include <termios.h> #include <unistd.h>
drivers/net/i40e/i40e_ethdev.c +198 -0
201 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e.h +51 -0
61 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +6 -0
@@ -22,3 +22,9 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_tag; } DPDK_2.0; + +DPDK_17.05 { + global: + + rte_pmd_i40e_process_ppp_package; +};
Signature · 1 line
2.5.5
PATCH v4 2/5 app/testpmd: add command for loading a profile
In reply to Beilei XingThis patch is to add testpmd CLI for loading a pipeline personalization profile.
--- app/test-pmd/cmdline.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 3 +++ 3 files changed, 143 insertions(+)
app/test-pmd/cmdline.c +73 -0
@@ -579,6 +579,9 @@ static void cmd_help_long_parsed(void *parsed_result,"E-tag set filter del e-tag-id (value) port (port_id)\n" " Delete an E-tag forwarding filter on a port\n\n" +"add ppp (port_id) (profile_path)\n" +" Load a profile package on a port\n\n" + ,list_pkt_forwarding_modes () ); }
@@ -12402,6 +12405,75 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = { }, }; +/* Load Pipeline Personalization Profile */ +struct cmd_add_ppp_result { +cmdline_fixed_string_t add; +cmdline_fixed_string_t ppp; +uint8_t port_id; +char filepath[]; +}; + +cmdline_parse_token_string_t cmd_add_ppp_add = + TOKEN_STRING_INITIALIZER(struct cmd_add_ppp_result, add, "add"); +cmdline_parse_token_string_t cmd_add_ppp_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_add_ppp_result, ppp, "ppp"); +cmdline_parse_token_num_t cmd_add_ppp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_add_ppp_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_add_ppp_filepath = + TOKEN_STRING_INITIALIZER(struct cmd_add_ppp_result, filepath, NULL); + +static void +cmd_add_ppp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_add_ppp_result *res = parsed_result; +uint8_t *buff; +uint32_t size; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +if (!all_ports_stopped ()) { +printf ("Please stop all ports first\n" ); +return ; + } + + buff =open_ppp_package_file (res->filepath, &size); +if (!buff) +return ; + +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_process_ppp_package (res->port_id, + buff, size,1 ); +#endif + +if (ret <0 ) +printf ("Failed to load profile.\n" ); +else if (ret >0 ) +printf ("Profile has already existed.\n" ); + +close_ppp_package_file (buff); +} + +cmdline_parse_inst_t cmd_add_ppp = { + .f = cmd_add_ppp_parsed, + .data =NULL , + .help_str ="add/remove ppp <port_id> <profile_path>" , + .tokens = { + (void *)&cmd_add_ppp_add, + (void *)&cmd_add_ppp_ppp, + (void *)&cmd_add_ppp_port_id, + (void *)&cmd_add_ppp_filepath, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -12577,6 +12649,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, + (cmdline_parse_inst_t *)&cmd_add_ppp, NULL, };
app/test-pmd/config.c +67 -0
70 lines not on this page · raw message
app/test-pmd/testpmd.h +3 -0
@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);void mcast_addr_remove (uint8_t port_id,struct ether_addr *mc_addr);void port_dcb_info_display (uint8_t port_id); +uint8_t *open_ppp_package_file (const char *file_path,uint32_t *size); +int close_ppp_package_file (uint8_t *buf); +enum print_warning {ENABLED_WARN =0 ,DISABLED_WARN
Signature · 1 line
2.5.5
PATCH v4 3/5 net/i40e: add get all loaded profiles
In reply to Beilei XingThis patch is to add get all loaded profiles function.
--- drivers/net/i40e/i40e_ethdev.c | 28 ++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 12 ++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 41 insertions(+)
drivers/net/i40e/i40e_ethdev.c +28 -0
@@ -11260,6 +11260,9 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,return 0 ; } +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + static void i40e_generate_profile_info_sec(char *name, struct i40e_ppp_version *version, uint32_t track_id, uint8_t *profile_info_sec,
@@ -11457,3 +11460,28 @@ rte_pmd_i40e_process_ppp_package(uint8_t port, uint8_t *buff,rte_free (profile_info_sec);return status; } + +int +rte_pmd_i40e_get_ppp_list (uint8_t port,uint8_t *buff,uint32_t size) +{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + +if (size < (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 )) +return -EINVAL ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + + status =i40e_aq_get_ppp_list (hw, (void *)buff, + size,0 ,NULL ); + +return status; +}
drivers/net/i40e/rte_pmd_i40e.h +12 -0
@@ -383,4 +383,16 @@ int rte_pmd_i40e_reset_vf_stats(uint8_t port,int rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff,uint32_t size,bool add); +/** +* rte_pmd_i40e_get_ppp_list - Get loaded profile list +* @port: port id +* @buff: buffer for response +* @size: buffer size +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_get_ppp_list (uint8_t port,uint8_t *buff,uint32_t size); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -27,4 +27,5 @@ DPDK_17.05 { global: rte_pmd_i40e_process_ppp_package; + rte_pmd_i40e_get_ppp_list; };
Signature · 1 line
2.5.5
PATCH v4 4/5 app/testpmd: add command for getting loaded profiles
In reply to Beilei XingThis patch is to add testpmd CLI for getting all loaded profiles.
--- app/test-pmd/cmdline.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+)
app/test-pmd/cmdline.c +91 -0
@@ -215,6 +215,9 @@ static void cmd_help_long_parsed(void *parsed_result,"read txd (port_id) (queue_id) (txd_id)\n" " Display a TX descriptor of a port TX queue.\n\n" + +"get ppp list (port_id)\n" +" Get ppp profile info list\n\n" ); }
@@ -12474,6 +12477,93 @@ cmdline_parse_inst_t cmd_add_ppp = { }, }; +/* Get Pipeline Personalization Profile list*/ +#define PROFILE_INFO_SIZE 48 +#define MAX_PROFILE_NUM 16 + +struct cmd_get_ppp_list_result { +cmdline_fixed_string_t get; +cmdline_fixed_string_t ppp; +cmdline_fixed_string_t list; +uint8_t port_id; +}; + +cmdline_parse_token_string_t cmd_get_ppp_list_get = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, get, "get"); +cmdline_parse_token_string_t cmd_get_ppp_list_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, ppp, "ppp"); +cmdline_parse_token_string_t cmd_get_ppp_list_list = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, list, "list"); +cmdline_parse_token_num_t cmd_get_ppp_list_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_get_ppp_list_result, port_id, UINT8); + +static void +cmd_get_ppp_list_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_get_ppp_list_result *res = parsed_result; +#ifdef RTE_LIBRTE_I40E_PMD +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *p_info; +uint32_t p_num; +uint32_t size; +uint32_t i; +#endif +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +#ifdef RTE_LIBRTE_I40E_PMD + size =PROFILE_INFO_SIZE *MAX_PROFILE_NUM +4 ; + p_list = (struct rte_pmd_i40e_profile_list *)malloc (size); +if (!p_list) +printf ("%s: Failed to malloc buffer\n" , __func__); + +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_get_ppp_list (res->port_id, + (uint8_t *)p_list, size); + +if (!ret) { + p_num = p_list->p_count; +printf ("Profile number is: %d\n\n" , p_num); + +for (i =0 ; i < p_num; i++) { + p_info = &p_list->p_info[i]; +printf ("Profile %d:\n" , i); +printf ("Track id: 0x%x\n" , p_info->track_id); +printf ("Version: %d.%d.%d.%d \n" , + p_info->version.major, + p_info->version.minor, + p_info->version.update, + p_info->version.draft); +printf ("Profile name: %s\n\n" , p_info->name); + } + } + +free (p_list); +#endif + +if (ret <0 ) +printf ("Failed to get ppp list\n" ); +} + +cmdline_parse_inst_t cmd_get_ppp_list = { + .f = cmd_get_ppp_list_parsed, + .data =NULL , + .help_str ="get ppp list <port_id>" , + .tokens = { + (void *)&cmd_get_ppp_list_get, + (void *)&cmd_get_ppp_list_ppp, + (void *)&cmd_get_ppp_list_list, + (void *)&cmd_get_ppp_list_port_id, +NULL , + }, +};/* ******************************************************************************** */ /* list of instructions */
@@ -12650,6 +12740,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, (cmdline_parse_inst_t *)&cmd_add_ppp, + (cmdline_parse_inst_t *)&cmd_get_ppp_list, NULL, };
Signature · 1 line
2.5.5
PATCH v4 5/5 doc: add pipeline personalization profile support for i40e
In reply to Beilei Xing--- doc/guides/rel_notes/release_17_05.rst | 4 ++++ 1 file changed, 4 insertions(+)
doc/guides/rel_notes/release_17_05.rst +4 -0
@@ -85,6 +85,10 @@ New Features Data Ring, ability to register memory regions. +* **Added pipeline personalization profile support for i40e.** + + * Added loading pipeline personalization profile to i40e FW. + Resolved Issues ---------------
Signature · 1 line
2.5.5
Re: [PATCH v4 5/5] doc: add pipeline personalization profile support for i40e
Quoted 11 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Beilei Xing
Sent: Friday, March 24, 2017 10:19 AM
To: Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4 5/5] doc: add pipeline personalization profile support for i40eSigned-off-by Beilei Xing <[email protected]>
Re: [PATCH v4 1/5] net/i40e: add pipeline personalization profile processing
In reply to Beilei XingHi Beilei,
Quoted 135 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Beilei Xing
Sent: Friday, March 24, 2017 10:19 AM
To: Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline personalization profile processingAdd support for adding a pipeline personalization profile package.
Signed-off-by Beilei Xing <[email protected]>--- app/test-pmd/cmdline.c | 1 + drivers/net/i40e/i40e_ethdev.c | 198 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 51 ++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 6 + 4 files changed, 256 insertions(+)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-047f935d..6e0625d 100644
app/test-pmd/cmdline.c +1
-0@@ -37,6 +37,7 @@#include <stdio.h> #include <stdint.h> #include <stdarg.h> +#include <stdbool.h> #include <string.h> #include <termios.h> #include <unistd.h> drivers/net/i40e/i40e_ethdev.c +3
-0@@ -11259,3 +11259,201 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,return 0 ; } + +static void +i40e_generate_profile_info_sec(char *name, struct i40e_ppp_version*version,
drivers/net/i40e/i40e_ethdev.c +54
-0+ uint32_t track_id, uint8_t *profile_info_sec, + bool add) +{ + struct i40e_profile_section_header *sec = NULL; +struct i40e_profile_info *pinfo; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; +memcpy (pinfo->name, name,I40E_PPP_NAME_SIZE ); +memcpy (&pinfo->version, version,sizeof (struct i40e_ppp_version )); +if (add) + pinfo->op =I40E_PPP_ADD_TRACKID ; +else + pinfo->op =I40E_PPP_REMOVE_TRACKID ; +} + +static enum i40e_status_code +i40e_add_rm_profile_info (struct i40e_hw *hw,uint8_t *profile_info_sec) +{ +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec; +uint32_t track_id; +uint32_t offset =0 , info =0 ; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + track_id = ((struct i40e_profile_info *)(profile_info_sec + + sec->section.offset))->track_id; + + status =i40e_aq_write_ppp (hw, (void *)sec, sec->data_end, + track_id, &offset, &info,NULL ); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add/remove profile info: " +"offset %d, info %d" , + offset, info); + +return status; +} + +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + +/* Check if the profile info exists */ +static int +i40e_check_profile_info (uint8_t port,uint8_t *profile_info_sec) { +struct rte_eth_dev *dev = &rte_eth_devices[port]; + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-Quoted 1 line
dev_private);drivers/net/i40e/i40e_ethdev.c +8
-0+uint8_t *buff; +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *pinfo, *p; +uint32_t i; +int ret; + + buff = rte_zmalloc("pinfo_list", + (I40E_PROFILE_INFO_SIZE *
I40E_MAX_PROFILE_NUM+ 4),drivers/net/i40e/i40e_ethdev.c +8
-0+ 0); +if (!buff) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return -1 ; + } + + ret = i40e_aq_get_ppp_list(hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM +4),
drivers/net/i40e/i40e_ethdev.c +19
-0+ 0, NULL); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to get profile info list." ); +rte_free (buff); +return -1 ; + } + p_list = (struct rte_pmd_i40e_profile_list *)buff; + pinfo = (struct rte_pmd_i40e_profile_info *)(profile_info_sec + +sizeof (struct i40e_profile_section_header )); +for (i =0 ; i < p_list->p_count; i++) { + p = &p_list->p_info[i]; +if ((pinfo->track_id == p->track_id) && + !memcmp (&pinfo->version, &p->version, +sizeof (struct i40e_ppp_version )) && + !memcmp (&pinfo->name, &p->name, +I40E_PPP_NAME_SIZE )) { +PMD_DRV_LOG (INFO ,"Profile exists." ); +rte_free (buff); +return 1 ;
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port, · line 11364
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+ } + } + +rte_free (buff); +return 0 ; +} + +int +rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add)
To make this function future-proof it is better not to use 'bool add' as there are at least three possible processing actions:
1. Process package and add it to the list of applied profiles (applying new personalization)
2. Process package and remove it from the list (restoring original configuration)
3. Process package and to not update the list (update already applied personalization)
Quoted 117 lines
drivers/net/i40e/i40e_ethdev.c +41
-0+{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +int is_exist; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (size < (sizeof (struct i40e_package_header ) + +sizeof (struct i40e_metadata_segment ) + +sizeof (uint32_t ) *2 )) { +PMD_DRV_LOG (ERR ,"Buff is invalid." ); +return -EINVAL ; + } + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +if (pkg_hdr->segment_count <2 ) { +PMD_DRV_LOG (ERR ,"Segment_count should be 2 at least." ); +return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_METADATA,
drivers/net/i40e/i40e_ethdev.c +3
-0+ pkg_hdr); +if (!metadata_seg_hdr) { + PMD_DRV_LOG(ERR, "Failed to find metadata segmentheader");
drivers/net/i40e/i40e_ethdev.c +7
-0+return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment +*)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_I40E,
drivers/net/i40e/i40e_ethdev.c +20
-0+ pkg_hdr); +if (!profile_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find profile segment header" ); +return -EINVAL ; + } + + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); +if (!profile_info_sec) { +PMD_DRV_LOG (ERR ,"Failed to allocate memory" ); +return -EINVAL ; + } + +if (add) { +/* Check if the profile exists */ + i40e_generate_profile_info_sec( + ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)-Quoted 1 line
version,
drivers/net/i40e/i40e_ethdev.c +11
-0+ track_id, profile_info_sec, 1); + is_exist =i40e_check_profile_info (port, profile_info_sec); +if (is_exist) { +PMD_DRV_LOG (ERR ,"Profile already exists." ); +rte_free (profile_info_sec); +return 1 ; + } + +/* Write profile to HW */ + status = i40e_write_profile(hw, + (struct i40e_profile_segment*)profile_seg_hdr,
drivers/net/i40e/i40e_ethdev.c +14
-0+ track_id); +if (status) +PMD_DRV_LOG (ERR ,"Failed to write profile." ); + +/* Add profile info to info list */ + status =i40e_add_rm_profile_info (hw, profile_info_sec); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add profile info." ); + }else +PMD_DRV_LOG (ERR ,"Action not supported temporarily." ); + +rte_free (profile_info_sec); +return status; +}(quoted diff) +0
-0
b/drivers/net/i40e/rte_pmd_i40e.hindex a0ad88c..4f6cdb5 100644drivers/net/i40e/rte_pmd_i40e.h +8
-0@@ -65,6 +65,36 @@ struct rte_pmd_i40e_mb_event_param {uint16_t msglen;/**< length of the message */ }; +#define RTE_PMD_I40E_PPP_NAME_SIZE 32 + +/** +* Pipeline personalization profile version */ struct +rte_pmd_i40e_ppp_version { +uint8_t major; +uint8_t minor; +uint8_t update;
drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_mb_event_param { · line 85
Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +10
-0+uint8_t draft; +}; + +/** +* Structure of profile information +*/ +struct rte_pmd_i40e_profile_info { +uint32_t track_id; +struct rte_pmd_i40e_ppp_version version; +uint8_t reserved[8 ];
Instead of uint8_t reserved[8] it should be
uint8_t owner;
uint8_t reserved[7];Quoted 53 lines
drivers/net/i40e/rte_pmd_i40e.h +29
-0+uint8_t name[RTE_PMD_I40E_PPP_NAME_SIZE ]; }; + +/** +* Structure of profile information list */ struct +rte_pmd_i40e_profile_list { +uint32_t p_count; +struct rte_pmd_i40e_profile_info p_info[1 ]; }; +/** * Notify VF when PF link status changes. * @@ -332,4 +362,25 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port, int rte_pmd_i40e_reset_vf_stats(uint8_t port, uint16_t vf_id); +/** +* Load/Unload a ppp package +* +* @param port +* The port identifier of the Ethernet device. +* @param buff +* buffer of package. +* @param size +* size of buffer. +* @param add +* - (1) write profile. +* - (0) remove profile. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +* - (1) if profile exists. +*/ +int rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add); +#endif /* _PMD_I40E_H_ */ drivers/net/i40e/rte_pmd_i40e_version.map +6
-1@@ -22,3 +22,9 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_tag; } DPDK_2.0; + +DPDK_17.05 { + global: + + rte_pmd_i40e_process_ppp_package; +}; --
Quoted 1 line
2.5.5
Regards,
Andrey
Re: [PATCH v4 1/5] net/i40e: add pipeline personalization profile processing
Hi Andrey,
Quoted 159 lines
-----Original Message-----
From: Chilikin, Andrey
Sent: Friday, March 24, 2017 10:53 PM
To: Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline personalization profile processingHi Beilei,
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t
Quoted 36 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Beilei Xing
Sent: Friday, March 24, 2017 10:19 AM
To: Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline personalization profile processingAdd support for adding a pipeline personalization profile package.
Signed-off-by Beilei Xing <[email protected]>--- app/test-pmd/cmdline.c | 1 + drivers/net/i40e/i40e_ethdev.c | 198 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 51 ++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 6 + 4 files changed, 256 insertions(+)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-047f935d..6e0625d 100644
app/test-pmd/cmdline.c +1
-0@@ -37,6 +37,7 @@#include <stdio.h> #include <stdint.h> #include <stdarg.h> +#include <stdbool.h> #include <string.h> #include <termios.h> #include <unistd.h> (quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 3702214..bea593f 100644drivers/net/i40e/i40e_ethdev.c +0
-0@@ -11259,3 +11259,201 @@ rte_pmd_i40e_reset_vf_stats(uint8_tport,
Quoted 97 lines
drivers/net/i40e/i40e_ethdev.c +55
-0return 0 ; } + +static void +i40e_generate_profile_info_sec (char *name,struct i40e_ppp_version *version, +uint32_t track_id,uint8_t *profile_info_sec, +bool add) +{ +struct i40e_profile_section_header *sec =NULL ; +struct i40e_profile_info *pinfo; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; +memcpy (pinfo->name, name,I40E_PPP_NAME_SIZE ); +memcpy (&pinfo->version, version,sizeof (struct i40e_ppp_version )); +if (add) + pinfo->op =I40E_PPP_ADD_TRACKID ; +else + pinfo->op =I40E_PPP_REMOVE_TRACKID ; } + +static enum i40e_status_code +i40e_add_rm_profile_info (struct i40e_hw *hw,uint8_t +*profile_info_sec) { +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec; +uint32_t track_id; +uint32_t offset =0 , info =0 ; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + track_id = ((struct i40e_profile_info *)(profile_info_sec + + sec->section.offset))->track_id; + + status =i40e_aq_write_ppp (hw, (void *)sec, sec->data_end, + track_id, &offset, &info,NULL ); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add/remove profile info: " +"offset %d, info %d" , + offset, info); + +return status; +} + +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + +/* Check if the profile info exists */ static int +i40e_check_profile_info (uint8_t port,uint8_t *profile_info_sec) { +struct rte_eth_dev *dev = &rte_eth_devices[port]; + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-Quoted 1 line
dev_private);drivers/net/i40e/i40e_ethdev.c +8
-0+uint8_t *buff; +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *pinfo, *p; +uint32_t i; +int ret; + + buff = rte_zmalloc("pinfo_list", + (I40E_PROFILE_INFO_SIZE *
I40E_MAX_PROFILE_NUM+ 4),drivers/net/i40e/i40e_ethdev.c +8
-0+ 0); +if (!buff) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return -1 ; + } + + ret = i40e_aq_get_ppp_list(hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM +4),
drivers/net/i40e/i40e_ethdev.c +19
-0+ 0, NULL); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to get profile info list." ); +rte_free (buff); +return -1 ; + } + p_list = (struct rte_pmd_i40e_profile_list *)buff; + pinfo = (struct rte_pmd_i40e_profile_info *)(profile_info_sec + +sizeof (struct i40e_profile_section_header )); +for (i =0 ; i < p_list->p_count; i++) { + p = &p_list->p_info[i]; +if ((pinfo->track_id == p->track_id) && + !memcmp (&pinfo->version, &p->version, +sizeof (struct i40e_ppp_version )) && + !memcmp (&pinfo->name, &p->name, +I40E_PPP_NAME_SIZE )) { +PMD_DRV_LOG (INFO ,"Profile exists." ); +rte_free (buff); +return 1 ;drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port, · line 11364
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+ } + } + +rte_free (buff); +return 0 ; +} + +int +rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add)To make this function future-proof it is better not to use 'bool add' as there are at least three possible processing actions:
Quoted 4 lines
1. Process package and add it to the list of applied profiles (applying new personalization) 2. Process package and remove it from the list (restoring original configuration) 3. Process package and to not update the list (update already applied personalization)
Thanks for your comments, I considered your suggestion before, but it's a private API for user, I think there's only "add" and "remove" for users, user shouldn't want to know if the profile needs to be updated in the info list. So I think the first and the third items above should be distinguished by driver instead of application. Driver can distinguish them when driver parses the package by checking if track_id is 0. What do you think?
In my opinion, the first item means add a profile, the second item means remove a profile, the third means add a read-only profile. Please correct me if I'm wrong. In fact we only support the first in this release, the second and third items above need to be supported after this release.
Beilei
Quoted 130 lines
Quoted 118 lines
drivers/net/i40e/i40e_ethdev.c +41
-0+{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +int is_exist; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (size < (sizeof (struct i40e_package_header ) + +sizeof (struct i40e_metadata_segment ) + +sizeof (uint32_t ) *2 )) { +PMD_DRV_LOG (ERR ,"Buff is invalid." ); +return -EINVAL ; + } + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +if (pkg_hdr->segment_count <2 ) { +PMD_DRV_LOG (ERR ,"Segment_count should be 2 at least." ); +return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_METADATA,
drivers/net/i40e/i40e_ethdev.c +3
-0+ pkg_hdr); +if (!metadata_seg_hdr) { + PMD_DRV_LOG(ERR, "Failed to find metadata segmentheader");
drivers/net/i40e/i40e_ethdev.c +7
-0+return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment +*)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_I40E,
drivers/net/i40e/i40e_ethdev.c +20
-0+ pkg_hdr); +if (!profile_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find profile segment header" ); +return -EINVAL ; + } + + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); +if (!profile_info_sec) { +PMD_DRV_LOG (ERR ,"Failed to allocate memory" ); +return -EINVAL ; + } + +if (add) { +/* Check if the profile exists */ + i40e_generate_profile_info_sec( + ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)-Quoted 1 line
version,
drivers/net/i40e/i40e_ethdev.c +11
-0+ track_id, profile_info_sec, 1); + is_exist =i40e_check_profile_info (port, profile_info_sec); +if (is_exist) { +PMD_DRV_LOG (ERR ,"Profile already exists." ); +rte_free (profile_info_sec); +return 1 ; + } + +/* Write profile to HW */ + status = i40e_write_profile(hw, + (struct i40e_profile_segment*)profile_seg_hdr,
drivers/net/i40e/i40e_ethdev.c +14
-0+ track_id); +if (status) +PMD_DRV_LOG (ERR ,"Failed to write profile." ); + +/* Add profile info to info list */ + status =i40e_add_rm_profile_info (hw, profile_info_sec); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add profile info." ); + }else +PMD_DRV_LOG (ERR ,"Action not supported temporarily." ); + +rte_free (profile_info_sec); +return status; +}(quoted diff) +0
-0
b/drivers/net/i40e/rte_pmd_i40e.hindex a0ad88c..4f6cdb5 100644drivers/net/i40e/rte_pmd_i40e.h +8
-0@@ -65,6 +65,36 @@ struct rte_pmd_i40e_mb_event_param {uint16_t msglen;/**< length of the message */ }; +#define RTE_PMD_I40E_PPP_NAME_SIZE 32 + +/** +* Pipeline personalization profile version */ struct +rte_pmd_i40e_ppp_version { +uint8_t major; +uint8_t minor; +uint8_t update;drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_mb_event_param { · line 85
Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +10
-0+uint8_t draft; +}; + +/** +* Structure of profile information +*/ +struct rte_pmd_i40e_profile_info { +uint32_t track_id; +struct rte_pmd_i40e_ppp_version version; +uint8_t reserved[8 ];Instead of
uint8_treserved[8] it should be
Quoted 2 lines
uint8_t owner;
uint8_t reserved[7];Actually I define this for getting profile info but not updating profile info, so I thought there won't be "owner = REMOVE" in info list. please correct me if I'm wrong. In base driver, there's "struct i40e_profile_info " used for updating profile info. All the structures defined in "rte_pmd_i40e.h" are used for getting info by application.
Do you think "owner" member is used for user? If yes, I will update it. If no, I think user will be confused by "owner".
Quoted 59 lines
drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_get_vf_stats(uint8_t port,
Quoted 13 lines
drivers/net/i40e/rte_pmd_i40e.h +8
-0+uint8_t name[RTE_PMD_I40E_PPP_NAME_SIZE ]; }; + +/** +* Structure of profile information list */ struct +rte_pmd_i40e_profile_list { +uint32_t p_count; +struct rte_pmd_i40e_profile_info p_info[1 ]; }; +/** * Notify VF when PF link status changes. * @@ -332,4 +362,25 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,int
Quoted 41 lines
drivers/net/i40e/rte_pmd_i40e.h +21
-0rte_pmd_i40e_reset_vf_stats(uint8_t port, uint16_t vf_id); +/** +* Load/Unload a ppp package +* +* @param port +* The port identifier of the Ethernet device. +* @param buff +* buffer of package. +* @param size +* size of buffer. +* @param add +* - (1) write profile. +* - (0) remove profile. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +* - (1) if profile exists. +*/ +int rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add); +#endif /* _PMD_I40E_H_ */ drivers/net/i40e/rte_pmd_i40e_version.map +6
-1@@ -22,3 +22,9 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_tag; } DPDK_2.0; + +DPDK_17.05 { + global: + + rte_pmd_i40e_process_ppp_package; +}; --Quoted 1 line
2.5.5
Regards,
Andrey
Re: [PATCH v4 1/5] net/i40e: add pipeline personalization profile processing
Hi Beilei
Quoted 184 lines
-----Original Message-----
From: Xing, Beilei
Sent: Saturday, March 25, 2017 4:04 AM
To: Chilikin, Andrey <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline personalization profile processingHi Andrey,
Quoted 159 lines
-----Original Message-----
From: Chilikin, Andrey
Sent: Friday, March 24, 2017 10:53 PM
To: Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline personalization profile processingHi Beilei,
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t
Quoted 36 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Beilei Xing
Sent: Friday, March 24, 2017 10:19 AM
To: Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline personalization profile processingAdd support for adding a pipeline personalization profile package.
Signed-off-by Beilei Xing <[email protected]>--- app/test-pmd/cmdline.c | 1 + drivers/net/i40e/i40e_ethdev.c | 198 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 51 ++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 6 + 4 files changed, 256 insertions(+)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-047f935d..6e0625d 100644
app/test-pmd/cmdline.c +1
-0@@ -37,6 +37,7 @@#include <stdio.h> #include <stdint.h> #include <stdarg.h> +#include <stdbool.h> #include <string.h> #include <termios.h> #include <unistd.h> (quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 3702214..bea593f 100644drivers/net/i40e/i40e_ethdev.c +0
-0@@ -11259,3 +11259,201 @@ rte_pmd_i40e_reset_vf_stats(uint8_tport,
Quoted 97 lines
drivers/net/i40e/i40e_ethdev.c +55
-0return 0 ; } + +static void +i40e_generate_profile_info_sec (char *name,struct i40e_ppp_version *version, +uint32_t track_id,uint8_t *profile_info_sec, +bool add) +{ +struct i40e_profile_section_header *sec =NULL ; +struct i40e_profile_info *pinfo; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; +memcpy (pinfo->name, name,I40E_PPP_NAME_SIZE ); +memcpy (&pinfo->version, version,sizeof (struct i40e_ppp_version )); +if (add) + pinfo->op =I40E_PPP_ADD_TRACKID ; +else + pinfo->op =I40E_PPP_REMOVE_TRACKID ; } + +static enum i40e_status_code +i40e_add_rm_profile_info (struct i40e_hw *hw,uint8_t +*profile_info_sec) { +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec; +uint32_t track_id; +uint32_t offset =0 , info =0 ; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + track_id = ((struct i40e_profile_info *)(profile_info_sec + + sec->section.offset))->track_id; + + status =i40e_aq_write_ppp (hw, (void *)sec, sec->data_end, + track_id, &offset, &info,NULL ); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add/remove profile info: " +"offset %d, info %d" , + offset, info); + +return status; +} + +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + +/* Check if the profile info exists */ static int +i40e_check_profile_info (uint8_t port,uint8_t *profile_info_sec) { +struct rte_eth_dev *dev = &rte_eth_devices[port]; + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-Quoted 1 line
dev_private);drivers/net/i40e/i40e_ethdev.c +8
-0+uint8_t *buff; +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *pinfo, *p; +uint32_t i; +int ret; + + buff = rte_zmalloc("pinfo_list", + (I40E_PROFILE_INFO_SIZE *
I40E_MAX_PROFILE_NUM+ 4),drivers/net/i40e/i40e_ethdev.c +8
-0+ 0); +if (!buff) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return -1 ; + } + + ret = i40e_aq_get_ppp_list(hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM +4),
drivers/net/i40e/i40e_ethdev.c +19
-0+ 0, NULL); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to get profile info list." ); +rte_free (buff); +return -1 ; + } + p_list = (struct rte_pmd_i40e_profile_list *)buff; + pinfo = (struct rte_pmd_i40e_profile_info *)(profile_info_sec + +sizeof (struct i40e_profile_section_header )); +for (i =0 ; i < p_list->p_count; i++) { + p = &p_list->p_info[i]; +if ((pinfo->track_id == p->track_id) && + !memcmp (&pinfo->version, &p->version, +sizeof (struct i40e_ppp_version )) && + !memcmp (&pinfo->name, &p->name, +I40E_PPP_NAME_SIZE )) { +PMD_DRV_LOG (INFO ,"Profile exists." ); +rte_free (buff); +return 1 ;drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port, · line 11364
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+ } + } + +rte_free (buff); +return 0 ; +} + +int +rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add)To make this function future-proof it is better not to use 'bool add' as there are at least three possible processing actions:
Quoted 5 lines
1. Process package and add it to the list of applied profiles (applying new
personalization) 2. Process package and remove it from the list (restoring original configuration) 3. Process package and to not update the list (update already applied personalization)Thanks for your comments, I considered your suggestion before, but it's a private API for user, I think there's only "add" and "remove" for users, user shouldn't want to know if the profile needs to be updated in the info list. So I think the first and the third items above should be distinguished by driver instead of application. Driver can distinguish them when driver parses the package by checking if
track_idis 0.
What do you think?
Quoted 4 lines
In my opinion, the first item means add a profile, the second item means remove a profile, the third means add a read-only profile. Please correct me if I'm wrong. In fact we only support the first in this release, the second and third items above need to be supported after this release.
You already have "Action not supported temporarily" message now, so it will not break anything but will save users updating their apps ABI in future.
In addition to read-only profiles, option 3 can be used for profiles which call generic admin commands, and only first call is needed to be registered. In this case TrackId will not be 0 and driver cannot used it directly. This is very minor change and do not see why not declare parameters properly from the first release if support for all three options is needed anyway.
Quoted 135 lines
Beilei
Quoted 129 lines
Quoted 117 lines
drivers/net/i40e/i40e_ethdev.c +41
-0+{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +int is_exist; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (size < (sizeof (struct i40e_package_header ) + +sizeof (struct i40e_metadata_segment ) + +sizeof (uint32_t ) *2 )) { +PMD_DRV_LOG (ERR ,"Buff is invalid." ); +return -EINVAL ; + } + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +if (pkg_hdr->segment_count <2 ) { +PMD_DRV_LOG (ERR ,"Segment_count should be 2 at least." ); +return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_METADATA,
drivers/net/i40e/i40e_ethdev.c +3
-0+ pkg_hdr); +if (!metadata_seg_hdr) { + PMD_DRV_LOG(ERR, "Failed to find metadata segmentheader");
drivers/net/i40e/i40e_ethdev.c +7
-0+return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment +*)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_I40E,
drivers/net/i40e/i40e_ethdev.c +20
-0+ pkg_hdr); +if (!profile_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find profile segment header" ); +return -EINVAL ; + } + + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); +if (!profile_info_sec) { +PMD_DRV_LOG (ERR ,"Failed to allocate memory" ); +return -EINVAL ; + } + +if (add) { +/* Check if the profile exists */ + i40e_generate_profile_info_sec( + ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)-Quoted 1 line
version,
drivers/net/i40e/i40e_ethdev.c +11
-0+ track_id, profile_info_sec, 1); + is_exist =i40e_check_profile_info (port, profile_info_sec); +if (is_exist) { +PMD_DRV_LOG (ERR ,"Profile already exists." ); +rte_free (profile_info_sec); +return 1 ; + } + +/* Write profile to HW */ + status = i40e_write_profile(hw, + (struct i40e_profile_segment*)profile_seg_hdr,
drivers/net/i40e/i40e_ethdev.c +14
-0+ track_id); +if (status) +PMD_DRV_LOG (ERR ,"Failed to write profile." ); + +/* Add profile info to info list */ + status =i40e_add_rm_profile_info (hw, profile_info_sec); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add profile info." ); + }else +PMD_DRV_LOG (ERR ,"Action not supported temporarily." ); + +rte_free (profile_info_sec); +return status; +}(quoted diff) +0
-0
b/drivers/net/i40e/rte_pmd_i40e.hindex a0ad88c..4f6cdb5 100644drivers/net/i40e/rte_pmd_i40e.h +7
-0@@ -65,6 +65,36 @@ struct rte_pmd_i40e_mb_event_param {uint16_t msglen;/**< length of the message */ }; +#define RTE_PMD_I40E_PPP_NAME_SIZE 32 + +/** +* Pipeline personalization profile version */ struct +rte_pmd_i40e_ppp_version { +uint8_t major; +uint8_t minor;drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_mb_event_param { · line 84
Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +10
-0+uint8_t update; +uint8_t draft; +}; + +/** +* Structure of profile information */ struct +rte_pmd_i40e_profile_info { +uint32_t track_id; +struct rte_pmd_i40e_ppp_version version; +uint8_t reserved[8 ];Instead of
uint8_treserved[8] it should beQuoted 2 lines
uint8_t owner; uint8_t reserved[7];
Quoted 8 lines
Actually I define this for getting profile info but not updating profile info, so I thought there won't be "owner = REMOVE" in info list. please correct me if I'm wrong. In base driver, there's "struct
i40e_profile_info" used for updating profile info.
All the structures defined in "rte_pmd_i40e.h" are used for getting info by application.
Do you think "owner" member is used for user? If yes, I will update it. If no, I think user will be confused by "owner".
After calling "get profile info list" 'owner' contains PF function which was used to execute a profile, not 'operation'.
Quoted 60 lines
Quoted 60 lines
drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_get_vf_stats(uint8_t port,
Quoted 14 lines
drivers/net/i40e/rte_pmd_i40e.h +8
-0+uint8_t name[RTE_PMD_I40E_PPP_NAME_SIZE ]; }; + +/** +* Structure of profile information list */ struct +rte_pmd_i40e_profile_list { +uint32_t p_count; +struct rte_pmd_i40e_profile_info p_info[1 ]; }; +/** * Notify VF when PF link status changes. * @@ -332,4 +362,25 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,int
Quoted 41 lines
drivers/net/i40e/rte_pmd_i40e.h +21
-0rte_pmd_i40e_reset_vf_stats(uint8_t port, uint16_t vf_id); +/** +* Load/Unload a ppp package +* +* @param port +* The port identifier of the Ethernet device. +* @param buff +* buffer of package. +* @param size +* size of buffer. +* @param add +* - (1) write profile. +* - (0) remove profile. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +* - (1) if profile exists. +*/ +int rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add); +#endif /* _PMD_I40E_H_ */ drivers/net/i40e/rte_pmd_i40e_version.map +6
-1@@ -22,3 +22,9 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_tag; } DPDK_2.0; + +DPDK_17.05 { + global: + + rte_pmd_i40e_process_ppp_package; +}; --Quoted 1 line
2.5.5
Regards,
Andrey
Re: [PATCH v4 1/5] net/i40e: add pipeline personalization profile processing
Hi Andrey,
Quoted 202 lines
-----Original Message-----
From: Chilikin, Andrey
Sent: Sunday, March 26, 2017 5:04 AM
To: Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline personalization profile processingHi Beilei
Quoted 105 lines
-----Original Message-----
From: Xing, Beilei
Sent: Saturday, March 25, 2017 4:04 AM
To: Chilikin, Andrey <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline personalization profile processingHi Andrey,
Quoted 94 lines
-----Original Message-----
From: Chilikin, Andrey
Sent: Friday, March 24, 2017 10:53 PM
To: Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline personalization profile processingHi Beilei,
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t
Quoted 36 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Beilei Xing
Sent: Friday, March 24, 2017 10:19 AM
To: Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4 1/5] net/i40e: add pipeline personalization profile processingAdd support for adding a pipeline personalization profile package.
Signed-off-by Beilei Xing <[email protected]>--- app/test-pmd/cmdline.c | 1 + drivers/net/i40e/i40e_ethdev.c | 198 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 51 ++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 6 + 4 files changed, 256 insertions(+)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-047f935d..6e0625d 100644
app/test-pmd/cmdline.c +1
-0@@ -37,6 +37,7 @@#include <stdio.h> #include <stdint.h> #include <stdarg.h> +#include <stdbool.h> #include <string.h> #include <termios.h> #include <unistd.h> (quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 3702214..bea593f 100644drivers/net/i40e/i40e_ethdev.c +0
-0@@ -11259,3 +11259,201 @@ rte_pmd_i40e_reset_vf_stats(uint8_tport,
Quoted 46 lines
drivers/net/i40e/i40e_ethdev.c +42
-0return 0 ; } + +static void +i40e_generate_profile_info_sec (char *name,struct +i40e_ppp_version *version, +uint32_t track_id,uint8_t *profile_info_sec, +bool add) +{ +struct i40e_profile_section_header *sec =NULL ; +struct i40e_profile_info *pinfo; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; +memcpy (pinfo->name, name,I40E_PPP_NAME_SIZE ); +memcpy (&pinfo->version, version,sizeof (struct i40e_ppp_version )); +if (add) + pinfo->op =I40E_PPP_ADD_TRACKID ; +else + pinfo->op =I40E_PPP_REMOVE_TRACKID ; } + +static enum i40e_status_code +i40e_add_rm_profile_info (struct i40e_hw *hw,uint8_t +*profile_info_sec) { +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec; +uint32_t track_id; +uint32_t offset =0 , info =0 ; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + track_id = ((struct i40e_profile_info *)(profile_info_sec + + sec->section.offset))->track_id; + + status =i40e_aq_write_ppp (hw, (void *)sec, sec->data_end, + track_id, &offset, &info,NULL ); +if (status)Quoted 8 lines
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port,
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +8
-0+PMD_DRV_LOG (ERR ,"Failed to add/remove profile info: " +"offset %d, info %d" , + offset, info); + +return status; +} + +#define I40E_PROFILE_INFO_SIZE 48 #define
I40E_MAX_PROFILE_NUM16Quoted 63 lines
Quoted 57 lines
Quoted 43 lines
drivers/net/i40e/i40e_ethdev.c +5
-0+ +/* Check if the profile info exists */ static int +i40e_check_profile_info (uint8_t port,uint8_t *profile_info_sec) { +struct rte_eth_dev *dev = &rte_eth_devices[port]; + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-Quoted 1 line
dev_private);drivers/net/i40e/i40e_ethdev.c +8
-0+uint8_t *buff; +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *pinfo, *p; +uint32_t i; +int ret; + + buff = rte_zmalloc("pinfo_list", + (I40E_PROFILE_INFO_SIZE *
I40E_MAX_PROFILE_NUM+ 4),drivers/net/i40e/i40e_ethdev.c +8
-0+ 0); +if (!buff) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return -1 ; + } + + ret = i40e_aq_get_ppp_list(hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM +4),
drivers/net/i40e/i40e_ethdev.c +19
-0+ 0, NULL); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to get profile info list." ); +rte_free (buff); +return -1 ; + } + p_list = (struct rte_pmd_i40e_profile_list *)buff; + pinfo = (struct rte_pmd_i40e_profile_info *)(profile_info_sec + +sizeof (struct i40e_profile_section_header )); +for (i =0 ; i < p_list->p_count; i++) { + p = &p_list->p_info[i]; +if ((pinfo->track_id == p->track_id) && + !memcmp (&pinfo->version, &p->version, +sizeof (struct i40e_ppp_version )) && + !memcmp (&pinfo->name, &p->name, +I40E_PPP_NAME_SIZE )) { +PMD_DRV_LOG (INFO ,"Profile exists." ); +rte_free (buff); +return 1 ;drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port, · line 11364
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+ } + } + +rte_free (buff); +return 0 ; +} + +int +rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add)To make this function future-proof it is better not to use 'bool add' as there are at least three possible processing actions:
Quoted 5 lines
1. Process package and add it to the list of applied profiles (applying new
personalization) 2. Process package and remove it from the list (restoring original configuration) 3. Process package and to not update the list (update already applied personalization)Quoted 6 lines
Thanks for your comments, I considered your suggestion before, but it's a private API for user, I think there's only "add" and "remove" for users, user shouldn't want to know if the profile needs to be updated in the info list. So I think the first and the third items above should be distinguished by driver instead of application. Driver can distinguish them when driver parses the package by checking if
track_idis 0.
Quoted 6 lines
What do you think?
In my opinion, the first item means add a profile, the second item means remove a profile, the third means add a read-only profile. Please correct me if I'm wrong. In fact we only support the first in this release, the second and third items above need to be supported after
this release.
Quoted 8 lines
You already have "Action not supported temporarily" message now, so it will not break anything but will save users updating their apps ABI in future. In addition to read-only profiles, option 3 can be used for profiles which call generic admin commands, and only first call is needed to be registered. In this case TrackId will not be 0 and driver cannot used it directly. This is very minor change and do not see why not declare parameters properly from the first release if support for all three options is needed anyway.
OK, misunderstood for option 3, I thought there was only different track_id between option 1 and option 3. Will update in next version, thanks for explanation.
Quoted 145 lines
Quoted 53 lines
Beilei
Quoted 50 lines
Quoted 50 lines
drivers/net/i40e/i40e_ethdev.c +41
-0+{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +int is_exist; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (size < (sizeof (struct i40e_package_header ) + +sizeof (struct i40e_metadata_segment ) + +sizeof (uint32_t ) *2 )) { +PMD_DRV_LOG (ERR ,"Buff is invalid." ); +return -EINVAL ; + } + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +if (pkg_hdr->segment_count <2 ) { +PMD_DRV_LOG (ERR ,"Segment_count should be 2 at least." ); +return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_METADATA,
drivers/net/i40e/i40e_ethdev.c +3
-0+ pkg_hdr); +if (!metadata_seg_hdr) { + PMD_DRV_LOG(ERR, "Failed to find metadata segmentheader");
drivers/net/i40e/i40e_ethdev.c +3
-0+return -EINVAL ; + } + track_id = ((struct i40e_metadata_segmentQuoted 8 lines
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_reset_vf_stats(uint8_t port,
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +4
-0+*)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_I40E,
drivers/net/i40e/i40e_ethdev.c +3
-0+ pkg_hdr); +if (!profile_seg_hdr) { + PMD_DRV_LOG(ERR, "Failed to find profile segmentheader");
Quoted 74 lines
Quoted 71 lines
Quoted 59 lines
drivers/net/i40e/i40e_ethdev.c +17
-0+return -EINVAL ; + } + + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); +if (!profile_info_sec) { +PMD_DRV_LOG (ERR ,"Failed to allocate memory" ); +return -EINVAL ; + } + +if (add) { +/* Check if the profile exists */ + i40e_generate_profile_info_sec( + ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)-Quoted 1 line
version,
drivers/net/i40e/i40e_ethdev.c +11
-0+ track_id, profile_info_sec, 1); + is_exist =i40e_check_profile_info (port, profile_info_sec); +if (is_exist) { +PMD_DRV_LOG (ERR ,"Profile already exists." ); +rte_free (profile_info_sec); +return 1 ; + } + +/* Write profile to HW */ + status = i40e_write_profile(hw, + (struct i40e_profile_segment*)profile_seg_hdr,
drivers/net/i40e/i40e_ethdev.c +14
-0+ track_id); +if (status) +PMD_DRV_LOG (ERR ,"Failed to write profile." ); + +/* Add profile info to info list */ + status =i40e_add_rm_profile_info (hw, profile_info_sec); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add profile info." ); + }else +PMD_DRV_LOG (ERR ,"Action not supported temporarily." ); + +rte_free (profile_info_sec); +return status; +}(quoted diff) +0
-0
b/drivers/net/i40e/rte_pmd_i40e.hindex a0ad88c..4f6cdb5 100644drivers/net/i40e/rte_pmd_i40e.h +7
-0@@ -65,6 +65,36 @@ struct rte_pmd_i40e_mb_event_param {uint16_t msglen;/**< length of the message */ }; +#define RTE_PMD_I40E_PPP_NAME_SIZE 32 + +/** +* Pipeline personalization profile version */ struct +rte_pmd_i40e_ppp_version { +uint8_t major; +uint8_t minor;drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_mb_event_param { · line 84
Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +10
-0+uint8_t update; +uint8_t draft; +}; + +/** +* Structure of profile information */ struct +rte_pmd_i40e_profile_info { +uint32_t track_id; +struct rte_pmd_i40e_ppp_version version; +uint8_t reserved[8 ];Instead of
uint8_treserved[8] it should beQuoted 2 lines
uint8_t owner; uint8_t reserved[7];Quoted 8 lines
Actually I define this for getting profile info but not updating profile info, so I thought there won't be "owner = REMOVE" in info list. please correct me if I'm wrong. In base driver, there's "struct
i40e_profile_info" used for updating profile info.
All the structures defined in "rte_pmd_i40e.h" are used for getting info by application.
Do you think "owner" member is used for user? If yes, I will update it. If no, I think user will be confused by "owner".
Quoted 2 lines
After calling "get profile info list" 'owner' contains PF function which was used to execute a profile, not 'operation'.
OK, will update it.
Quoted 60 lines
Quoted 60 lines
Quoted 60 lines
drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_get_vf_stats(uint8_t port,
Quoted 15 lines
drivers/net/i40e/rte_pmd_i40e.h +8
-0+uint8_t name[RTE_PMD_I40E_PPP_NAME_SIZE ]; }; + +/** +* Structure of profile information list */ struct +rte_pmd_i40e_profile_list { +uint32_t p_count; +struct rte_pmd_i40e_profile_info p_info[1 ]; }; +/** * Notify VF when PF link status changes. * @@ -332,4 +362,25 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,int
Quoted 40 lines
drivers/net/i40e/rte_pmd_i40e.h +21
-0rte_pmd_i40e_reset_vf_stats(uint8_t port, uint16_t vf_id); +/** +* Load/Unload a ppp package +* +* @param port +* The port identifier of the Ethernet device. +* @param buff +* buffer of package. +* @param size +* size of buffer. +* @param add +* - (1) write profile. +* - (0) remove profile. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +* - (1) if profile exists. +*/ +int rte_pmd_i40e_process_ppp_package (uint8_t port,uint8_t *buff, +uint32_t size,bool add); +#endif /* _PMD_I40E_H_ */ drivers/net/i40e/rte_pmd_i40e_version.map +5
-1@@ -22,3 +22,9 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_tag; } DPDK_2.0; + +DPDK_17.05 { + global: + + rte_pmd_i40e_process_ppp_package; }; --Quoted 1 line
2.5.5
Regards,
Andrey
v5 cover pipeline personalization profile support
In reply to Beilei XingDue to limited resources of X*710 (parser and analyzer configuration tables, number of packet classification types, number of packet types, filters configuration tables, etc.), it's impossible to simultaneously support all protocols/filters required for different parts on network. To enable protocols/filters extensions for X*710, new Admin Command for loading user defined configurations is added.
PPP is a format of extend configuration for X*710, it allows user to load user defined configuration to X*710.
List of possible use cases for extended X*710 configuration using profiles could include following:
Configuring Analyzer/Parser to support new protocols, e.g.
- IP L2TPv3 tunneling protocol
- IPSec ESP/AH protocols
- MPLSoGRE, MPLSoUDP tunnels
- GTP-C/GTP-U tunnels
New PCTYPEs for offloading packet classification to X*710. e.g.
- new IP Protocol in addition to TCP/UDP/SCTP
- new TCP/UDP subtypes, like TCP SYN, TCP FIN
- new PCTYPE for tunneled packets like GTP-C, GTP-U
New PTYPEs for packets identification, e.g.
- MAC, MPLS, IP4, UDP
- MAC, MPLS, MPLS, IP6, TCP
Fixes for NVM configuration, e.g.
- list of enabled stat counters to improve throughput
- parser/analyzer configuration for some corner cases
v5 changes:
Change parameter of rte_pmd_i40e_process_ppp_package to extend operation. Change structure rte_pmd_i40e_profile_info.
v4 changes:
Fix compile error with gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3). Move ppp related structures to rte_pmd_i40e.h.
Not support remove PPP temporarily.
v3 changes:
Move ppp AQ command code to base code.
Beilei Xing (5):
net/i40e: add pipeline personalization profile processing app/testpmd: add command for loading a profile net/i40e: add get all loaded profiles app/testpmd: add command for getting loaded profiles
doc: add pipeline personalization profile support for i40e
app/test-pmd/cmdline.c | 166 ++++++++++++++++++++++ app/test-pmd/config.c | 67 +++++++++ app/test-pmd/testpmd.h | 3 + doc/guides/rel_notes/release_17_05.rst | 4 + drivers/net/i40e/i40e_ethdev.c | 227 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 69 +++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 7 + 7 files changed, 543 insertions(+)
Signature · 1 line
2.5.5
PATCH v5 1/5 net/i40e: add pipeline personalization profile processing
Add support for adding a pipeline personalization profile package.
--- app/test-pmd/cmdline.c | 1 + drivers/net/i40e/i40e_ethdev.c | 199 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 58 +++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 6 + 4 files changed, 264 insertions(+)
app/test-pmd/cmdline.c +1 -0
@@ -37,6 +37,7 @@#include <stdio.h> #include <stdint.h> #include <stdarg.h> +#include <stdbool.h> #include <string.h> #include <termios.h> #include <unistd.h>
drivers/net/i40e/i40e_ethdev.c +199 -0
202 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e.h +58 -0
68 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +6 -0
@@ -22,3 +22,9 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_tag; } DPDK_2.0; + +DPDK_17.05 { + global: + + rte_pmd_i40e_process_ppp_package; +};
Signature · 1 line
2.5.5
PATCH v5 2/5 app/testpmd: add command for loading a profile
In reply to Beilei XingThis patch is to add testpmd CLI for loading a pipeline personalization profile.
--- app/test-pmd/cmdline.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 3 ++ 3 files changed, 144 insertions(+)
app/test-pmd/cmdline.c +74 -0
@@ -579,6 +579,9 @@ static void cmd_help_long_parsed(void *parsed_result,"E-tag set filter del e-tag-id (value) port (port_id)\n" " Delete an E-tag forwarding filter on a port\n\n" +"add ppp (port_id) (profile_path)\n" +" Load a profile package on a port\n\n" + ,list_pkt_forwarding_modes () ); }
@@ -12402,6 +12405,76 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = { }, }; +/* Load Pipeline Personalization Profile */ +struct cmd_add_ppp_result { +cmdline_fixed_string_t add; +cmdline_fixed_string_t ppp; +uint8_t port_id; +char filepath[]; +}; + +cmdline_parse_token_string_t cmd_add_ppp_add = + TOKEN_STRING_INITIALIZER(struct cmd_add_ppp_result, add, "add"); +cmdline_parse_token_string_t cmd_add_ppp_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_add_ppp_result, ppp, "ppp"); +cmdline_parse_token_num_t cmd_add_ppp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_add_ppp_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_add_ppp_filepath = + TOKEN_STRING_INITIALIZER(struct cmd_add_ppp_result, filepath, NULL); + +static void +cmd_add_ppp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_add_ppp_result *res = parsed_result; +uint8_t *buff; +uint32_t size; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +if (!all_ports_stopped ()) { +printf ("Please stop all ports first\n" ); +return ; + } + + buff =open_ppp_package_file (res->filepath, &size); +if (!buff) +return ; + +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_process_ppp_package (res->port_id, + buff, size, +RTE_PMD_I40E_PKG_OP_WR_ADD ); +#endif + +if (ret <0 ) +printf ("Failed to load profile.\n" ); +else if (ret >0 ) +printf ("Profile has already existed.\n" ); + +close_ppp_package_file (buff); +} + +cmdline_parse_inst_t cmd_add_ppp = { + .f = cmd_add_ppp_parsed, + .data =NULL , + .help_str ="add/remove ppp <port_id> <profile_path>" , + .tokens = { + (void *)&cmd_add_ppp_add, + (void *)&cmd_add_ppp_ppp, + (void *)&cmd_add_ppp_port_id, + (void *)&cmd_add_ppp_filepath, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -12577,6 +12650,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, + (cmdline_parse_inst_t *)&cmd_add_ppp, NULL, };
app/test-pmd/config.c +67 -0
70 lines not on this page · raw message
app/test-pmd/testpmd.h +3 -0
@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);void mcast_addr_remove (uint8_t port_id,struct ether_addr *mc_addr);void port_dcb_info_display (uint8_t port_id); +uint8_t *open_ppp_package_file (const char *file_path,uint32_t *size); +int close_ppp_package_file (uint8_t *buf); +enum print_warning {ENABLED_WARN =0 ,DISABLED_WARN
Signature · 1 line
2.5.5
PATCH v5 3/5 net/i40e: add get all loaded profiles
In reply to Beilei XingThis patch is to add get all loaded profiles function.
--- drivers/net/i40e/i40e_ethdev.c | 28 ++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 12 ++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 41 insertions(+)
drivers/net/i40e/i40e_ethdev.c +28 -0
@@ -11260,6 +11260,9 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,return 0 ; } +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + static void i40e_generate_profile_info_sec(char *name, struct i40e_ppp_version *version, uint32_t track_id, uint8_t *profile_info_sec,
@@ -11458,3 +11461,28 @@ rte_pmd_i40e_process_ppp_package(uint8_t port, uint8_t *buff,rte_free (profile_info_sec);return status; } + +int +rte_pmd_i40e_get_ppp_list (uint8_t port,uint8_t *buff,uint32_t size) +{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + +if (size < (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 )) +return -EINVAL ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + + status =i40e_aq_get_ppp_list (hw, (void *)buff, + size,0 ,NULL ); + +return status; +}
drivers/net/i40e/rte_pmd_i40e.h +12 -0
@@ -390,4 +390,16 @@ int rte_pmd_i40e_process_ppp_package(uint8_t port, uint8_t *buff,uint32_t size, enum rte_pmd_i40e_package_op op); +/** +* rte_pmd_i40e_get_ppp_list - Get loaded profile list +* @port: port id +* @buff: buffer for response +* @size: buffer size +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_get_ppp_list (uint8_t port,uint8_t *buff,uint32_t size); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -27,4 +27,5 @@ DPDK_17.05 { global: rte_pmd_i40e_process_ppp_package; + rte_pmd_i40e_get_ppp_list; };
Signature · 1 line
2.5.5
PATCH v5 4/5 app/testpmd: add command for getting loaded profiles
In reply to Beilei XingThis patch is to add testpmd CLI for getting all loaded profiles.
--- app/test-pmd/cmdline.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+)
app/test-pmd/cmdline.c +91 -0
@@ -215,6 +215,9 @@ static void cmd_help_long_parsed(void *parsed_result,"read txd (port_id) (queue_id) (txd_id)\n" " Display a TX descriptor of a port TX queue.\n\n" + +"get ppp list (port_id)\n" +" Get ppp profile info list\n\n" ); }
@@ -12475,6 +12478,93 @@ cmdline_parse_inst_t cmd_add_ppp = { }, }; +/* Get Pipeline Personalization Profile list*/ +#define PROFILE_INFO_SIZE 48 +#define MAX_PROFILE_NUM 16 + +struct cmd_get_ppp_list_result { +cmdline_fixed_string_t get; +cmdline_fixed_string_t ppp; +cmdline_fixed_string_t list; +uint8_t port_id; +}; + +cmdline_parse_token_string_t cmd_get_ppp_list_get = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, get, "get"); +cmdline_parse_token_string_t cmd_get_ppp_list_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, ppp, "ppp"); +cmdline_parse_token_string_t cmd_get_ppp_list_list = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, list, "list"); +cmdline_parse_token_num_t cmd_get_ppp_list_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_get_ppp_list_result, port_id, UINT8); + +static void +cmd_get_ppp_list_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_get_ppp_list_result *res = parsed_result; +#ifdef RTE_LIBRTE_I40E_PMD +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *p_info; +uint32_t p_num; +uint32_t size; +uint32_t i; +#endif +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +#ifdef RTE_LIBRTE_I40E_PMD + size =PROFILE_INFO_SIZE *MAX_PROFILE_NUM +4 ; + p_list = (struct rte_pmd_i40e_profile_list *)malloc (size); +if (!p_list) +printf ("%s: Failed to malloc buffer\n" , __func__); + +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_get_ppp_list (res->port_id, + (uint8_t *)p_list, size); + +if (!ret) { + p_num = p_list->p_count; +printf ("Profile number is: %d\n\n" , p_num); + +for (i =0 ; i < p_num; i++) { + p_info = &p_list->p_info[i]; +printf ("Profile %d:\n" , i); +printf ("Track id: 0x%x\n" , p_info->track_id); +printf ("Version: %d.%d.%d.%d \n" , + p_info->version.major, + p_info->version.minor, + p_info->version.update, + p_info->version.draft); +printf ("Profile name: %s\n\n" , p_info->name); + } + } + +free (p_list); +#endif + +if (ret <0 ) +printf ("Failed to get ppp list\n" ); +} + +cmdline_parse_inst_t cmd_get_ppp_list = { + .f = cmd_get_ppp_list_parsed, + .data =NULL , + .help_str ="get ppp list <port_id>" , + .tokens = { + (void *)&cmd_get_ppp_list_get, + (void *)&cmd_get_ppp_list_ppp, + (void *)&cmd_get_ppp_list_list, + (void *)&cmd_get_ppp_list_port_id, +NULL , + }, +};/* ******************************************************************************** */ /* list of instructions */
@@ -12651,6 +12741,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, (cmdline_parse_inst_t *)&cmd_add_ppp, + (cmdline_parse_inst_t *)&cmd_get_ppp_list, NULL, };
Signature · 1 line
2.5.5
PATCH v5 5/5 doc: add pipeline personalization profile support for i40e
In reply to Beilei Xing--- doc/guides/rel_notes/release_17_05.rst | 4 ++++ 1 file changed, 4 insertions(+)
doc/guides/rel_notes/release_17_05.rst +4 -0
@@ -85,6 +85,10 @@ New Features Data Ring, ability to register memory regions. +* **Added pipeline personalization profile support for i40e.** + + * Added loading pipeline personalization profile to i40e FW. + Resolved Issues ---------------
Signature · 1 line
2.5.5
v6 cover dynamic device profile support
In reply to Beilei XingDue to limited resources of X*710 (parser and analyzer configuration tables, number of packet classification types, number of packet types, filters configuration tables, etc.), it's impossible to simultaneously support all protocols/filters required for different parts on network. To enable protocols/filters extensions for X*710, new Admin Command for loading user defined configurations is added.
PPP is a format of extend configuration for X*710, it allows user to load user defined configuration to X*710.
List of possible use cases for extended X*710 configuration using profiles could include following:
Configuring Analyzer/Parser to support new protocols, e.g.
- IP L2TPv3 tunneling protocol
- IPSec ESP/AH protocols
- MPLSoGRE, MPLSoUDP tunnels
- GTP-C/GTP-U tunnels
New PCTYPEs for offloading packet classification to X*710. e.g.
- new IP Protocol in addition to TCP/UDP/SCTP
- new TCP/UDP subtypes, like TCP SYN, TCP FIN
- new PCTYPE for tunneled packets like GTP-C, GTP-U
New PTYPEs for packets identification, e.g.
- MAC, MPLS, IP4, UDP
- MAC, MPLS, MPLS, IP6, TCP
Fixes for NVM configuration, e.g.
- list of enabled stat counters to improve throughput
- parser/analyzer configuration for some corner cases
v6 changes:
Change pipeline personalization profile to dynamic device profile.
v5 changes:
Change parameter of rte_pmd_i40e_process_ppp_package to extend operation. Change structure rte_pmd_i40e_profile_info.
v4 changes:
Fix compile error with gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3). Move ppp related structures to rte_pmd_i40e.h.
Not support remove PPP temporarily.
v3 changes:
Move ppp AQ command code to base code.
Beilei Xing (6):
i40e/base: rename dynamic device profile net/i40e: add dynamic device profile processing app/testpmd: add command for loading a profile net/i40e: add get all loaded profiles app/testpmd: add command for getting loaded profiles
doc: add dynamic device profile support for i40e
app/test-pmd/cmdline.c | 164 +++++++++++++++++++++ app/test-pmd/config.c | 67 +++++++++ app/test-pmd/testpmd.h | 3 + doc/guides/rel_notes/release_17_05.rst | 4 + drivers/net/i40e/base/i40e_adminq_cmd.h | 18 +-- drivers/net/i40e/base/i40e_common.c | 32 ++--- drivers/net/i40e/base/i40e_prototype.h | 4 +- drivers/net/i40e/base/i40e_type.h | 28 ++-- drivers/net/i40e/i40e_ethdev.c | 227 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 70 +++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 2 + 11 files changed, 578 insertions(+), 41 deletions(-)
Signature · 1 line
2.5.5
PATCH v6 1/6 net/i40e/base: change ppp to ddp
Change pipeline personalization profile(ppp) to dynamic device profile(ddp).
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 18 +++++++++--------- drivers/net/i40e/base/i40e_common.c | 32 ++++++++++++++++---------------- drivers/net/i40e/base/i40e_prototype.h | 4 ++-- drivers/net/i40e/base/i40e_type.h | 28 ++++++++++++++-------------- 4 files changed, 41 insertions(+), 41 deletions(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +9 -9
@@ -199,9 +199,9 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_add_mirror_rule =0x0260 , i40e_aqc_opc_delete_mirror_rule =0x0261 , -/* Pipeline Personalization Profile */ - i40e_aqc_opc_write_personalization_profile =0x0270 , - i40e_aqc_opc_get_personalization_profile_list =0x0271 , +/* Dynamic Device Profile */ + i40e_aqc_opc_write_dynamic_device_profile =0x0270 , + i40e_aqc_opc_get_dynamic_device_profile_list =0x0271 ,/* DCB commands */ i40e_aqc_opc_dcb_ignore_pfc = 0x0301,
@@ -1538,8 +1538,8 @@ struct i40e_aqc_add_delete_mirror_rule_completion {I40E_CHECK_CMD_LENGTH (i40e_aqc_add_delete_mirror_rule_completion); -/* Pipeline Personalization Profile */ -struct i40e_aqc_write_personalization_profile { +/* Dynamic Device Profile */ +struct i40e_aqc_write_dynamic_device_profile {u8 flags;u8 reserved[3 ];__le32 profile_track_id;
@@ -1547,9 +1547,9 @@ struct i40e_aqc_write_personalization_profile {__le32 addr_low; }; -I40E_CHECK_CMD_LENGTH (i40e_aqc_write_personalization_profile); +I40E_CHECK_CMD_LENGTH (i40e_aqc_write_dynamic_device_profile); -struct i40e_aqc_write_ppp_resp { +struct i40e_aqc_write_ddp_resp {__le32 error_offset;__le32 error_info;__le32 addr_high;
@@ -1558,8 +1558,8 @@ struct i40e_aqc_write_ppp_resp {struct i40e_aqc_get_applied_profiles {u8 flags; -#define I40E_AQC_GET_PPP_GET_CONF 0x1 -#define I40E_AQC_GET_PPP_GET_RDPU_CONF 0x2 +#define I40E_AQC_GET_DDP_GET_CONF 0x1 +#define I40E_AQC_GET_DDP_GET_RDPU_CONF 0x2u8 rsv[3 ];__le32 reserved;__le32 addr_high;
drivers/net/i40e/base/i40e_common.c +16 -16
@@ -7155,7 +7155,7 @@ enum i40e_status_code i40e_aq_clear_all_wol_filters(struct i40e_hw *hw,/** -* i40e_aq_write_ppp - Write pipeline personalization profile (ppp) +* i40e_aq_write_ddp - Write dynamic device profile (ddp) * @hw: pointer to the hw struct * @buff: command buffer (size in bytes = buff_size) * @buff_size: buffer size in bytes
@@ -7165,20 +7165,20 @@ enum i40e_status_code i40e_aq_clear_all_wol_filters(struct i40e_hw *hw,* @cmd_details: pointer to command details structure or NULL **/ enum -i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +i40e_status_code i40e_aq_write_ddp (struct i40e_hw *hw,void *buff,u16 buff_size,u32 track_id,u32 *error_offset,u32 *error_info,struct i40e_asq_cmd_details *cmd_details) {struct i40e_aq_desc desc; -struct i40e_aqc_write_personalization_profile *cmd = - (struct i40e_aqc_write_personalization_profile *) +struct i40e_aqc_write_dynamic_device_profile *cmd = + (struct i40e_aqc_write_dynamic_device_profile *) &desc.params.raw; -struct i40e_aqc_write_ppp_resp *resp; +struct i40e_aqc_write_ddp_resp *resp;enum i40e_status_code status;i40e_fill_default_direct_cmd_desc (&desc, - i40e_aqc_opc_write_personalization_profile); + i40e_aqc_opc_write_dynamic_device_profile); desc.flags |=CPU_TO_LE16 (I40E_AQ_FLAG_BUF |I40E_AQ_FLAG_RD );if (buff_size >I40E_AQ_LARGE_BUF )
@@ -7190,7 +7190,7 @@ i40e_status_code i40e_aq_write_ppp(struct i40e_hw *hw, void *buff, status =i40e_asq_send_command (hw, &desc, buff, buff_size, cmd_details);if (!status) { - resp = (struct i40e_aqc_write_ppp_resp *)&desc.params.raw; + resp = (struct i40e_aqc_write_ddp_resp *)&desc.params.raw;if (error_offset) *error_offset =LE32_TO_CPU (resp->error_offset);if (error_info)
@@ -7201,14 +7201,14 @@ i40e_status_code i40e_aq_write_ppp(struct i40e_hw *hw, void *buff, }/** -* i40e_aq_get_ppp_list - Read pipeline personalization profile (ppp) +* i40e_aq_get_ddp_list - Read dynamic device profile (ddp) * @hw: pointer to the hw struct * @buff: command buffer (size in bytes = buff_size) * @buff_size: buffer size in bytes * @cmd_details: pointer to command details structure or NULL **/ enum -i40e_status_code i40e_aq_get_ppp_list (struct i40e_hw *hw,void *buff, +i40e_status_code i40e_aq_get_ddp_list (struct i40e_hw *hw,void *buff,u16 buff_size,u8 flags,struct i40e_asq_cmd_details *cmd_details) {
@@ -7218,7 +7218,7 @@ i40e_status_code i40e_aq_get_ppp_list(struct i40e_hw *hw, void *buff,enum i40e_status_code status;i40e_fill_default_direct_cmd_desc (&desc, - i40e_aqc_opc_get_personalization_profile_list); + i40e_aqc_opc_get_dynamic_device_profile_list); desc.flags |=CPU_TO_LE16 ((u16 )I40E_AQ_FLAG_BUF );if (buff_size >I40E_AQ_LARGE_BUF )
@@ -7297,7 +7297,7 @@ i40e_write_profile(struct i40e_hw *hw, struct i40e_profile_segment *profile,break ; }if (i == dev_cnt) { -i40e_debug (hw,I40E_DEBUG_PACKAGE ,"Device doesn't support PPP" ); +i40e_debug (hw,I40E_DEBUG_PACKAGE ,"Device doesn't support DDP" );return I40E_ERR_DEVICE_NOT_SUPPORTED ; }
@@ -7316,7 +7316,7 @@ i40e_write_profile(struct i40e_hw *hw, struct i40e_profile_segment *profile,sizeof (struct i40e_profile_section_header );/* Write profile */ - status =i40e_aq_write_ppp (hw, (void *)sec, (u16 )section_size, + status =i40e_aq_write_ddp (hw, (void *)sec, (u16 )section_size, track_id, &offset, &info,NULL );if (status) { i40e_debug(hw, I40E_DEBUG_PACKAGE,
@@ -7358,10 +7358,10 @@ i40e_add_pinfo_to_list(struct i40e_hw *hw, sec->section.offset); pinfo->track_id = track_id; pinfo->version = profile->version; - pinfo->op =I40E_PPP_ADD_TRACKID ; -memcpy (pinfo->name, profile->name,I40E_PPP_NAME_SIZE ); + pinfo->op =I40E_DDP_ADD_TRACKID ; +memcpy (pinfo->name, profile->name,I40E_DDP_NAME_SIZE ); - status =i40e_aq_write_ppp (hw, (void *)sec, sec->data_end, + status =i40e_aq_write_ddp (hw, (void *)sec, sec->data_end, track_id, &offset, &info,NULL );return status; -} +}
drivers/net/i40e/base/i40e_prototype.h +2 -2
@@ -565,11 +565,11 @@ enum i40e_status_code i40e_write_phy_register(struct i40e_hw *hw,u8 i40e_get_phy_address (struct i40e_hw *hw,u8 dev_num);enum i40e_status_code i40e_blink_phy_link_led (struct i40e_hw *hw,u32 time,u32 interval); -enum i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +enum i40e_status_code i40e_aq_write_ddp (struct i40e_hw *hw,void *buff,u16 buff_size,u32 track_id,u32 *error_offset,u32 *error_info,struct i40e_asq_cmd_details *cmd_details); -enum i40e_status_code i40e_aq_get_ppp_list (struct i40e_hw *hw,void *buff, +enum i40e_status_code i40e_aq_get_ddp_list (struct i40e_hw *hw,void *buff,u16 buff_size,u8 flags,struct i40e_asq_cmd_details *cmd_details); struct i40e_generic_seg_header *
drivers/net/i40e/base/i40e_type.h +14 -14
@@ -1880,19 +1880,19 @@ struct i40e_lldp_variables {#define I40E_FLEX_57_SHIFT 6#define I40E_FLEX_57_MASK (0x1ULL << I40E_FLEX_57_SHIFT) -/* Version format for PPP */ -struct i40e_ppp_version { +/* Version format for DDP */ +struct i40e_ddp_version {u8 major;u8 minor;u8 update;u8 draft; }; -#define I40E_PPP_NAME_SIZE 32 +#define I40E_DDP_NAME_SIZE 32/* Package header */ struct i40e_package_header { -struct i40e_ppp_version version; +struct i40e_ddp_version version;u32 segment_count;u32 segment_offset[1 ]; };
@@ -1904,16 +1904,16 @@ struct i40e_generic_seg_header {#define SEGMENT_TYPE_I40E 0x00000011#define SEGMENT_TYPE_X722 0x00000012u32 type; -struct i40e_ppp_version version; +struct i40e_ddp_version version;u32 size; -char name[I40E_PPP_NAME_SIZE ]; +char name[I40E_DDP_NAME_SIZE ]; };struct i40e_metadata_segment {struct i40e_generic_seg_header header; -struct i40e_ppp_version version; +struct i40e_ddp_version version;u32 track_id; -char name[I40E_PPP_NAME_SIZE ]; +char name[I40E_DDP_NAME_SIZE ]; };struct i40e_device_id_entry {
@@ -1923,8 +1923,8 @@ struct i40e_device_id_entry {struct i40e_profile_segment {struct i40e_generic_seg_header header; -struct i40e_ppp_version version; -char name[I40E_PPP_NAME_SIZE ]; +struct i40e_ddp_version version; +char name[I40E_DDP_NAME_SIZE ];u32 device_table_count;struct i40e_device_id_entry device_table[1 ]; };
@@ -1951,11 +1951,11 @@ struct i40e_profile_section_header {struct i40e_profile_info {u32 track_id; -struct i40e_ppp_version version; +struct i40e_ddp_version version;u8 op; -#define I40E_PPP_ADD_TRACKID 0x01 -#define I40E_PPP_REMOVE_TRACKID 0x02 +#define I40E_DDP_ADD_TRACKID 0x01 +#define I40E_DDP_REMOVE_TRACKID 0x02u8 reserved[7 ]; -u8 name[I40E_PPP_NAME_SIZE ]; +u8 name[I40E_DDP_NAME_SIZE ]; };#endif /* _I40E_TYPE_H_ */
Signature · 1 line
2.5.5
PATCH v6 2/6 net/i40e: add dynamic device profile processing
In reply to Beilei XingAdd support for adding a dynamic device profile.
--- drivers/net/i40e/i40e_ethdev.c | 199 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 58 +++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 258 insertions(+)
drivers/net/i40e/i40e_ethdev.c +199 -0
@@ -11708,3 +11708,202 @@ rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map)return ret; } + +static void +i40e_generate_profile_info_sec (char *name,struct i40e_ddp_version *version, +uint32_t track_id,uint8_t *profile_info_sec, +bool add) +{ +struct i40e_profile_section_header *sec =NULL ; +struct i40e_profile_info *pinfo; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; +memcpy (pinfo->name, name,I40E_DDP_NAME_SIZE ); +memcpy (&pinfo->version, version,sizeof (struct i40e_ddp_version )); +if (add) + pinfo->op =I40E_DDP_ADD_TRACKID ; +else + pinfo->op =I40E_DDP_REMOVE_TRACKID ; +} + +static enum i40e_status_code +i40e_add_rm_profile_info (struct i40e_hw *hw,uint8_t *profile_info_sec) +{ +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec; +uint32_t track_id; +uint32_t offset =0 , info =0 ; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + track_id = ((struct i40e_profile_info *)(profile_info_sec + + sec->section.offset))->track_id; + + status =i40e_aq_write_ddp (hw, (void *)sec, sec->data_end, + track_id, &offset, &info,NULL ); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add/remove profile info: " +"offset %d, info %d" , + offset, info); + +return status; +} + +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + +/* Check if the profile info exists */ +static int +i40e_check_profile_info (uint8_t port,uint8_t *profile_info_sec) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port]; +struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +uint8_t *buff; +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *pinfo, *p; +uint32_t i; +int ret; + + buff =rte_zmalloc ("pinfo_list" , + (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 ), +0 ); +if (!buff) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return -1 ; + } + + ret =i40e_aq_get_ddp_list (hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 ), +0 ,NULL ); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to get profile info list." ); +rte_free (buff); +return -1 ; + } + p_list = (struct rte_pmd_i40e_profile_list *)buff; + pinfo = (struct rte_pmd_i40e_profile_info *)(profile_info_sec + +sizeof (struct i40e_profile_section_header )); +for (i =0 ; i < p_list->p_count; i++) { + p = &p_list->p_info[i]; +if ((pinfo->track_id == p->track_id) && + !memcmp (&pinfo->version, &p->version, +sizeof (struct i40e_ddp_version )) && + !memcmp (&pinfo->name, &p->name, +I40E_DDP_NAME_SIZE )) { +PMD_DRV_LOG (INFO ,"Profile exists." ); +rte_free (buff); +return 1 ; + } + } + +rte_free (buff); +return 0 ; +} + +int +rte_pmd_i40e_process_ddp_package (uint8_t port,uint8_t *buff, +uint32_t size, +enum rte_pmd_i40e_package_op op) +{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +int is_exist; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (size < (sizeof (struct i40e_package_header ) + +sizeof (struct i40e_metadata_segment ) + +sizeof (uint32_t ) *2 )) { +PMD_DRV_LOG (ERR ,"Buff is invalid." ); +return -EINVAL ; + } + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +if (pkg_hdr->segment_count <2 ) { +PMD_DRV_LOG (ERR ,"Segment_count should be 2 at least." ); +return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_METADATA , + pkg_hdr); +if (!metadata_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find metadata segment header" ); +return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment *)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_I40E , + pkg_hdr); +if (!profile_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find profile segment header" ); +return -EINVAL ; + } + + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); +if (!profile_info_sec) { +PMD_DRV_LOG (ERR ,"Failed to allocate memory" ); +return -EINVAL ; + } + +if (op ==RTE_PMD_I40E_PKG_OP_WR_ADD ) { +/* Check if the profile exists */ +i40e_generate_profile_info_sec ( + ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)->version, + track_id, profile_info_sec,1 ); + is_exist =i40e_check_profile_info (port, profile_info_sec); +if (is_exist) { +PMD_DRV_LOG (ERR ,"Profile already exists." ); +rte_free (profile_info_sec); +return 1 ; + } + +/* Write profile to HW */ + status =i40e_write_profile (hw, + (struct i40e_profile_segment *)profile_seg_hdr, + track_id); +if (status) +PMD_DRV_LOG (ERR ,"Failed to write profile." ); + +/* Add profile info to info list */ + status =i40e_add_rm_profile_info (hw, profile_info_sec); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add profile info." ); + }else +PMD_DRV_LOG (ERR ,"Operation not supported." ); + +rte_free (profile_info_sec); +return status; +}
drivers/net/i40e/rte_pmd_i40e.h +58 -0
68 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -30,5 +30,6 @@ DPDK_17.05 { rte_pmd_i40e_set_vf_max_bw; rte_pmd_i40e_set_vf_tc_bw_alloc; rte_pmd_i40e_set_vf_tc_max_bw; + rte_pmd_i40e_process_ddp_package; } DPDK_17.02;
Signature · 1 line
2.5.5
PATCH v6 3/6 app/testpmd: add command for loading a profile
In reply to Beilei XingThis patch is to add testpmd CLI for loading a dynamic device profile.
--- app/test-pmd/cmdline.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 3 +++ 3 files changed, 143 insertions(+)
app/test-pmd/cmdline.c +73 -0
@@ -590,6 +590,9 @@ static void cmd_help_long_parsed(void *parsed_result,"E-tag set filter del e-tag-id (value) port (port_id)\n" " Delete an E-tag forwarding filter on a port\n\n" +"add ddp (port_id) (profile_path)\n" +" Load a profile package on a port\n\n" + ,list_pkt_forwarding_modes () ); }
@@ -12739,6 +12742,75 @@ cmdline_parse_inst_t cmd_strict_link_prio = { }, }; +/* Load Dynamic Device Profile */ +struct cmd_add_ddp_result { +cmdline_fixed_string_t add; +cmdline_fixed_string_t ddp; +uint8_t port_id; +char filepath[]; +}; + +cmdline_parse_token_string_t cmd_add_ddp_add = + TOKEN_STRING_INITIALIZER(struct cmd_add_ddp_result, add, "add"); +cmdline_parse_token_string_t cmd_add_ddp_ddp = + TOKEN_STRING_INITIALIZER(struct cmd_add_ddp_result, ddp, "ddp"); +cmdline_parse_token_num_t cmd_add_ddp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_add_ddp_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_add_ddp_filepath = + TOKEN_STRING_INITIALIZER(struct cmd_add_ddp_result, filepath, NULL); + +static void +cmd_add_ddp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_add_ddp_result *res = parsed_result; +uint8_t *buff; +uint32_t size; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +if (!all_ports_stopped ()) { +printf ("Please stop all ports first\n" ); +return ; + } + + buff =open_ddp_package_file (res->filepath, &size); +if (!buff) +return ; + +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_process_ddp_package (res->port_id, + buff, size, +RTE_PMD_I40E_PKG_OP_WR_ADD ); +#endif + +if (ret <0 ) +printf ("Failed to load profile.\n" ); +else if (ret >0 ) +printf ("Profile has already existed.\n" ); + +close_ddp_package_file (buff); +} + +cmdline_parse_inst_t cmd_add_ddp = { + .f = cmd_add_ddp_parsed, + .data =NULL , + .help_str ="add/remove ddp <port_id> <profile_path>" , + .tokens = { + (void *)&cmd_add_ddp_add, + (void *)&cmd_add_ddp_ddp, + (void *)&cmd_add_ddp_port_id, + (void *)&cmd_add_ddp_filepath, +NULL , + }, +};/* ******************************************************************************** */
@@ -12919,6 +12991,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_vf_tc_min_bw, (cmdline_parse_inst_t *)&cmd_vf_tc_max_bw, (cmdline_parse_inst_t *)&cmd_strict_link_prio, + (cmdline_parse_inst_t *)&cmd_add_ddp, NULL, };
app/test-pmd/config.c +67 -0
70 lines not on this page · raw message
app/test-pmd/testpmd.h +3 -0
@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);void mcast_addr_remove (uint8_t port_id,struct ether_addr *mc_addr);void port_dcb_info_display (uint8_t port_id); +uint8_t *open_ddp_package_file (const char *file_path,uint32_t *size); +int close_ddp_package_file (uint8_t *buf); +enum print_warning {ENABLED_WARN =0 ,DISABLED_WARN
Signature · 1 line
2.5.5
PATCH v6 4/6 net/i40e: add get all loaded profiles
In reply to Beilei XingThis patch is to add get all loaded profiles function.
--- drivers/net/i40e/i40e_ethdev.c | 28 ++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 12 ++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 41 insertions(+)
drivers/net/i40e/i40e_ethdev.c +28 -0
@@ -11709,6 +11709,9 @@ rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map)return ret; } +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + static void i40e_generate_profile_info_sec(char *name, struct i40e_ddp_version *version, uint32_t track_id, uint8_t *profile_info_sec,
@@ -11907,3 +11910,28 @@ rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,rte_free (profile_info_sec);return status; } + +int +rte_pmd_i40e_get_ddp_list (uint8_t port,uint8_t *buff,uint32_t size) +{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + +if (size < (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 )) +return -EINVAL ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + + status =i40e_aq_get_ddp_list (hw, (void *)buff, + size,0 ,NULL ); + +return status; +}
drivers/net/i40e/rte_pmd_i40e.h +12 -0
@@ -476,4 +476,16 @@ int rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,uint32_t size, enum rte_pmd_i40e_package_op op); +/** +* rte_pmd_i40e_get_ddp_list - Get loaded profile list +* @port: port id +* @buff: buffer for response +* @size: buffer size +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_get_ddp_list (uint8_t port,uint8_t *buff,uint32_t size); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -31,5 +31,6 @@ DPDK_17.05 { rte_pmd_i40e_set_vf_tc_bw_alloc; rte_pmd_i40e_set_vf_tc_max_bw; rte_pmd_i40e_process_ddp_package; + rte_pmd_i40e_get_ddp_list; } DPDK_17.02;
Signature · 1 line
2.5.5
PATCH v6 5/6 app/testpmd: add command for getting loaded profiles
In reply to Beilei XingThis patch is to add testpmd CLI for getting all loaded profiles.
--- app/test-pmd/cmdline.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+)
app/test-pmd/cmdline.c +91 -0
@@ -214,6 +214,9 @@ static void cmd_help_long_parsed(void *parsed_result,"read txd (port_id) (queue_id) (txd_id)\n" " Display a TX descriptor of a port TX queue.\n\n" + +"get ddp list (port_id)\n" +" Get ddp profile info list\n\n" ); }
@@ -12812,6 +12815,93 @@ cmdline_parse_inst_t cmd_add_ddp = { }, }; +/* Get Dynamic Device Profile list*/ +#define PROFILE_INFO_SIZE 48 +#define MAX_PROFILE_NUM 16 + +struct cmd_get_ddp_list_result { +cmdline_fixed_string_t get; +cmdline_fixed_string_t ddp; +cmdline_fixed_string_t list; +uint8_t port_id; +}; + +cmdline_parse_token_string_t cmd_get_ddp_list_get = + TOKEN_STRING_INITIALIZER(struct cmd_get_ddp_list_result, get, "get"); +cmdline_parse_token_string_t cmd_get_ddp_list_ddp = + TOKEN_STRING_INITIALIZER(struct cmd_get_ddp_list_result, ddp, "ddp"); +cmdline_parse_token_string_t cmd_get_ddp_list_list = + TOKEN_STRING_INITIALIZER(struct cmd_get_ddp_list_result, list, "list"); +cmdline_parse_token_num_t cmd_get_ddp_list_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_get_ddp_list_result, port_id, UINT8); + +static void +cmd_get_ddp_list_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_get_ddp_list_result *res = parsed_result; +#ifdef RTE_LIBRTE_I40E_PMD +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *p_info; +uint32_t p_num; +uint32_t size; +uint32_t i; +#endif +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +#ifdef RTE_LIBRTE_I40E_PMD + size =PROFILE_INFO_SIZE *MAX_PROFILE_NUM +4 ; + p_list = (struct rte_pmd_i40e_profile_list *)malloc (size); +if (!p_list) +printf ("%s: Failed to malloc buffer\n" , __func__); + +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_get_ddp_list (res->port_id, + (uint8_t *)p_list, size); + +if (!ret) { + p_num = p_list->p_count; +printf ("Profile number is: %d\n\n" , p_num); + +for (i =0 ; i < p_num; i++) { + p_info = &p_list->p_info[i]; +printf ("Profile %d:\n" , i); +printf ("Track id: 0x%x\n" , p_info->track_id); +printf ("Version: %d.%d.%d.%d \n" , + p_info->version.major, + p_info->version.minor, + p_info->version.update, + p_info->version.draft); +printf ("Profile name: %s\n\n" , p_info->name); + } + } + +free (p_list); +#endif + +if (ret <0 ) +printf ("Failed to get ddp list\n" ); +} + +cmdline_parse_inst_t cmd_get_ddp_list = { + .f = cmd_get_ddp_list_parsed, + .data =NULL , + .help_str ="get ddp list <port_id>" , + .tokens = { + (void *)&cmd_get_ddp_list_get, + (void *)&cmd_get_ddp_list_ddp, + (void *)&cmd_get_ddp_list_list, + (void *)&cmd_get_ddp_list_port_id, +NULL , + }, +};/* ******************************************************************************** */ /* list of instructions */
@@ -12992,6 +13082,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_vf_tc_max_bw, (cmdline_parse_inst_t *)&cmd_strict_link_prio, (cmdline_parse_inst_t *)&cmd_add_ddp, + (cmdline_parse_inst_t *)&cmd_get_ddp_list, NULL, };
Signature · 1 line
2.5.5
PATCH v6 6/6 doc: add dynamic device profile support for i40e
In reply to Beilei Xing--- doc/guides/rel_notes/release_17_05.rst | 4 ++++ 1 file changed, 4 insertions(+)
doc/guides/rel_notes/release_17_05.rst +4 -0
@@ -133,6 +133,10 @@ New Features Data Ring, ability to register memory regions. +* **Added dynamic device profile support for i40e.** + + * Added loading dynamic device profile to i40e FW. + Resolved Issues ---------------
Signature · 1 line
2.5.5
Re: [PATCH v6 2/6] net/i40e: add dynamic device profile processing
In reply to Beilei XingLooks good to me, only minor comments like below:
Quoted 51 lines
-----Original Message-----
From: Xing, Beilei
Sent: Wednesday, March 29, 2017 8:27 PM
To: Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]
Subject: [PATCH v6 2/6] net/i40e: add dynamic device profile processingAdd support for adding a dynamic device profile.
Signed-off-by Beilei Xing <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 199 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 58 +++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 258 insertions(+)drivers/net/i40e/i40e_ethdev.c +24
-0@@ -11708,3 +11708,202 @@ rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map)return ret; } + +static void +i40e_generate_profile_info_sec (char *name,struct i40e_ddp_version *version, +uint32_t track_id,uint8_t *profile_info_sec, +bool add) +{ +struct i40e_profile_section_header *sec =NULL ; +struct i40e_profile_info *pinfo; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; +memcpy (pinfo->name, name,I40E_DDP_NAME_SIZE ); +memcpy (&pinfo->version, version,sizeof (struct i40e_ddp_version )); +if (add) + pinfo->op =I40E_DDP_ADD_TRACKID ; +else
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_set_tc_strict_prio(uint8_t port, · line 11744
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+ pinfo->op =I40E_DDP_REMOVE_TRACKID ; +} + +static enum i40e_status_code +i40e_add_rm_profile_info (struct i40e_hw *hw,uint8_t *profile_info_sec) +{ +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec; +uint32_t track_id; +uint32_t offset =0 , info =0 ;
Cannot set more than one vars in one line according to the coding style. uint32_t offset = 0;uint32_t info = 0;
Quoted 119 lines
drivers/net/i40e/i40e_ethdev.c +5
-0+/* Check if the profile info exists */ +static int +i40e_check_profile_info (uint8_t port,uint8_t *profile_info_sec) { +struct rte_eth_dev *dev = &rte_eth_devices[port]; + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-Quoted 1 line
dev_private);drivers/net/i40e/i40e_ethdev.c +8
-0+uint8_t *buff; +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *pinfo, *p; +uint32_t i; +int ret; + + buff = rte_zmalloc("pinfo_list", + (I40E_PROFILE_INFO_SIZE *
I40E_MAX_PROFILE_NUM+ 4),drivers/net/i40e/i40e_ethdev.c +79
-0+ 0); +if (!buff) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return -1 ; + } + + ret =i40e_aq_get_ddp_list (hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 ), +0 ,NULL ); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to get profile info list." ); +rte_free (buff); +return -1 ; + } + p_list = (struct rte_pmd_i40e_profile_list *)buff; + pinfo = (struct rte_pmd_i40e_profile_info *)(profile_info_sec + +sizeof (struct i40e_profile_section_header )); +for (i =0 ; i < p_list->p_count; i++) { + p = &p_list->p_info[i]; +if ((pinfo->track_id == p->track_id) && + !memcmp (&pinfo->version, &p->version, +sizeof (struct i40e_ddp_version )) && + !memcmp (&pinfo->name, &p->name, +I40E_DDP_NAME_SIZE )) { +PMD_DRV_LOG (INFO ,"Profile exists." ); +rte_free (buff); +return 1 ; + } + } + +rte_free (buff); +return 0 ; +} + +int +rte_pmd_i40e_process_ddp_package (uint8_t port,uint8_t *buff, +uint32_t size, +enum rte_pmd_i40e_package_op op) +{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +int is_exist; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (size < (sizeof (struct i40e_package_header ) + +sizeof (struct i40e_metadata_segment ) + +sizeof (uint32_t ) *2 )) { +PMD_DRV_LOG (ERR ,"Buff is invalid." ); +return -EINVAL ; + } + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +if (pkg_hdr->segment_count <2 ) { +PMD_DRV_LOG (ERR ,"Segment_count should be 2 at least." ); +return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_METADATA,
drivers/net/i40e/i40e_ethdev.c +3
-0+ pkg_hdr); +if (!metadata_seg_hdr) { + PMD_DRV_LOG(ERR, "Failed to find metadata segmentheader");
drivers/net/i40e/i40e_ethdev.c +20
-0+return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment +*)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_I40E , + pkg_hdr); +if (!profile_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find profile segment header" ); +return -EINVAL ; + } + + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); +if (!profile_info_sec) { +PMD_DRV_LOG (ERR ,"Failed to allocate memory" ); +return -EINVAL ;
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map) · line 11887
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+ } + +if (op ==RTE_PMD_I40E_PKG_OP_WR_ADD ) { +/* Check if the profile exists */ +i40e_generate_profile_info_sec ( + ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)->version, + track_id, profile_info_sec,1 ); + is_exist =i40e_check_profile_info (port, profile_info_sec); +if (is_exist) {
The i40e_check_profile_info also has a return value like "-1". It doesn't mean profile exists, right?
Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +4
-0+PMD_DRV_LOG (ERR ,"Profile already exists." ); +rte_free (profile_info_sec); +return 1 ; + }
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map) · line 11901
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+ +/* Write profile to HW */ + status =i40e_write_profile (hw, + (struct i40e_profile_segment *)profile_seg_hdr, + track_id); +if (status) +PMD_DRV_LOG (ERR ,"Failed to write profile." ); + +/* Add profile info to info list */ + status =i40e_add_rm_profile_info (hw, profile_info_sec);
If i40e_write_profile failed, do we still need to add profile info?
Re: [PATCH v6 2/6] net/i40e: add dynamic device profile processing
Quoted 70 lines
-----Original Message-----
From: Wu, Jingjing
Sent: Wednesday, March 29, 2017 9:17 PM
To: Xing, Beilei <[email protected]>
Cc: Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]
Subject: RE: [PATCH v6 2/6] net/i40e: add dynamic device profile processingLooks good to me, only minor comments like below:
Quoted 24 lines
-----Original Message-----
From: Xing, Beilei
Sent: Wednesday, March 29, 2017 8:27 PM
To: Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; Iremonger, Bernard <[email protected]>; [email protected]
Subject: [PATCH v6 2/6] net/i40e: add dynamic device profile processingAdd support for adding a dynamic device profile.
Signed-off-by Beilei Xing <[email protected]>--- drivers/net/i40e/i40e_ethdev.c | 199 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 58 +++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 258 insertions(+)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_ethdev.cindex 2063603..764764f 100644drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_set_tc_strict_prio(uint8_t
Quoted 7 lines
drivers/net/i40e/i40e_ethdev.c +3
-0@@ -11708,3 +11708,202 @@ rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map)return ret; } + +static void +i40e_generate_profile_info_sec(char *name, struct i40e_ddp_version*version,
Quoted 26 lines
drivers/net/i40e/i40e_ethdev.c +26
-0+ uint32_t track_id, uint8_t *profile_info_sec, + bool add) +{ + struct i40e_profile_section_header *sec = NULL; +struct i40e_profile_info *pinfo; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; +memcpy (pinfo->name, name,I40E_DDP_NAME_SIZE ); +memcpy (&pinfo->version, version,sizeof (struct i40e_ddp_version )); +if (add) + pinfo->op =I40E_DDP_ADD_TRACKID ; +else + pinfo->op =I40E_DDP_REMOVE_TRACKID ; } + +static enum i40e_status_code +i40e_add_rm_profile_info (struct i40e_hw *hw,uint8_t +*profile_info_sec) {
Quoted 9 lines
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map) · line 11744
Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +4
-0+enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec; +uint32_t track_id; +uint32_t offset =0 , info =0 ;Cannot set more than one vars in one line according to the coding style.
uint32_toffset = 0;uint32_tinfo = 0;
OK, thanks.
Quoted 124 lines
Quoted 124 lines
drivers/net/i40e/i40e_ethdev.c +4
-0+/* Check if the profile info exists */ static int +i40e_check_profile_info (uint8_t port,uint8_t *profile_info_sec) { +struct rte_eth_dev *dev = &rte_eth_devices[port]; + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-Quoted 1 line
dev_private);drivers/net/i40e/i40e_ethdev.c +8
-0+uint8_t *buff; +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *pinfo, *p; +uint32_t i; +int ret; + + buff = rte_zmalloc("pinfo_list", + (I40E_PROFILE_INFO_SIZE *
I40E_MAX_PROFILE_NUM+ 4),drivers/net/i40e/i40e_ethdev.c +78
-0+ 0); +if (!buff) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return -1 ; + } + + ret =i40e_aq_get_ddp_list (hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 ), +0 ,NULL ); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to get profile info list." ); +rte_free (buff); +return -1 ; + } + p_list = (struct rte_pmd_i40e_profile_list *)buff; + pinfo = (struct rte_pmd_i40e_profile_info *)(profile_info_sec + +sizeof (struct i40e_profile_section_header )); +for (i =0 ; i < p_list->p_count; i++) { + p = &p_list->p_info[i]; +if ((pinfo->track_id == p->track_id) && + !memcmp (&pinfo->version, &p->version, +sizeof (struct i40e_ddp_version )) && + !memcmp (&pinfo->name, &p->name, +I40E_DDP_NAME_SIZE )) { +PMD_DRV_LOG (INFO ,"Profile exists." ); +rte_free (buff); +return 1 ; + } + } + +rte_free (buff); +return 0 ; +} + +int +rte_pmd_i40e_process_ddp_package (uint8_t port,uint8_t *buff, +uint32_t size, +enum rte_pmd_i40e_package_op op) { +struct rte_eth_dev *dev; +struct i40e_hw *hw; +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +int is_exist; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (size < (sizeof (struct i40e_package_header ) + +sizeof (struct i40e_metadata_segment ) + +sizeof (uint32_t ) *2 )) { +PMD_DRV_LOG (ERR ,"Buff is invalid." ); +return -EINVAL ; + } + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +if (pkg_hdr->segment_count <2 ) { +PMD_DRV_LOG (ERR ,"Segment_count should be 2 at least." ); +return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package(SEGMENT_TYPE_METADATA,
drivers/net/i40e/i40e_ethdev.c +3
-0+ pkg_hdr); +if (!metadata_seg_hdr) { + PMD_DRV_LOG(ERR, "Failed to find metadata segmentheader");
drivers/net/i40e/i40e_ethdev.c +25
-0+return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment +*)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_I40E , + pkg_hdr); +if (!profile_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find profile segment header" ); +return -EINVAL ; + } + + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); +if (!profile_info_sec) { +PMD_DRV_LOG (ERR ,"Failed to allocate memory" ); +return -EINVAL ; + } + +if (op ==RTE_PMD_I40E_PKG_OP_WR_ADD ) { +/* Check if the profile exists */ + i40e_generate_profile_info_sec(
Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map) · line 11887
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c +5
-0+ ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)->version, + track_id, profile_info_sec, 1); + is_exist =i40e_check_profile_info (port, profile_info_sec); +if (is_exist) {The
i40e_check_profile_infoalso has a return value like "-1". It doesn't mean profile exists, right?
Yes, only "1" means profile exists.
Quoted 16 lines
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c +4
-0+PMD_DRV_LOG (ERR ,"Profile already exists." ); +rte_free (profile_info_sec); +return 1 ; + }drivers/net/i40e/i40e_ethdev.c rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map) · line 11901
Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10
-0+ +/* Write profile to HW */ + status =i40e_write_profile (hw, + (struct i40e_profile_segment *)profile_seg_hdr, + track_id); +if (status) +PMD_DRV_LOG (ERR ,"Failed to write profile." ); + +/* Add profile info to info list */ + status =i40e_add_rm_profile_info (hw, profile_info_sec);If
i40e_write_profilefailed, do we still need to add profile info?
No, I missed the condition, thanks for catching it.
Quoted 2 lines
v7 cover dynamic device profile support
In reply to Beilei XingDue to limited resources of X*710 (parser and analyzer configuration tables, number of packet classification types, number of packet types, filters configuration tables, etc.), it's impossible to simultaneously support all protocols/filters required for different parts on network. To enable protocols/filters extensions for X*710, new Admin Command for loading user defined configurations is added.
PPP is a format of extend configuration for X*710, it allows user to load user defined configuration to X*710.
List of possible use cases for extended X*710 configuration using profiles could include following:
Configuring Analyzer/Parser to support new protocols, e.g.
- IP L2TPv3 tunneling protocol
- IPSec ESP/AH protocols
- MPLSoGRE, MPLSoUDP tunnels
- GTP-C/GTP-U tunnels
New PCTYPEs for offloading packet classification to X*710. e.g.
- new IP Protocol in addition to TCP/UDP/SCTP
- new TCP/UDP subtypes, like TCP SYN, TCP FIN
- new PCTYPE for tunneled packets like GTP-C, GTP-U
New PTYPEs for packets identification, e.g.
- MAC, MPLS, IP4, UDP
- MAC, MPLS, MPLS, IP6, TCP
Fixes for NVM configuration, e.g.
- list of enabled stat counters to improve throughput
- parser/analyzer configuration for some corner cases
v7 changes:
Fix one coding style problem.
Add condition during ddp processing.
v6 changes:
Change pipeline personalization profile to dynamic device profile.
v5 changes:
Change parameter of rte_pmd_i40e_process_ppp_package to extend operation. Change structure rte_pmd_i40e_profile_info.
v4 changes:
Fix compile error with gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3). Move ppp related structures to rte_pmd_i40e.h.
Not support remove PPP temporarily.
v3 changes:
Move ppp AQ command code to base code.
Beilei Xing (6):
net/i40e/base: change ppp to ddp
net/i40e: add dynamic device profile processing app/testpmd: add command for loading a profile net/i40e: add get all loaded profiles app/testpmd: add command for getting loaded profiles
doc: add dynamic device profile support for i40e
app/test-pmd/cmdline.c | 164 +++++++++++++++++++++ app/test-pmd/config.c | 67 +++++++++ app/test-pmd/testpmd.h | 3 + doc/guides/rel_notes/release_17_05.rst | 4 + drivers/net/i40e/base/i40e_adminq_cmd.h | 18 +-- drivers/net/i40e/base/i40e_common.c | 32 ++-- drivers/net/i40e/base/i40e_prototype.h | 4 +- drivers/net/i40e/base/i40e_type.h | 28 ++-- drivers/net/i40e/i40e_ethdev.c | 235 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 70 +++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 2 + 11 files changed, 586 insertions(+), 41 deletions(-)
Signature · 1 line
2.5.5
PATCH v7 1/6 net/i40e/base: change ppp to ddp
Change pipeline personalization profile(ppp) to dynamic device profile(ddp).
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 18 +++++++++--------- drivers/net/i40e/base/i40e_common.c | 32 ++++++++++++++++---------------- drivers/net/i40e/base/i40e_prototype.h | 4 ++-- drivers/net/i40e/base/i40e_type.h | 28 ++++++++++++++-------------- 4 files changed, 41 insertions(+), 41 deletions(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +9 -9
@@ -199,9 +199,9 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_add_mirror_rule =0x0260 , i40e_aqc_opc_delete_mirror_rule =0x0261 , -/* Pipeline Personalization Profile */ - i40e_aqc_opc_write_personalization_profile =0x0270 , - i40e_aqc_opc_get_personalization_profile_list =0x0271 , +/* Dynamic Device Profile */ + i40e_aqc_opc_write_dynamic_device_profile =0x0270 , + i40e_aqc_opc_get_dynamic_device_profile_list =0x0271 ,/* DCB commands */ i40e_aqc_opc_dcb_ignore_pfc = 0x0301,
@@ -1538,8 +1538,8 @@ struct i40e_aqc_add_delete_mirror_rule_completion {I40E_CHECK_CMD_LENGTH (i40e_aqc_add_delete_mirror_rule_completion); -/* Pipeline Personalization Profile */ -struct i40e_aqc_write_personalization_profile { +/* Dynamic Device Profile */ +struct i40e_aqc_write_dynamic_device_profile {u8 flags;u8 reserved[3 ];__le32 profile_track_id;
@@ -1547,9 +1547,9 @@ struct i40e_aqc_write_personalization_profile {__le32 addr_low; }; -I40E_CHECK_CMD_LENGTH (i40e_aqc_write_personalization_profile); +I40E_CHECK_CMD_LENGTH (i40e_aqc_write_dynamic_device_profile); -struct i40e_aqc_write_ppp_resp { +struct i40e_aqc_write_ddp_resp {__le32 error_offset;__le32 error_info;__le32 addr_high;
@@ -1558,8 +1558,8 @@ struct i40e_aqc_write_ppp_resp {struct i40e_aqc_get_applied_profiles {u8 flags; -#define I40E_AQC_GET_PPP_GET_CONF 0x1 -#define I40E_AQC_GET_PPP_GET_RDPU_CONF 0x2 +#define I40E_AQC_GET_DDP_GET_CONF 0x1 +#define I40E_AQC_GET_DDP_GET_RDPU_CONF 0x2u8 rsv[3 ];__le32 reserved;__le32 addr_high;
drivers/net/i40e/base/i40e_common.c +16 -16
@@ -7155,7 +7155,7 @@ enum i40e_status_code i40e_aq_clear_all_wol_filters(struct i40e_hw *hw,/** -* i40e_aq_write_ppp - Write pipeline personalization profile (ppp) +* i40e_aq_write_ddp - Write dynamic device profile (ddp) * @hw: pointer to the hw struct * @buff: command buffer (size in bytes = buff_size) * @buff_size: buffer size in bytes
@@ -7165,20 +7165,20 @@ enum i40e_status_code i40e_aq_clear_all_wol_filters(struct i40e_hw *hw,* @cmd_details: pointer to command details structure or NULL **/ enum -i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +i40e_status_code i40e_aq_write_ddp (struct i40e_hw *hw,void *buff,u16 buff_size,u32 track_id,u32 *error_offset,u32 *error_info,struct i40e_asq_cmd_details *cmd_details) {struct i40e_aq_desc desc; -struct i40e_aqc_write_personalization_profile *cmd = - (struct i40e_aqc_write_personalization_profile *) +struct i40e_aqc_write_dynamic_device_profile *cmd = + (struct i40e_aqc_write_dynamic_device_profile *) &desc.params.raw; -struct i40e_aqc_write_ppp_resp *resp; +struct i40e_aqc_write_ddp_resp *resp;enum i40e_status_code status;i40e_fill_default_direct_cmd_desc (&desc, - i40e_aqc_opc_write_personalization_profile); + i40e_aqc_opc_write_dynamic_device_profile); desc.flags |=CPU_TO_LE16 (I40E_AQ_FLAG_BUF |I40E_AQ_FLAG_RD );if (buff_size >I40E_AQ_LARGE_BUF )
@@ -7190,7 +7190,7 @@ i40e_status_code i40e_aq_write_ppp(struct i40e_hw *hw, void *buff, status =i40e_asq_send_command (hw, &desc, buff, buff_size, cmd_details);if (!status) { - resp = (struct i40e_aqc_write_ppp_resp *)&desc.params.raw; + resp = (struct i40e_aqc_write_ddp_resp *)&desc.params.raw;if (error_offset) *error_offset =LE32_TO_CPU (resp->error_offset);if (error_info)
@@ -7201,14 +7201,14 @@ i40e_status_code i40e_aq_write_ppp(struct i40e_hw *hw, void *buff, }/** -* i40e_aq_get_ppp_list - Read pipeline personalization profile (ppp) +* i40e_aq_get_ddp_list - Read dynamic device profile (ddp) * @hw: pointer to the hw struct * @buff: command buffer (size in bytes = buff_size) * @buff_size: buffer size in bytes * @cmd_details: pointer to command details structure or NULL **/ enum -i40e_status_code i40e_aq_get_ppp_list (struct i40e_hw *hw,void *buff, +i40e_status_code i40e_aq_get_ddp_list (struct i40e_hw *hw,void *buff,u16 buff_size,u8 flags,struct i40e_asq_cmd_details *cmd_details) {
@@ -7218,7 +7218,7 @@ i40e_status_code i40e_aq_get_ppp_list(struct i40e_hw *hw, void *buff,enum i40e_status_code status;i40e_fill_default_direct_cmd_desc (&desc, - i40e_aqc_opc_get_personalization_profile_list); + i40e_aqc_opc_get_dynamic_device_profile_list); desc.flags |=CPU_TO_LE16 ((u16 )I40E_AQ_FLAG_BUF );if (buff_size >I40E_AQ_LARGE_BUF )
@@ -7297,7 +7297,7 @@ i40e_write_profile(struct i40e_hw *hw, struct i40e_profile_segment *profile,break ; }if (i == dev_cnt) { -i40e_debug (hw,I40E_DEBUG_PACKAGE ,"Device doesn't support PPP" ); +i40e_debug (hw,I40E_DEBUG_PACKAGE ,"Device doesn't support DDP" );return I40E_ERR_DEVICE_NOT_SUPPORTED ; }
@@ -7316,7 +7316,7 @@ i40e_write_profile(struct i40e_hw *hw, struct i40e_profile_segment *profile,sizeof (struct i40e_profile_section_header );/* Write profile */ - status =i40e_aq_write_ppp (hw, (void *)sec, (u16 )section_size, + status =i40e_aq_write_ddp (hw, (void *)sec, (u16 )section_size, track_id, &offset, &info,NULL );if (status) { i40e_debug(hw, I40E_DEBUG_PACKAGE,
@@ -7358,10 +7358,10 @@ i40e_add_pinfo_to_list(struct i40e_hw *hw, sec->section.offset); pinfo->track_id = track_id; pinfo->version = profile->version; - pinfo->op =I40E_PPP_ADD_TRACKID ; -memcpy (pinfo->name, profile->name,I40E_PPP_NAME_SIZE ); + pinfo->op =I40E_DDP_ADD_TRACKID ; +memcpy (pinfo->name, profile->name,I40E_DDP_NAME_SIZE ); - status =i40e_aq_write_ppp (hw, (void *)sec, sec->data_end, + status =i40e_aq_write_ddp (hw, (void *)sec, sec->data_end, track_id, &offset, &info,NULL );return status; -} +}
drivers/net/i40e/base/i40e_prototype.h +2 -2
@@ -565,11 +565,11 @@ enum i40e_status_code i40e_write_phy_register(struct i40e_hw *hw,u8 i40e_get_phy_address (struct i40e_hw *hw,u8 dev_num);enum i40e_status_code i40e_blink_phy_link_led (struct i40e_hw *hw,u32 time,u32 interval); -enum i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +enum i40e_status_code i40e_aq_write_ddp (struct i40e_hw *hw,void *buff,u16 buff_size,u32 track_id,u32 *error_offset,u32 *error_info,struct i40e_asq_cmd_details *cmd_details); -enum i40e_status_code i40e_aq_get_ppp_list (struct i40e_hw *hw,void *buff, +enum i40e_status_code i40e_aq_get_ddp_list (struct i40e_hw *hw,void *buff,u16 buff_size,u8 flags,struct i40e_asq_cmd_details *cmd_details); struct i40e_generic_seg_header *
drivers/net/i40e/base/i40e_type.h +14 -14
@@ -1880,19 +1880,19 @@ struct i40e_lldp_variables {#define I40E_FLEX_57_SHIFT 6#define I40E_FLEX_57_MASK (0x1ULL << I40E_FLEX_57_SHIFT) -/* Version format for PPP */ -struct i40e_ppp_version { +/* Version format for DDP */ +struct i40e_ddp_version {u8 major;u8 minor;u8 update;u8 draft; }; -#define I40E_PPP_NAME_SIZE 32 +#define I40E_DDP_NAME_SIZE 32/* Package header */ struct i40e_package_header { -struct i40e_ppp_version version; +struct i40e_ddp_version version;u32 segment_count;u32 segment_offset[1 ]; };
@@ -1904,16 +1904,16 @@ struct i40e_generic_seg_header {#define SEGMENT_TYPE_I40E 0x00000011#define SEGMENT_TYPE_X722 0x00000012u32 type; -struct i40e_ppp_version version; +struct i40e_ddp_version version;u32 size; -char name[I40E_PPP_NAME_SIZE ]; +char name[I40E_DDP_NAME_SIZE ]; };struct i40e_metadata_segment {struct i40e_generic_seg_header header; -struct i40e_ppp_version version; +struct i40e_ddp_version version;u32 track_id; -char name[I40E_PPP_NAME_SIZE ]; +char name[I40E_DDP_NAME_SIZE ]; };struct i40e_device_id_entry {
@@ -1923,8 +1923,8 @@ struct i40e_device_id_entry {struct i40e_profile_segment {struct i40e_generic_seg_header header; -struct i40e_ppp_version version; -char name[I40E_PPP_NAME_SIZE ]; +struct i40e_ddp_version version; +char name[I40E_DDP_NAME_SIZE ];u32 device_table_count;struct i40e_device_id_entry device_table[1 ]; };
@@ -1951,11 +1951,11 @@ struct i40e_profile_section_header {struct i40e_profile_info {u32 track_id; -struct i40e_ppp_version version; +struct i40e_ddp_version version;u8 op; -#define I40E_PPP_ADD_TRACKID 0x01 -#define I40E_PPP_REMOVE_TRACKID 0x02 +#define I40E_DDP_ADD_TRACKID 0x01 +#define I40E_DDP_REMOVE_TRACKID 0x02u8 reserved[7 ]; -u8 name[I40E_PPP_NAME_SIZE ]; +u8 name[I40E_DDP_NAME_SIZE ]; };#endif /* _I40E_TYPE_H_ */
Signature · 1 line
2.5.5
PATCH v7 2/6 net/i40e: add dynamic device profile processing
In reply to Beilei XingAdd support for adding a dynamic device profile.
--- drivers/net/i40e/i40e_ethdev.c | 207 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 58 +++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 266 insertions(+)
drivers/net/i40e/i40e_ethdev.c +207 -0
@@ -11708,3 +11708,210 @@ rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map)return ret; } + +static void +i40e_generate_profile_info_sec (char *name,struct i40e_ddp_version *version, +uint32_t track_id,uint8_t *profile_info_sec, +bool add) +{ +struct i40e_profile_section_header *sec =NULL ; +struct i40e_profile_info *pinfo; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; +memcpy (pinfo->name, name,I40E_DDP_NAME_SIZE ); +memcpy (&pinfo->version, version,sizeof (struct i40e_ddp_version )); +if (add) + pinfo->op =I40E_DDP_ADD_TRACKID ; +else + pinfo->op =I40E_DDP_REMOVE_TRACKID ; +} + +static enum i40e_status_code +i40e_add_rm_profile_info (struct i40e_hw *hw,uint8_t *profile_info_sec) +{ +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec; +uint32_t track_id; +uint32_t offset =0 ; +uint32_t info =0 ; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + track_id = ((struct i40e_profile_info *)(profile_info_sec + + sec->section.offset))->track_id; + + status =i40e_aq_write_ddp (hw, (void *)sec, sec->data_end, + track_id, &offset, &info,NULL ); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add/remove profile info: " +"offset %d, info %d" , + offset, info); + +return status; +} + +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + +/* Check if the profile info exists */ +static int +i40e_check_profile_info (uint8_t port,uint8_t *profile_info_sec) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port]; +struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +uint8_t *buff; +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *pinfo, *p; +uint32_t i; +int ret; + + buff =rte_zmalloc ("pinfo_list" , + (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 ), +0 ); +if (!buff) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return -1 ; + } + + ret =i40e_aq_get_ddp_list (hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 ), +0 ,NULL ); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to get profile info list." ); +rte_free (buff); +return -1 ; + } + p_list = (struct rte_pmd_i40e_profile_list *)buff; + pinfo = (struct rte_pmd_i40e_profile_info *)(profile_info_sec + +sizeof (struct i40e_profile_section_header )); +for (i =0 ; i < p_list->p_count; i++) { + p = &p_list->p_info[i]; +if ((pinfo->track_id == p->track_id) && + !memcmp (&pinfo->version, &p->version, +sizeof (struct i40e_ddp_version )) && + !memcmp (&pinfo->name, &p->name, +I40E_DDP_NAME_SIZE )) { +PMD_DRV_LOG (INFO ,"Profile exists." ); +rte_free (buff); +return 1 ; + } + } + +rte_free (buff); +return 0 ; +} + +int +rte_pmd_i40e_process_ddp_package (uint8_t port,uint8_t *buff, +uint32_t size, +enum rte_pmd_i40e_package_op op) +{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +int is_exist; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (size < (sizeof (struct i40e_package_header ) + +sizeof (struct i40e_metadata_segment ) + +sizeof (uint32_t ) *2 )) { +PMD_DRV_LOG (ERR ,"Buff is invalid." ); +return -EINVAL ; + } + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +if (pkg_hdr->segment_count <2 ) { +PMD_DRV_LOG (ERR ,"Segment_count should be 2 at least." ); +return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_METADATA , + pkg_hdr); +if (!metadata_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find metadata segment header" ); +return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment *)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_I40E , + pkg_hdr); +if (!profile_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find profile segment header" ); +return -EINVAL ; + } + + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); +if (!profile_info_sec) { +PMD_DRV_LOG (ERR ,"Failed to allocate memory" ); +return -EINVAL ; + } + +if (op ==RTE_PMD_I40E_PKG_OP_WR_ADD ) { +/* Check if the profile exists */ +i40e_generate_profile_info_sec ( + ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)->version, + track_id, profile_info_sec,1 ); + is_exist =i40e_check_profile_info (port, profile_info_sec); +if (is_exist >0 ) { +PMD_DRV_LOG (ERR ,"Profile already exists." ); +rte_free (profile_info_sec); +return 1 ; + }else if (is_exist <0 ) { +PMD_DRV_LOG (ERR ,"Failed to check profile." ); +rte_free (profile_info_sec); +return -EINVAL ; + } + +/* Write profile to HW */ + status =i40e_write_profile (hw, + (struct i40e_profile_segment *)profile_seg_hdr, + track_id); +if (status) { +PMD_DRV_LOG (ERR ,"Failed to write profile." ); +rte_free (profile_info_sec); +return status; + } + +/* Add profile info to info list */ + status =i40e_add_rm_profile_info (hw, profile_info_sec); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add profile info." ); + }else +PMD_DRV_LOG (ERR ,"Operation not supported." ); + +rte_free (profile_info_sec); +return status; +}
drivers/net/i40e/rte_pmd_i40e.h +58 -0
68 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -30,5 +30,6 @@ DPDK_17.05 { rte_pmd_i40e_set_vf_max_bw; rte_pmd_i40e_set_vf_tc_bw_alloc; rte_pmd_i40e_set_vf_tc_max_bw; + rte_pmd_i40e_process_ddp_package; } DPDK_17.02;
Signature · 1 line
2.5.5
PATCH v7 3/6 app/testpmd: add command for loading a profile
In reply to Beilei XingThis patch is to add testpmd CLI for loading a dynamic device profile.
--- app/test-pmd/cmdline.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 3 +++ 3 files changed, 143 insertions(+)
app/test-pmd/cmdline.c +73 -0
@@ -590,6 +590,9 @@ static void cmd_help_long_parsed(void *parsed_result,"E-tag set filter del e-tag-id (value) port (port_id)\n" " Delete an E-tag forwarding filter on a port\n\n" +"add ddp (port_id) (profile_path)\n" +" Load a profile package on a port\n\n" + ,list_pkt_forwarding_modes () ); }
@@ -12739,6 +12742,75 @@ cmdline_parse_inst_t cmd_strict_link_prio = { }, }; +/* Load Dynamic Device Profile */ +struct cmd_add_ddp_result { +cmdline_fixed_string_t add; +cmdline_fixed_string_t ddp; +uint8_t port_id; +char filepath[]; +}; + +cmdline_parse_token_string_t cmd_add_ddp_add = + TOKEN_STRING_INITIALIZER(struct cmd_add_ddp_result, add, "add"); +cmdline_parse_token_string_t cmd_add_ddp_ddp = + TOKEN_STRING_INITIALIZER(struct cmd_add_ddp_result, ddp, "ddp"); +cmdline_parse_token_num_t cmd_add_ddp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_add_ddp_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_add_ddp_filepath = + TOKEN_STRING_INITIALIZER(struct cmd_add_ddp_result, filepath, NULL); + +static void +cmd_add_ddp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_add_ddp_result *res = parsed_result; +uint8_t *buff; +uint32_t size; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +if (!all_ports_stopped ()) { +printf ("Please stop all ports first\n" ); +return ; + } + + buff =open_ddp_package_file (res->filepath, &size); +if (!buff) +return ; + +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_process_ddp_package (res->port_id, + buff, size, +RTE_PMD_I40E_PKG_OP_WR_ADD ); +#endif + +if (ret <0 ) +printf ("Failed to load profile.\n" ); +else if (ret >0 ) +printf ("Profile has already existed.\n" ); + +close_ddp_package_file (buff); +} + +cmdline_parse_inst_t cmd_add_ddp = { + .f = cmd_add_ddp_parsed, + .data =NULL , + .help_str ="add/remove ddp <port_id> <profile_path>" , + .tokens = { + (void *)&cmd_add_ddp_add, + (void *)&cmd_add_ddp_ddp, + (void *)&cmd_add_ddp_port_id, + (void *)&cmd_add_ddp_filepath, +NULL , + }, +};/* ******************************************************************************** */
@@ -12919,6 +12991,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_vf_tc_min_bw, (cmdline_parse_inst_t *)&cmd_vf_tc_max_bw, (cmdline_parse_inst_t *)&cmd_strict_link_prio, + (cmdline_parse_inst_t *)&cmd_add_ddp, NULL, };
app/test-pmd/config.c +67 -0
70 lines not on this page · raw message
app/test-pmd/testpmd.h +3 -0
@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);void mcast_addr_remove (uint8_t port_id,struct ether_addr *mc_addr);void port_dcb_info_display (uint8_t port_id); +uint8_t *open_ddp_package_file (const char *file_path,uint32_t *size); +int close_ddp_package_file (uint8_t *buf); +enum print_warning {ENABLED_WARN =0 ,DISABLED_WARN
Signature · 1 line
2.5.5
PATCH v7 4/6 net/i40e: add get all loaded profiles
In reply to Beilei XingThis patch is to add get all loaded profiles function.
--- drivers/net/i40e/i40e_ethdev.c | 28 ++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 12 ++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 41 insertions(+)
drivers/net/i40e/i40e_ethdev.c +28 -0
@@ -11709,6 +11709,9 @@ rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map)return ret; } +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + static void i40e_generate_profile_info_sec(char *name, struct i40e_ddp_version *version, uint32_t track_id, uint8_t *profile_info_sec,
@@ -11915,3 +11918,28 @@ rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,rte_free (profile_info_sec);return status; } + +int +rte_pmd_i40e_get_ddp_list (uint8_t port,uint8_t *buff,uint32_t size) +{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + +if (size < (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 )) +return -EINVAL ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + + status =i40e_aq_get_ddp_list (hw, (void *)buff, + size,0 ,NULL ); + +return status; +}
drivers/net/i40e/rte_pmd_i40e.h +12 -0
@@ -476,4 +476,16 @@ int rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,uint32_t size, enum rte_pmd_i40e_package_op op); +/** +* rte_pmd_i40e_get_ddp_list - Get loaded profile list +* @port: port id +* @buff: buffer for response +* @size: buffer size +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_get_ddp_list (uint8_t port,uint8_t *buff,uint32_t size); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -31,5 +31,6 @@ DPDK_17.05 { rte_pmd_i40e_set_vf_tc_bw_alloc; rte_pmd_i40e_set_vf_tc_max_bw; rte_pmd_i40e_process_ddp_package; + rte_pmd_i40e_get_ddp_list; } DPDK_17.02;
Signature · 1 line
2.5.5
PATCH v7 5/6 app/testpmd: add command for getting loaded profiles
In reply to Beilei XingThis patch is to add testpmd CLI for getting all loaded profiles.
--- app/test-pmd/cmdline.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+)
app/test-pmd/cmdline.c +91 -0
@@ -214,6 +214,9 @@ static void cmd_help_long_parsed(void *parsed_result,"read txd (port_id) (queue_id) (txd_id)\n" " Display a TX descriptor of a port TX queue.\n\n" + +"get ddp list (port_id)\n" +" Get ddp profile info list\n\n" ); }
@@ -12812,6 +12815,93 @@ cmdline_parse_inst_t cmd_add_ddp = { }, }; +/* Get Dynamic Device Profile list*/ +#define PROFILE_INFO_SIZE 48 +#define MAX_PROFILE_NUM 16 + +struct cmd_get_ddp_list_result { +cmdline_fixed_string_t get; +cmdline_fixed_string_t ddp; +cmdline_fixed_string_t list; +uint8_t port_id; +}; + +cmdline_parse_token_string_t cmd_get_ddp_list_get = + TOKEN_STRING_INITIALIZER(struct cmd_get_ddp_list_result, get, "get"); +cmdline_parse_token_string_t cmd_get_ddp_list_ddp = + TOKEN_STRING_INITIALIZER(struct cmd_get_ddp_list_result, ddp, "ddp"); +cmdline_parse_token_string_t cmd_get_ddp_list_list = + TOKEN_STRING_INITIALIZER(struct cmd_get_ddp_list_result, list, "list"); +cmdline_parse_token_num_t cmd_get_ddp_list_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_get_ddp_list_result, port_id, UINT8); + +static void +cmd_get_ddp_list_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_get_ddp_list_result *res = parsed_result; +#ifdef RTE_LIBRTE_I40E_PMD +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *p_info; +uint32_t p_num; +uint32_t size; +uint32_t i; +#endif +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +#ifdef RTE_LIBRTE_I40E_PMD + size =PROFILE_INFO_SIZE *MAX_PROFILE_NUM +4 ; + p_list = (struct rte_pmd_i40e_profile_list *)malloc (size); +if (!p_list) +printf ("%s: Failed to malloc buffer\n" , __func__); + +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_get_ddp_list (res->port_id, + (uint8_t *)p_list, size); + +if (!ret) { + p_num = p_list->p_count; +printf ("Profile number is: %d\n\n" , p_num); + +for (i =0 ; i < p_num; i++) { + p_info = &p_list->p_info[i]; +printf ("Profile %d:\n" , i); +printf ("Track id: 0x%x\n" , p_info->track_id); +printf ("Version: %d.%d.%d.%d \n" , + p_info->version.major, + p_info->version.minor, + p_info->version.update, + p_info->version.draft); +printf ("Profile name: %s\n\n" , p_info->name); + } + } + +free (p_list); +#endif + +if (ret <0 ) +printf ("Failed to get ddp list\n" ); +} + +cmdline_parse_inst_t cmd_get_ddp_list = { + .f = cmd_get_ddp_list_parsed, + .data =NULL , + .help_str ="get ddp list <port_id>" , + .tokens = { + (void *)&cmd_get_ddp_list_get, + (void *)&cmd_get_ddp_list_ddp, + (void *)&cmd_get_ddp_list_list, + (void *)&cmd_get_ddp_list_port_id, +NULL , + }, +};/* ******************************************************************************** */ /* list of instructions */
@@ -12992,6 +13082,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_vf_tc_max_bw, (cmdline_parse_inst_t *)&cmd_strict_link_prio, (cmdline_parse_inst_t *)&cmd_add_ddp, + (cmdline_parse_inst_t *)&cmd_get_ddp_list, NULL, };
Signature · 1 line
2.5.5
PATCH v7 6/6 doc: add dynamic device profile support for i40e
In reply to Beilei Xing--- doc/guides/rel_notes/release_17_05.rst | 4 ++++ 1 file changed, 4 insertions(+)
doc/guides/rel_notes/release_17_05.rst +4 -0
@@ -133,6 +133,10 @@ New Features Data Ring, ability to register memory regions. +* **Added dynamic device profile support for i40e.** + + * Added loading dynamic device profile to i40e FW. + Resolved Issues ---------------
Signature · 1 line
2.5.5
v8 cover dynamic device personalization support
In reply to Beilei XingDue to limited resources of X*710 (parser and analyzer configuration tables, number of packet classification types, number of packet types, filters configuration tables, etc.), it's impossible to simultaneously support all protocols/filters required for different parts on network. To enable protocols/filters extensions for X*710, new Admin Command for loading user defined configurations is added.
PPP is a format of extend configuration for X*710, it allows user to load user defined configuration to X*710.
List of possible use cases for extended X*710 configuration using profiles could include following:
Configuring Analyzer/Parser to support new protocols, e.g.
- IP L2TPv3 tunneling protocol
- IPSec ESP/AH protocols
- MPLSoGRE, MPLSoUDP tunnels
- GTP-C/GTP-U tunnels
New PCTYPEs for offloading packet classification to X*710. e.g.
- new IP Protocol in addition to TCP/UDP/SCTP
- new TCP/UDP subtypes, like TCP SYN, TCP FIN
- new PCTYPE for tunneled packets like GTP-C, GTP-U
New PTYPEs for packets identification, e.g.
- MAC, MPLS, IP4, UDP
- MAC, MPLS, MPLS, IP6, TCP
Fixes for NVM configuration, e.g.
- list of enabled stat counters to improve throughput
- parser/analyzer configuration for some corner cases
v8 changes:
Change dynamic device profile to dynamic device personalization.
v7 changes:
Fix one coding style problem.
Add condition during ddp processing.
v6 changes:
Change pipeline personalization profile to dynamic device profile.
v5 changes:
Change parameter of rte_pmd_i40e_process_ppp_package to extend operation. Change structure rte_pmd_i40e_profile_info.
v4 changes:
Fix compile error with gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3). Move ppp related structures to rte_pmd_i40e.h.
Not support remove PPP temporarily.
v3 changes:
Move ppp AQ command code to base code.
Beilei Xing (6):
net/i40e/base: change ppp to ddp
net/i40e: add dynamic device personalization processing app/testpmd: add command for loading ddp net/i40e: add get all loaded profiles app/testpmd: add command for getting loaded profiles
doc: add dynamic device personalization support for i40e
app/test-pmd/cmdline.c | 164 +++++++++++++++++++++ app/test-pmd/config.c | 67 +++++++++ app/test-pmd/testpmd.h | 3 + doc/guides/rel_notes/release_17_05.rst | 4 + drivers/net/i40e/base/i40e_adminq_cmd.h | 10 +- drivers/net/i40e/base/i40e_common.c | 24 +-- drivers/net/i40e/base/i40e_prototype.h | 4 +- drivers/net/i40e/base/i40e_type.h | 28 ++-- drivers/net/i40e/i40e_ethdev.c | 235 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 70 +++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 2 + 11 files changed, 578 insertions(+), 33 deletions(-)
Signature · 1 line
2.5.5
PATCH v8 1/6 net/i40e/base: change ppp to ddp
Change pipeline personalization profile(ppp) to dynamic device personalization(ddp).
--- drivers/net/i40e/base/i40e_adminq_cmd.h | 10 +++++----- drivers/net/i40e/base/i40e_common.c | 24 ++++++++++++------------ drivers/net/i40e/base/i40e_prototype.h | 4 ++-- drivers/net/i40e/base/i40e_type.h | 28 ++++++++++++++-------------- 4 files changed, 33 insertions(+), 33 deletions(-)
drivers/net/i40e/base/i40e_adminq_cmd.h +5 -5
@@ -199,7 +199,7 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_add_mirror_rule =0x0260 , i40e_aqc_opc_delete_mirror_rule =0x0261 , -/* Pipeline Personalization Profile */ +/* Dynamic Device Personalization */ i40e_aqc_opc_write_personalization_profile =0x0270 , i40e_aqc_opc_get_personalization_profile_list = 0x0271,
@@ -1538,7 +1538,7 @@ struct i40e_aqc_add_delete_mirror_rule_completion {I40E_CHECK_CMD_LENGTH (i40e_aqc_add_delete_mirror_rule_completion); -/* Pipeline Personalization Profile */ +/* Dynamic Device Personalization */ struct i40e_aqc_write_personalization_profile {u8 flags;u8 reserved[3 ];
@@ -1549,7 +1549,7 @@ struct i40e_aqc_write_personalization_profile {I40E_CHECK_CMD_LENGTH (i40e_aqc_write_personalization_profile); -struct i40e_aqc_write_ppp_resp { +struct i40e_aqc_write_ddp_resp {__le32 error_offset;__le32 error_info;__le32 addr_high;
@@ -1558,8 +1558,8 @@ struct i40e_aqc_write_ppp_resp {struct i40e_aqc_get_applied_profiles {u8 flags; -#define I40E_AQC_GET_PPP_GET_CONF 0x1 -#define I40E_AQC_GET_PPP_GET_RDPU_CONF 0x2 +#define I40E_AQC_GET_DDP_GET_CONF 0x1 +#define I40E_AQC_GET_DDP_GET_RDPU_CONF 0x2u8 rsv[3 ];__le32 reserved;__le32 addr_high;
drivers/net/i40e/base/i40e_common.c +12 -12
@@ -7155,7 +7155,7 @@ enum i40e_status_code i40e_aq_clear_all_wol_filters(struct i40e_hw *hw,/** -* i40e_aq_write_ppp - Write pipeline personalization profile (ppp) +* i40e_aq_write_ddp - Write dynamic device personalization (ddp) * @hw: pointer to the hw struct * @buff: command buffer (size in bytes = buff_size) * @buff_size: buffer size in bytes
@@ -7165,7 +7165,7 @@ enum i40e_status_code i40e_aq_clear_all_wol_filters(struct i40e_hw *hw,* @cmd_details: pointer to command details structure or NULL **/ enum -i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +i40e_status_code i40e_aq_write_ddp (struct i40e_hw *hw,void *buff,u16 buff_size,u32 track_id,u32 *error_offset,u32 *error_info,struct i40e_asq_cmd_details *cmd_details)
@@ -7174,7 +7174,7 @@ i40e_status_code i40e_aq_write_ppp(struct i40e_hw *hw, void *buff,struct i40e_aqc_write_personalization_profile *cmd = (struct i40e_aqc_write_personalization_profile *) &desc.params.raw; -struct i40e_aqc_write_ppp_resp *resp; +struct i40e_aqc_write_ddp_resp *resp;enum i40e_status_code status; i40e_fill_default_direct_cmd_desc(&desc,
@@ -7190,7 +7190,7 @@ i40e_status_code i40e_aq_write_ppp(struct i40e_hw *hw, void *buff, status =i40e_asq_send_command (hw, &desc, buff, buff_size, cmd_details);if (!status) { - resp = (struct i40e_aqc_write_ppp_resp *)&desc.params.raw; + resp = (struct i40e_aqc_write_ddp_resp *)&desc.params.raw;if (error_offset) *error_offset =LE32_TO_CPU (resp->error_offset);if (error_info)
@@ -7201,14 +7201,14 @@ i40e_status_code i40e_aq_write_ppp(struct i40e_hw *hw, void *buff, }/** -* i40e_aq_get_ppp_list - Read pipeline personalization profile (ppp) +* i40e_aq_get_ddp_list - Read dynamic device personalization (ddp) * @hw: pointer to the hw struct * @buff: command buffer (size in bytes = buff_size) * @buff_size: buffer size in bytes * @cmd_details: pointer to command details structure or NULL **/ enum -i40e_status_code i40e_aq_get_ppp_list (struct i40e_hw *hw,void *buff, +i40e_status_code i40e_aq_get_ddp_list (struct i40e_hw *hw,void *buff,u16 buff_size,u8 flags,struct i40e_asq_cmd_details *cmd_details) {
@@ -7297,7 +7297,7 @@ i40e_write_profile(struct i40e_hw *hw, struct i40e_profile_segment *profile,break ; }if (i == dev_cnt) { -i40e_debug (hw,I40E_DEBUG_PACKAGE ,"Device doesn't support PPP" ); +i40e_debug (hw,I40E_DEBUG_PACKAGE ,"Device doesn't support DDP" );return I40E_ERR_DEVICE_NOT_SUPPORTED ; }
@@ -7316,7 +7316,7 @@ i40e_write_profile(struct i40e_hw *hw, struct i40e_profile_segment *profile,sizeof (struct i40e_profile_section_header );/* Write profile */ - status =i40e_aq_write_ppp (hw, (void *)sec, (u16 )section_size, + status =i40e_aq_write_ddp (hw, (void *)sec, (u16 )section_size, track_id, &offset, &info,NULL );if (status) { i40e_debug(hw, I40E_DEBUG_PACKAGE,
@@ -7358,10 +7358,10 @@ i40e_add_pinfo_to_list(struct i40e_hw *hw, sec->section.offset); pinfo->track_id = track_id; pinfo->version = profile->version; - pinfo->op =I40E_PPP_ADD_TRACKID ; -memcpy (pinfo->name, profile->name,I40E_PPP_NAME_SIZE ); + pinfo->op =I40E_DDP_ADD_TRACKID ; +memcpy (pinfo->name, profile->name,I40E_DDP_NAME_SIZE ); - status =i40e_aq_write_ppp (hw, (void *)sec, sec->data_end, + status =i40e_aq_write_ddp (hw, (void *)sec, sec->data_end, track_id, &offset, &info,NULL );return status; -} +}
drivers/net/i40e/base/i40e_prototype.h +2 -2
@@ -565,11 +565,11 @@ enum i40e_status_code i40e_write_phy_register(struct i40e_hw *hw,u8 i40e_get_phy_address (struct i40e_hw *hw,u8 dev_num);enum i40e_status_code i40e_blink_phy_link_led (struct i40e_hw *hw,u32 time,u32 interval); -enum i40e_status_code i40e_aq_write_ppp (struct i40e_hw *hw,void *buff, +enum i40e_status_code i40e_aq_write_ddp (struct i40e_hw *hw,void *buff,u16 buff_size,u32 track_id,u32 *error_offset,u32 *error_info,struct i40e_asq_cmd_details *cmd_details); -enum i40e_status_code i40e_aq_get_ppp_list (struct i40e_hw *hw,void *buff, +enum i40e_status_code i40e_aq_get_ddp_list (struct i40e_hw *hw,void *buff,u16 buff_size,u8 flags,struct i40e_asq_cmd_details *cmd_details); struct i40e_generic_seg_header *
drivers/net/i40e/base/i40e_type.h +14 -14
@@ -1880,19 +1880,19 @@ struct i40e_lldp_variables {#define I40E_FLEX_57_SHIFT 6#define I40E_FLEX_57_MASK (0x1ULL << I40E_FLEX_57_SHIFT) -/* Version format for PPP */ -struct i40e_ppp_version { +/* Version format for Dynamic Device Personalization(DDP) */ +struct i40e_ddp_version {u8 major;u8 minor;u8 update;u8 draft; }; -#define I40E_PPP_NAME_SIZE 32 +#define I40E_DDP_NAME_SIZE 32/* Package header */ struct i40e_package_header { -struct i40e_ppp_version version; +struct i40e_ddp_version version;u32 segment_count;u32 segment_offset[1 ]; };
@@ -1904,16 +1904,16 @@ struct i40e_generic_seg_header {#define SEGMENT_TYPE_I40E 0x00000011#define SEGMENT_TYPE_X722 0x00000012u32 type; -struct i40e_ppp_version version; +struct i40e_ddp_version version;u32 size; -char name[I40E_PPP_NAME_SIZE ]; +char name[I40E_DDP_NAME_SIZE ]; };struct i40e_metadata_segment {struct i40e_generic_seg_header header; -struct i40e_ppp_version version; +struct i40e_ddp_version version;u32 track_id; -char name[I40E_PPP_NAME_SIZE ]; +char name[I40E_DDP_NAME_SIZE ]; };struct i40e_device_id_entry {
@@ -1923,8 +1923,8 @@ struct i40e_device_id_entry {struct i40e_profile_segment {struct i40e_generic_seg_header header; -struct i40e_ppp_version version; -char name[I40E_PPP_NAME_SIZE ]; +struct i40e_ddp_version version; +char name[I40E_DDP_NAME_SIZE ];u32 device_table_count;struct i40e_device_id_entry device_table[1 ]; };
@@ -1951,11 +1951,11 @@ struct i40e_profile_section_header {struct i40e_profile_info {u32 track_id; -struct i40e_ppp_version version; +struct i40e_ddp_version version;u8 op; -#define I40E_PPP_ADD_TRACKID 0x01 -#define I40E_PPP_REMOVE_TRACKID 0x02 +#define I40E_DDP_ADD_TRACKID 0x01 +#define I40E_DDP_REMOVE_TRACKID 0x02u8 reserved[7 ]; -u8 name[I40E_PPP_NAME_SIZE ]; +u8 name[I40E_DDP_NAME_SIZE ]; };#endif /* _I40E_TYPE_H_ */
Signature · 1 line
2.5.5
PATCH v8 2/6 net/i40e: add dynamic device personalization processing
In reply to Beilei XingAdd support for loading a dynamic device personalization profile.
--- drivers/net/i40e/i40e_ethdev.c | 207 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 58 +++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 266 insertions(+)
drivers/net/i40e/i40e_ethdev.c +207 -0
@@ -11708,3 +11708,210 @@ rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map)return ret; } + +static void +i40e_generate_profile_info_sec (char *name,struct i40e_ddp_version *version, +uint32_t track_id,uint8_t *profile_info_sec, +bool add) +{ +struct i40e_profile_section_header *sec =NULL ; +struct i40e_profile_info *pinfo; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + sec->tbl_size =1 ; + sec->data_end =sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ); + sec->section.type =SECTION_TYPE_INFO ; + sec->section.offset =sizeof (struct i40e_profile_section_header ); + sec->section.size =sizeof (struct i40e_profile_info ); + pinfo = (struct i40e_profile_info *)(profile_info_sec + + sec->section.offset); + pinfo->track_id = track_id; +memcpy (pinfo->name, name,I40E_DDP_NAME_SIZE ); +memcpy (&pinfo->version, version,sizeof (struct i40e_ddp_version )); +if (add) + pinfo->op =I40E_DDP_ADD_TRACKID ; +else + pinfo->op =I40E_DDP_REMOVE_TRACKID ; +} + +static enum i40e_status_code +i40e_add_rm_profile_info (struct i40e_hw *hw,uint8_t *profile_info_sec) +{ +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_profile_section_header *sec; +uint32_t track_id; +uint32_t offset =0 ; +uint32_t info =0 ; + + sec = (struct i40e_profile_section_header *)profile_info_sec; + track_id = ((struct i40e_profile_info *)(profile_info_sec + + sec->section.offset))->track_id; + + status =i40e_aq_write_ddp (hw, (void *)sec, sec->data_end, + track_id, &offset, &info,NULL ); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add/remove profile info: " +"offset %d, info %d" , + offset, info); + +return status; +} + +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + +/* Check if the profile info exists */ +static int +i40e_check_profile_info (uint8_t port,uint8_t *profile_info_sec) +{ +struct rte_eth_dev *dev = &rte_eth_devices[port]; +struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +uint8_t *buff; +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *pinfo, *p; +uint32_t i; +int ret; + + buff =rte_zmalloc ("pinfo_list" , + (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 ), +0 ); +if (!buff) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return -1 ; + } + + ret =i40e_aq_get_ddp_list (hw, (void *)buff, + (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 ), +0 ,NULL ); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to get profile info list." ); +rte_free (buff); +return -1 ; + } + p_list = (struct rte_pmd_i40e_profile_list *)buff; + pinfo = (struct rte_pmd_i40e_profile_info *)(profile_info_sec + +sizeof (struct i40e_profile_section_header )); +for (i =0 ; i < p_list->p_count; i++) { + p = &p_list->p_info[i]; +if ((pinfo->track_id == p->track_id) && + !memcmp (&pinfo->version, &p->version, +sizeof (struct i40e_ddp_version )) && + !memcmp (&pinfo->name, &p->name, +I40E_DDP_NAME_SIZE )) { +PMD_DRV_LOG (INFO ,"Profile exists." ); +rte_free (buff); +return 1 ; + } + } + +rte_free (buff); +return 0 ; +} + +int +rte_pmd_i40e_process_ddp_package (uint8_t port,uint8_t *buff, +uint32_t size, +enum rte_pmd_i40e_package_op op) +{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +struct i40e_package_header *pkg_hdr; +struct i40e_generic_seg_header *profile_seg_hdr; +struct i40e_generic_seg_header *metadata_seg_hdr; +uint32_t track_id; +uint8_t *profile_info_sec; +int is_exist; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +if (size < (sizeof (struct i40e_package_header ) + +sizeof (struct i40e_metadata_segment ) + +sizeof (uint32_t ) *2 )) { +PMD_DRV_LOG (ERR ,"Buff is invalid." ); +return -EINVAL ; + } + + pkg_hdr = (struct i40e_package_header *)buff; + +if (!pkg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to fill the package structure" ); +return -EINVAL ; + } + +if (pkg_hdr->segment_count <2 ) { +PMD_DRV_LOG (ERR ,"Segment_count should be 2 at least." ); +return -EINVAL ; + } + +/* Find metadata segment */ + metadata_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_METADATA , + pkg_hdr); +if (!metadata_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find metadata segment header" ); +return -EINVAL ; + } + track_id = ((struct i40e_metadata_segment *)metadata_seg_hdr)->track_id; + +/* Find profile segment */ + profile_seg_hdr =i40e_find_segment_in_package (SEGMENT_TYPE_I40E , + pkg_hdr); +if (!profile_seg_hdr) { +PMD_DRV_LOG (ERR ,"Failed to find profile segment header" ); +return -EINVAL ; + } + + profile_info_sec =rte_zmalloc ("i40e_profile_info" , +sizeof (struct i40e_profile_section_header ) + +sizeof (struct i40e_profile_info ), +0 ); +if (!profile_info_sec) { +PMD_DRV_LOG (ERR ,"Failed to allocate memory" ); +return -EINVAL ; + } + +if (op ==RTE_PMD_I40E_PKG_OP_WR_ADD ) { +/* Check if the profile exists */ +i40e_generate_profile_info_sec ( + ((struct i40e_profile_segment *)profile_seg_hdr)->name, + &((struct i40e_profile_segment *)profile_seg_hdr)->version, + track_id, profile_info_sec,1 ); + is_exist =i40e_check_profile_info (port, profile_info_sec); +if (is_exist >0 ) { +PMD_DRV_LOG (ERR ,"Profile already exists." ); +rte_free (profile_info_sec); +return 1 ; + }else if (is_exist <0 ) { +PMD_DRV_LOG (ERR ,"Failed to check profile." ); +rte_free (profile_info_sec); +return -EINVAL ; + } + +/* Write profile to HW */ + status =i40e_write_profile (hw, + (struct i40e_profile_segment *)profile_seg_hdr, + track_id); +if (status) { +PMD_DRV_LOG (ERR ,"Failed to write profile." ); +rte_free (profile_info_sec); +return status; + } + +/* Add profile info to info list */ + status =i40e_add_rm_profile_info (hw, profile_info_sec); +if (status) +PMD_DRV_LOG (ERR ,"Failed to add profile info." ); + }else +PMD_DRV_LOG (ERR ,"Operation not supported." ); + +rte_free (profile_info_sec); +return status; +}
drivers/net/i40e/rte_pmd_i40e.h +58 -0
68 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -30,5 +30,6 @@ DPDK_17.05 { rte_pmd_i40e_set_vf_max_bw; rte_pmd_i40e_set_vf_tc_bw_alloc; rte_pmd_i40e_set_vf_tc_max_bw; + rte_pmd_i40e_process_ddp_package; } DPDK_17.02;
Signature · 1 line
2.5.5
PATCH v8 3/6 app/testpmd: add command for loading ddp
In reply to Beilei XingThis patch is to add testpmd CLI for loading dynamic device personalization.
--- app/test-pmd/cmdline.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 3 +++ 3 files changed, 143 insertions(+)
app/test-pmd/cmdline.c +73 -0
@@ -590,6 +590,9 @@ static void cmd_help_long_parsed(void *parsed_result,"E-tag set filter del e-tag-id (value) port (port_id)\n" " Delete an E-tag forwarding filter on a port\n\n" +"add ddp (port_id) (profile_path)\n" +" Load a profile package on a port\n\n" + ,list_pkt_forwarding_modes () ); }
@@ -12739,6 +12742,75 @@ cmdline_parse_inst_t cmd_strict_link_prio = { }, }; +/* Load dynamic device personalization*/ +struct cmd_add_ddp_result { +cmdline_fixed_string_t add; +cmdline_fixed_string_t ddp; +uint8_t port_id; +char filepath[]; +}; + +cmdline_parse_token_string_t cmd_add_ddp_add = + TOKEN_STRING_INITIALIZER(struct cmd_add_ddp_result, add, "add"); +cmdline_parse_token_string_t cmd_add_ddp_ddp = + TOKEN_STRING_INITIALIZER(struct cmd_add_ddp_result, ddp, "ddp"); +cmdline_parse_token_num_t cmd_add_ddp_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_add_ddp_result, port_id, UINT8); +cmdline_parse_token_string_t cmd_add_ddp_filepath = + TOKEN_STRING_INITIALIZER(struct cmd_add_ddp_result, filepath, NULL); + +static void +cmd_add_ddp_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_add_ddp_result *res = parsed_result; +uint8_t *buff; +uint32_t size; +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +if (!all_ports_stopped ()) { +printf ("Please stop all ports first\n" ); +return ; + } + + buff =open_ddp_package_file (res->filepath, &size); +if (!buff) +return ; + +#ifdef RTE_LIBRTE_I40E_PMD +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_process_ddp_package (res->port_id, + buff, size, +RTE_PMD_I40E_PKG_OP_WR_ADD ); +#endif + +if (ret <0 ) +printf ("Failed to load profile.\n" ); +else if (ret >0 ) +printf ("Profile has already existed.\n" ); + +close_ddp_package_file (buff); +} + +cmdline_parse_inst_t cmd_add_ddp = { + .f = cmd_add_ddp_parsed, + .data =NULL , + .help_str ="add/remove ddp <port_id> <profile_path>" , + .tokens = { + (void *)&cmd_add_ddp_add, + (void *)&cmd_add_ddp_ddp, + (void *)&cmd_add_ddp_port_id, + (void *)&cmd_add_ddp_filepath, +NULL , + }, +};/* ******************************************************************************** */
@@ -12919,6 +12991,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_vf_tc_min_bw, (cmdline_parse_inst_t *)&cmd_vf_tc_max_bw, (cmdline_parse_inst_t *)&cmd_strict_link_prio, + (cmdline_parse_inst_t *)&cmd_add_ddp, NULL, };
app/test-pmd/config.c +67 -0
70 lines not on this page · raw message
app/test-pmd/testpmd.h +3 -0
@@ -622,6 +622,9 @@ void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);void mcast_addr_remove (uint8_t port_id,struct ether_addr *mc_addr);void port_dcb_info_display (uint8_t port_id); +uint8_t *open_ddp_package_file (const char *file_path,uint32_t *size); +int close_ddp_package_file (uint8_t *buf); +enum print_warning {ENABLED_WARN =0 ,DISABLED_WARN
Signature · 1 line
2.5.5
PATCH v8 4/6 net/i40e: add get all loaded profiles
In reply to Beilei XingThis patch is to add get all loaded profiles function.
--- drivers/net/i40e/i40e_ethdev.c | 28 ++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 12 ++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 41 insertions(+)
drivers/net/i40e/i40e_ethdev.c +28 -0
@@ -11709,6 +11709,9 @@ rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map)return ret; } +#define I40E_PROFILE_INFO_SIZE 48 +#define I40E_MAX_PROFILE_NUM 16 + static void i40e_generate_profile_info_sec(char *name, struct i40e_ddp_version *version, uint32_t track_id, uint8_t *profile_info_sec,
@@ -11915,3 +11918,28 @@ rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,rte_free (profile_info_sec);return status; } + +int +rte_pmd_i40e_get_ddp_list (uint8_t port,uint8_t *buff,uint32_t size) +{ +struct rte_eth_dev *dev; +struct i40e_hw *hw; +enum i40e_status_code status =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + +if (!is_device_supported (dev, &rte_i40e_pmd)) +return -ENOTSUP ; + +if (size < (I40E_PROFILE_INFO_SIZE *I40E_MAX_PROFILE_NUM +4 )) +return -EINVAL ; + + hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); + + status =i40e_aq_get_ddp_list (hw, (void *)buff, + size,0 ,NULL ); + +return status; +}
drivers/net/i40e/rte_pmd_i40e.h +12 -0
@@ -476,4 +476,16 @@ int rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,uint32_t size, enum rte_pmd_i40e_package_op op); +/** +* rte_pmd_i40e_get_ddp_list - Get loaded profile list +* @port: port id +* @buff: buffer for response +* @size: buffer size +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_get_ddp_list (uint8_t port,uint8_t *buff,uint32_t size); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -31,5 +31,6 @@ DPDK_17.05 { rte_pmd_i40e_set_vf_tc_bw_alloc; rte_pmd_i40e_set_vf_tc_max_bw; rte_pmd_i40e_process_ddp_package; + rte_pmd_i40e_get_ddp_list; } DPDK_17.02;
Signature · 1 line
2.5.5
PATCH v8 5/6 app/testpmd: add command for getting loaded profiles
In reply to Beilei XingThis patch is to add testpmd CLI for getting all loaded ddp profiles.
--- app/test-pmd/cmdline.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+)
app/test-pmd/cmdline.c +91 -0
@@ -214,6 +214,9 @@ static void cmd_help_long_parsed(void *parsed_result,"read txd (port_id) (queue_id) (txd_id)\n" " Display a TX descriptor of a port TX queue.\n\n" + +"get ddp list (port_id)\n" +" Get ddp profile info list\n\n" ); }
@@ -12812,6 +12815,93 @@ cmdline_parse_inst_t cmd_add_ddp = { }, }; +/* Get dynamic device personalization profile info list*/ +#define PROFILE_INFO_SIZE 48 +#define MAX_PROFILE_NUM 16 + +struct cmd_get_ddp_list_result { +cmdline_fixed_string_t get; +cmdline_fixed_string_t ddp; +cmdline_fixed_string_t list; +uint8_t port_id; +}; + +cmdline_parse_token_string_t cmd_get_ddp_list_get = + TOKEN_STRING_INITIALIZER(struct cmd_get_ddp_list_result, get, "get"); +cmdline_parse_token_string_t cmd_get_ddp_list_ddp = + TOKEN_STRING_INITIALIZER(struct cmd_get_ddp_list_result, ddp, "ddp"); +cmdline_parse_token_string_t cmd_get_ddp_list_list = + TOKEN_STRING_INITIALIZER(struct cmd_get_ddp_list_result, list, "list"); +cmdline_parse_token_num_t cmd_get_ddp_list_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_get_ddp_list_result, port_id, UINT8); + +static void +cmd_get_ddp_list_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_get_ddp_list_result *res = parsed_result; +#ifdef RTE_LIBRTE_I40E_PMD +struct rte_pmd_i40e_profile_list *p_list; +struct rte_pmd_i40e_profile_info *p_info; +uint32_t p_num; +uint32_t size; +uint32_t i; +#endif +int ret = -ENOTSUP ; + +if (res->port_id > nb_ports) { +printf ("Invalid port, range is [0, %d]\n" , nb_ports -1 ); +return ; + } + +#ifdef RTE_LIBRTE_I40E_PMD + size =PROFILE_INFO_SIZE *MAX_PROFILE_NUM +4 ; + p_list = (struct rte_pmd_i40e_profile_list *)malloc (size); +if (!p_list) +printf ("%s: Failed to malloc buffer\n" , __func__); + +if (ret == -ENOTSUP ) + ret =rte_pmd_i40e_get_ddp_list (res->port_id, + (uint8_t *)p_list, size); + +if (!ret) { + p_num = p_list->p_count; +printf ("Profile number is: %d\n\n" , p_num); + +for (i =0 ; i < p_num; i++) { + p_info = &p_list->p_info[i]; +printf ("Profile %d:\n" , i); +printf ("Track id: 0x%x\n" , p_info->track_id); +printf ("Version: %d.%d.%d.%d \n" , + p_info->version.major, + p_info->version.minor, + p_info->version.update, + p_info->version.draft); +printf ("Profile name: %s\n\n" , p_info->name); + } + } + +free (p_list); +#endif + +if (ret <0 ) +printf ("Failed to get ddp list\n" ); +} + +cmdline_parse_inst_t cmd_get_ddp_list = { + .f = cmd_get_ddp_list_parsed, + .data =NULL , + .help_str ="get ddp list <port_id>" , + .tokens = { + (void *)&cmd_get_ddp_list_get, + (void *)&cmd_get_ddp_list_ddp, + (void *)&cmd_get_ddp_list_list, + (void *)&cmd_get_ddp_list_port_id, +NULL , + }, +};/* ******************************************************************************** */ /* list of instructions */
@@ -12992,6 +13082,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_vf_tc_max_bw, (cmdline_parse_inst_t *)&cmd_strict_link_prio, (cmdline_parse_inst_t *)&cmd_add_ddp, + (cmdline_parse_inst_t *)&cmd_get_ddp_list, NULL, };
Signature · 1 line
2.5.5
PATCH v8 6/6 doc: add dynamic device personalization support for i40e
In reply to Beilei Xing--- doc/guides/rel_notes/release_17_05.rst | 4 ++++ 1 file changed, 4 insertions(+)
doc/guides/rel_notes/release_17_05.rst +4 -0
@@ -144,6 +144,10 @@ New Features items with DROP, QUEUE and PASSTHRU actions for ingress traffic. +* **Added dynamic device personalization support.** + + * Added dynamic device personalization processing to i40e FW. + Resolved Issues ---------------
Signature · 1 line
2.5.5
Re: [PATCH v8 0/6] dynamic device personalization support
In reply to Beilei XingQuoted 51 lines
-----Original Message-----
From: Xing, Beilei
Sent: Thursday, March 30, 2017 10:52 AM
To: Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: [PATCH v8 0/6] dynamic device personalization supportDue to limited resources of X*710 (parser and analyzer configuration tables, number of packet classification types, number of packet types, filters configuration tables, etc.), it's impossible to simultaneously support all protocols/filters required for different parts on network.
To enable protocols/filters extensions for X*710, new Admin Command for loading user defined configurations is added.
PPP is a format of extend configuration for X*710, it allows user to load user defined configuration to X*710.List of possible use cases for extended X*710 configuration using profiles could include following:
Configuring Analyzer/Parser to support new protocols, e.g.
- IP L2TPv3 tunneling protocol
- IPSec ESP/AH protocols
- MPLSoGRE, MPLSoUDP tunnels
- GTP-C/GTP-U tunnels
New PCTYPEs for offloading packet classification to X*710. e.g.
- new IP Protocol in addition to TCP/UDP/SCTP
- new TCP/UDP subtypes, like TCP SYN, TCP FIN
- new PCTYPE for tunneled packets like GTP-C, GTP-U New PTYPEs for packets identification, e.g.
- MAC, MPLS, IP4, UDP
- MAC, MPLS, MPLS, IP6, TCP
Fixes for NVM configuration, e.g.
- list of enabled stat counters to improve throughput
- parser/analyzer configuration for some corner casesv8 changes:
Change dynamic device profile to dynamic device personalization.v7 changes:
Fix one coding style problem.
Add condition during ddp processing.v6 changes:
Change pipeline personalization profile to dynamic device profile.v5 changes:
Change parameter ofrte_pmd_i40e_process_ppp_packageto extend
operation.
Change structurerte_pmd_i40e_profile_info.
Quoted 7 lines
v4 changes:
Fix compile error with gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3). Move ppp related structures torte_pmd_i40e.h.
Not support remove PPP temporarily.v3 changes:
Move ppp AQ command code to base code.
Series Acked-by Jingjing Wu <[email protected]>
Re: [PATCH v8 0/6] dynamic device personalization support
Quoted 56 lines · Jingjing
Quoted 56 lines
-----Original Message-----
From: Xing, Beilei
Sent: Thursday, March 30, 2017 10:52 AM
To: Wu, Jingjing <[email protected]>
Cc: Zhang, Helin <[email protected]>; [email protected]
Subject: [PATCH v8 0/6] dynamic device personalization supportDue to limited resources of X*710 (parser and analyzer configuration tables, number of packet classification types, number of packet types, filters configuration tables, etc.), it's impossible to simultaneously support all protocols/filters required for different parts on network.
To enable protocols/filters extensions for X*710, new Admin Command for loading user defined configurations is added.
PPP is a format of extend configuration for X*710, it allows user to load user defined configuration to X*710.List of possible use cases for extended X*710 configuration using profiles could include following:
Configuring Analyzer/Parser to support new protocols, e.g.
- IP L2TPv3 tunneling protocol
- IPSec ESP/AH protocols
- MPLSoGRE, MPLSoUDP tunnels
- GTP-C/GTP-U tunnels
New PCTYPEs for offloading packet classification to X*710. e.g.
- new IP Protocol in addition to TCP/UDP/SCTP
- new TCP/UDP subtypes, like TCP SYN, TCP FIN
- new PCTYPE for tunneled packets like GTP-C, GTP-U New PTYPEs for packets identification, e.g.
- MAC, MPLS, IP4, UDP
- MAC, MPLS, MPLS, IP6, TCP
Fixes for NVM configuration, e.g.
- list of enabled stat counters to improve throughput
- parser/analyzer configuration for some corner casesv8 changes:
Change dynamic device profile to dynamic device personalization.v7 changes:
Fix one coding style problem.
Add condition during ddp processing.v6 changes:
Change pipeline personalization profile to dynamic device profile.v5 changes:
Change parameter ofrte_pmd_i40e_process_ppp_packageto extend
operation.
Change structurerte_pmd_i40e_profile_info.v4 changes:
Fix compile error with gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3). Move ppp related structures torte_pmd_i40e.h.
Not support remove PPP temporarily.
Quoted 4 lines
Quoted 2 lines
v3 changes:
Move ppp AQ command code to base code.Series Acked-by Jingjing Wu <[email protected]>
Series applied to dpdk-next-net/master, thanks.
Re: [PATCH v8 1/6] net/i40e/base: change ppp to ddp
In reply to Beilei XingQuoted 4 lines · Beilei Xing
Change pipeline personalization profile(ppp) to dynamic device personalization(ddp).
Signed-off-by Beilei Xing <[email protected]>
This is not functional patch, just renaming, and not merged yet, so:
In next-net, squashed into original commit [1].
[1]
("net/i40e/base: new AQ commands for PPP")
Re: [PATCH v8 2/6] net/i40e: add dynamic device personalization processing
In reply to Beilei XingQuoted 4 lines · Beilei Xing
Add support for loading a dynamic device personalization profile.
Signed-off-by Beilei Xing <[email protected]>
<...>
Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +10
-0+/** +* Load/Unload a ddp package +* +* @param port +* The port identifier of the Ethernet device. +* @param buff +* buffer of package. +* @param size +* size of buffer. +* @param op
drivers/net/i40e/rte_pmd_i40e.h int rte_pmd_i40e_set_vf_tc_max_bw(uint8_t port, · line 477
Quoted 10 lines
drivers/net/i40e/rte_pmd_i40e.h +10
-0+* Operation of package processing +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +* - (1) if profile exists. +*/ +int rte_pmd_i40e_process_ddp_package (uint8_t port,uint8_t *buff, +uint32_t size, +enum rte_pmd_i40e_package_op op);
Doxygen warnings [1] fixed while applying.
[1].../net/i40e/rte_pmd_i40e.h:481: warning: Found unknown command \port' .../net/i40e/rte_pmd_i40e.h:482: warning: Found unknown command \buff' .../net/i40e/rte_pmd_i40e.h:483: warning: Found unknown command `\size'
Re: [PATCH v8 5/6] app/testpmd: add command for getting loaded profiles
In reply to Beilei XingQuoted 4 lines · Beilei Xing
This patch is to add testpmd CLI for getting all loaded ddp profiles.
Signed-off-by Beilei Xing <[email protected]>
checkpatch warning [1] fixed while applying.
[1]
WARNING:QUOTED_WHITESPACE_BEFORE_NEWLINE: unnecessary whitespace before a quoted newline
#101: FILE: app/test-pmd/cmdline.c:12877:
+ printf("Version: %d.%d.%d.%d
Re: [PATCH v8 2/6] net/i40e: add dynamic device personalization processing
In reply to Beilei XingQuoted 4 lines · Beilei Xing
Add support for loading a dynamic device personalization profile.
Signed-off-by Beilei Xing <[email protected]>
<...>
drivers/net/i40e/rte_pmd_i40e.h struct rte_pmd_i40e_mb_event_param { · line 68
Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e.h +1
-0@@ -65,6 +65,43 @@ struct rte_pmd_i40e_mb_event_param {uint16_t msglen;/**< length of the message */ }; +enum rte_pmd_i40e_package_op {
This is generating a doxygen warning [1], can you please address this in a separate patch?
Meanwhile some of the bellowing doxygen comments are not very detailed. Please feel free to update them at will in patch.
Thanks,
ferruh
[1]net/i40e/rte_pmd_i40e.h:68: warning: Member rte_pmd_i40e_package_op (enumeration) of file rte_pmd_i40e.h is not documented.
Quoted 35 lines
drivers/net/i40e/rte_pmd_i40e.h +35
-0+RTE_PMD_I40E_PKG_OP_UNDEFINED =0 , +RTE_PMD_I40E_PKG_OP_WR_ADD ,/**< load package and add to info list */ + RTE_PMD_I40E_PKG_OP_MAX = 32 +}; + +#define RTE_PMD_I40E_DDP_NAME_SIZE 32 + +/** +* Dynamic device personalization version +*/ +struct rte_pmd_i40e_ddp_version { +uint8_t major; +uint8_t minor; +uint8_t update; +uint8_t draft; +}; + +/** +* Structure of profile information +*/ +struct rte_pmd_i40e_profile_info { +uint32_t track_id; +struct rte_pmd_i40e_ddp_version version; +uint8_t owner; +uint8_t reserved[7 ]; +uint8_t name[RTE_PMD_I40E_DDP_NAME_SIZE ]; +}; + +/** +* Structure of profile information list +*/ +struct rte_pmd_i40e_profile_list { +uint32_t p_count; +struct rte_pmd_i40e_profile_info p_info[1 ]; +};
<...>