ethdev: fix byte order inconsistence between fdir flow and mask
PATCH 1/1 ethdev: fix byte order inconsistence between fdir flow and mask
Fixed issue of byte order in ethdev library that the structure for setting fdir's mask and flow entry is inconsist and made inputs of mask be in big endian.
2d4c1a9ea2ac ("ethdev: add new flow director masks")
--- app/test-pmd/cmdline.c | 6 ++--- doc/guides/rel_notes/release_2_3.rst | 6 +++++ drivers/net/ixgbe/ixgbe_fdir.c | 47 ++++++++++++++++++++++-------------- lib/librte_ether/rte_eth_ctrl.h | 7 ++++-- 4 files changed, 43 insertions(+), 23 deletions(-)
app/test-pmd/cmdline.c +3 -3
@@ -8687,13 +8687,13 @@ cmd_flow_director_mask_parsed(void *parsed_result,return ; } - mask->vlan_tci_mask = res->vlan_mask; + mask->vlan_tci_mask =rte_cpu_to_be_16 (res->vlan_mask);IPV4_ADDR_TO_UINT (res->ipv4_src, mask->ipv4_mask.src_ip);IPV4_ADDR_TO_UINT (res->ipv4_dst, mask->ipv4_mask.dst_ip);IPV6_ADDR_TO_ARRAY (res->ipv6_src, mask->ipv6_mask.src_ip);IPV6_ADDR_TO_ARRAY (res->ipv6_dst, mask->ipv6_mask.dst_ip); - mask->src_port_mask = res->port_src; - mask->dst_port_mask = res->port_dst; + mask->src_port_mask =rte_cpu_to_be_16 (res->port_src); + mask->dst_port_mask =rte_cpu_to_be_16 (res->port_dst); }cmd_reconfig_device_queue (res->port_id,1 ,1 );
doc/guides/rel_notes/release_2_3.rst +6 -0
@@ -19,6 +19,10 @@ Drivers Libraries ~~~~~~~~~ +* ** fix byte order inconsistence between fdir flow and mask ** + + Fixed issue in ethdev library that the structure for setting + fdir's mask and flow entry is inconsist in byte order. Examples ~~~~~~~~
@@ -39,6 +43,8 @@ API Changes ABI Changes ----------- +* The fields in The ethdev structures ``rte_eth_fdir_masks`` were + changed to be in big endian. Shared Library Versions -----------------------
drivers/net/ixgbe/ixgbe_fdir.c +29 -18
106 lines not on this page · raw message
lib/librte_ether/rte_eth_ctrl.h +5 -2
@@ -501,6 +501,7 @@ struct rte_eth_tunnel_flow {/** * An union contains the inputs for all types of flow +* Items in flows need to be in big endian */ union rte_eth_fdir_flow {struct rte_eth_l2_flow l2_flow;
@@ -586,6 +587,7 @@ struct rte_eth_fdir_filter {/** * A structure used to configure FDIR masks that are used by the device * to match the various fields of RX packet headers. +* Items in it need to be in big endian */ struct rte_eth_fdir_masks {uint16_t vlan_tci_mask;
@@ -593,9 +595,10 @@ struct rte_eth_fdir_masks {struct rte_eth_ipv6_flow ipv6_mask;uint16_t src_port_mask;uint16_t dst_port_mask; -uint8_t mac_addr_byte_mask;/** Per byte MAC address mask */ +uint8_t mac_addr_byte_mask;/** Bit mask for associated byte */ uint32_t tunnel_id_mask;/** tunnel ID mask */ -uint8_t tunnel_type_mask; +uint8_t tunnel_type_mask;/**< 1 - Match tunnel type, +0 - Ignore tunnel type. */ };/**
Signature · 1 line
2.4.0
2016-01-27 16:37, Jingjing Wu:
Quoted 3 lines
Fixed issue of byte order in ethdev library that the structure for setting fdir's mask and flow entry is inconsist and made inputs of mask be in big endian.
Please be more precise. Which one is big endian? Wasn't it tested before?
Quoted 2 lines
Fixes 76c6f89e80d4 ("ixgbe: support new flow director masks")
2d4c1a9ea2ac("ethdev: add new flow director masks")
Please put Fixes: on the two lines.
doc/guides/rel_notes/release_2_3.rst Drivers · line 25
Quoted 10 lines
doc/guides/rel_notes/release_2_3.rst +4
-0@@ -19,6 +19,10 @@ Drivers Libraries ~~~~~~~~~ +* ** fix byte order inconsistence between fdir flow and mask ** + + Fixed issue in ethdev library that the structure for setting + fdir's mask and flow entry is inconsist in byte order.
John, comment on release notes formatting? It's important to have the first items well formatted.
doc/guides/rel_notes/release_2_3.rst API Changes · line 47
Quoted 6 lines
doc/guides/rel_notes/release_2_3.rst +2
-0@@ -39,6 +43,8 @@ API Changes ABI Changes ----------- +* The fields in The ethdev structures ``rte_eth_fdir_masks`` were + changed to be in big endian.
Please take care of uppercase typo here.
doc/guides/rel_notes/release_2_3.rst API Changes · line 50
Quoted 4 lines
doc/guides/rel_notes/release_2_3.rst +3
-1- /* write all the same so that UDP, TCP and SCTP use the same mask */ + /* write all the same so that UDP, TCP and SCTP use the same mask + * (little-endian) + */
Spacing typo here.
Sorry for the nits ;)
doc/guides/rel_notes/release_2_3.rst API Changes
Quoted 6 lines
doc/guides/rel_notes/release_2_3.rst +3
-2- uint8_t mac_addr_byte_mask; /** Per byte MAC address mask */ + uint8_t mac_addr_byte_mask; /** Bit mask for associated byte */ uint32_t tunnel_id_mask; /** tunnel ID mask */ - uint8_t tunnel_type_mask; + uint8_t tunnel_type_mask; /**< 1 - Match tunnel type, + 0 - Ignore tunnel type. */
These changes seem unrelated with the patch.
It's good to improve doc of this API but it's maybe not enough. Example:
uint8_t mac_addr_byte_mask; /** Bit mask for associated byte */
Are we sure everybody understand how to fill it?
Quoted 9 lines
2016-01-27 16:37, Jingjing Wu:
Quoted 3 lines
Fixed issue of byte order in ethdev library that the structure for setting fdir's mask and flow entry is inconsist and made inputs of mask be in big endian.
Please be more precise. Which one is big endian? Wasn't it tested before?
It is tested, it works. But byte order fields in the structures for fdir are not consist, few are in host endian. It will make user confused, so this patch is to make all fields in the same byte order.
Quoted 5 lines
Quoted 2 lines
Fixes 76c6f89e80d4 ("ixgbe: support new flow director masks")
2d4c1a9ea2ac("ethdev: add new flow director masks")Please put Fixes: on the two lines.
OK. Will add in later version.
Quoted 14 lines
doc/guides/rel_notes/release_2_3.rst Drivers · line 25
Quoted 10 lines
doc/guides/rel_notes/release_2_3.rst +4
-0@@ -19,6 +19,10 @@ Drivers Libraries ~~~~~~~~~ +* ** fix byte order inconsistence between fdir flow and mask ** + + Fixed issue in ethdev library that the structure for setting + fdir's mask and flow entry is inconsist in byte order.John, comment on release notes formatting? It's important to have the first items well formatted.
Quoted 8 lines
doc/guides/rel_notes/release_2_3.rst API Changes · line 47
Quoted 6 lines
doc/guides/rel_notes/release_2_3.rst +2
-0@@ -39,6 +43,8 @@ API Changes ABI Changes ----------- +* The fields in The ethdev structures ``rte_eth_fdir_masks`` were + changed to be in big endian.Please take care of uppercase typo here.
Ok. Thanks for point.
Quoted 10 lines
doc/guides/rel_notes/release_2_3.rst API Changes · line 42
Quoted 2 lines
doc/guides/rel_notes/release_2_3.rst +0
-1- /* write all the same so that UDP, TCP and SCTP use the same mask*/
doc/guides/rel_notes/release_2_3.rst API Changes · line 50
Quoted 3 lines
doc/guides/rel_notes/release_2_3.rst +3
-0+ /* write all the same so that UDP, TCP and SCTP use the same mask + * (little-endian) + */Spacing typo here.
Sorry for the nits ;)
Will fix this in later version.
Quoted 4 lines
Quoted 4 lines
doc/guides/rel_notes/release_2_3.rst +1
-2- uint8_t mac_addr_byte_mask; /** Per byte MAC address mask */ + uint8_t mac_addr_byte_mask; /** Bit mask for associated byte */ uint32_t tunnel_id_mask; /** tunnel ID mask */ - uint8_t tunnel_type_mask;
Quoted 8 lines
doc/guides/rel_notes/release_2_3.rst
Quoted 2 lines
doc/guides/rel_notes/release_2_3.rst +2
-0+ uint8_t tunnel_type_mask; /**< 1 - Match tunnel type, + 0 - Ignore tunnel type. */These changes seem unrelated with the patch.
It's good to improve doc of this API but it's maybe not enough. Example:
uint8_tmac_addr_byte_mask; /** Bit mask for associated byte */
Are we sure everybody understand how to fill it?
OK. Will improve this.
Thanks
JIngjing
PATCH v2 1/1 ethdev: fix byte order inconsistence between fdir flow and mask
In reply to Jingjing WuFixed issue of byte order in ethdev library that the structure for setting fdir's mask and flow entry is inconsist and made inputs of mask be in big endian.
---
v2 changes:
fix typo and reword API doc.
app/test-pmd/cmdline.c | 6 ++--- doc/guides/rel_notes/release_2_3.rst | 6 +++++ drivers/net/ixgbe/ixgbe_fdir.c | 47 ++++++++++++++++++++++-------------- lib/librte_ether/rte_eth_ctrl.h | 17 ++++++++++--- 4 files changed, 51 insertions(+), 25 deletions(-)
app/test-pmd/cmdline.c +3 -3
@@ -8687,13 +8687,13 @@ cmd_flow_director_mask_parsed(void *parsed_result,return ; } - mask->vlan_tci_mask = res->vlan_mask; + mask->vlan_tci_mask =rte_cpu_to_be_16 (res->vlan_mask);IPV4_ADDR_TO_UINT (res->ipv4_src, mask->ipv4_mask.src_ip);IPV4_ADDR_TO_UINT (res->ipv4_dst, mask->ipv4_mask.dst_ip);IPV6_ADDR_TO_ARRAY (res->ipv6_src, mask->ipv6_mask.src_ip);IPV6_ADDR_TO_ARRAY (res->ipv6_dst, mask->ipv6_mask.dst_ip); - mask->src_port_mask = res->port_src; - mask->dst_port_mask = res->port_dst; + mask->src_port_mask =rte_cpu_to_be_16 (res->port_src); + mask->dst_port_mask =rte_cpu_to_be_16 (res->port_dst); }cmd_reconfig_device_queue (res->port_id,1 ,1 );
doc/guides/rel_notes/release_2_3.rst +6 -0
@@ -19,6 +19,10 @@ Drivers Libraries ~~~~~~~~~ +* ** fix byte order inconsistence between fdir flow and mask ** + + Fixed issue in ethdev library that the structure for setting + fdir's mask and flow entry is inconsist in byte order. Examples ~~~~~~~~
@@ -39,6 +43,8 @@ API Changes ABI Changes ----------- +* The fields in ethdev structure ``rte_eth_fdir_masks`` were + changed to be in big endian. Shared Library Versions -----------------------
drivers/net/ixgbe/ixgbe_fdir.c +29 -18
106 lines not on this page · raw message
lib/librte_ether/rte_eth_ctrl.h +13 -4
@@ -501,6 +501,7 @@ struct rte_eth_tunnel_flow {/** * An union contains the inputs for all types of flow +* Items in flows need to be in big endian */ union rte_eth_fdir_flow {struct rte_eth_l2_flow l2_flow;
@@ -588,14 +589,22 @@ struct rte_eth_fdir_filter {* to match the various fields of RX packet headers. */ struct rte_eth_fdir_masks { -uint16_t vlan_tci_mask; +uint16_t vlan_tci_mask;/**< Bit mask for vlan_tci in big endian */ +/** Bit mask for ipv4 flow in big endian. */ struct rte_eth_ipv4_flow ipv4_mask; +/** Bit maks for ipv6 flow in big endian. */ struct rte_eth_ipv6_flow ipv6_mask; +/** Bit mask for L4 source port in big endian. */ uint16_t src_port_mask; +/** Bit mask for L4 destination port in big endian. */ uint16_t dst_port_mask; -uint8_t mac_addr_byte_mask;/** Per byte MAC address mask */ -uint32_t tunnel_id_mask;/** tunnel ID mask */ -uint8_t tunnel_type_mask; +/** 6 bit mask for proper 6 bytes of Mac address, bit 0 matches the +first byte on the wire */ +uint8_t mac_addr_byte_mask; +/** Bit mask for tunnel ID in big endian. */ +uint32_t tunnel_id_mask; +uint8_t tunnel_type_mask;/**< 1 - Match tunnel type, +0 - Ignore tunnel type. */ };/**
Signature · 1 line
2.4.0
Hi,
Quoted 8 lines
-----Original Message-----
From: Wu, Jingjing
Sent: Monday, February 1, 2016 10:48 AM
To: [email protected]
Cc: Wu, Jingjing; Lu, Wenzhuo; Pei, Yulong; [email protected]
Subject: [PATCH v2] ethdev: fix byte order inconsistence between fdir flow and mask
Quoted 8 lines
Fixed issue of byte order in ethdev library that the structure for setting fdir's mask and flow entry is inconsist and made inputs of mask be in big endian.
Fixes 76c6f89e80d4 ("ixgbe: support new flow director masks")Fixes 2d4c1a9ea2ac ("ethdev: add new flow director masks")Reported-by Yaacov Hazan <[email protected]>Signed-off-by Jingjing Wu <[email protected]>
Quoted 24 lines · Jingjing Wu
Fixed issue of byte order in ethdev library that the structure for setting fdir's mask and flow entry is inconsist and made inputs of mask be in big endian.
Fixes 76c6f89e80d4 ("ixgbe: support new flow director masks")Fixes 2d4c1a9ea2ac ("ethdev: add new flow director masks")Reported-by Yaacov Hazan <[email protected]>Signed-off-by Jingjing Wu <[email protected]>---
v2 changes:
fix typo and reword API doc.app/test-pmd/cmdline.c | 6 ++--- doc/guides/rel_notes/release_2_3.rst | 6 +++++ drivers/net/ixgbe/ixgbe_fdir.c | 47 ++++++++++++++++++++++-------------- lib/librte_ether/rte_eth_ctrl.h | 17 ++++++++++--- 4 files changed, 51 insertions(+), 25 deletions(-)app/test-pmd/cmdline.c +0
-0
app/test-pmd/cmdline.c cmd_flow_director_mask_parsed(void *parsed_result, · line 8688
Quoted 2 lines
app/test-pmd/cmdline.c +0
-0@@ -8687,13 +8687,13 @@ cmd_flow_director_mask_parsed(void *parsed_result,return ; }
Thomas Monjalon
AppliedQuoted 9 lines
Quoted 8 lines
Fixed issue of byte order in ethdev library that the structure for setting fdir's mask and flow entry is inconsist and made inputs of mask be in big endian.
Fixes 76c6f89e80d4 ("ixgbe: support new flow director masks")Fixes 2d4c1a9ea2ac ("ethdev: add new flow director masks")Reported-by Yaacov Hazan <[email protected]>Signed-off-by Jingjing Wu <[email protected]>Acked-by Wenzhuo Lu <[email protected]>
Applied, thanks
Hi Jingjing,
2016-02-01 10:48, Jingjing Wu:
doc/guides/rel_notes/release_2_3.rst API Changes · line 47
Quoted 6 lines
doc/guides/rel_notes/release_2_3.rst +2
-0@@ -39,6 +43,8 @@ API Changes ABI Changes ----------- +* The fields in ethdev structure ``rte_eth_fdir_masks`` were + changed to be in big endian.
I think it is an API change.
Please could you fix it? Thanks