[dpdk-dev] [PATCH v8 1/4] lib/ether: optimize struct rte_eth_tunnel_filter_conf
Jingjing Wu
jingjing.wu at intel.com
Thu Mar 10 04:05:59 CET 2016
From: Xutao Sun <xutao.sun at intel.com>
Change the fields of outer_mac and inner_mac in struct
rte_eth_tunnel_filter_conf from pointer to struct in order to
keep the code's readability.
Signed-off-by: Xutao Sun <xutao.sun at intel.com>
Signed-off-by: Jijiang Liu <jijiang.liu at intel.com>
---
app/test-pmd/cmdline.c | 6 ++++--
doc/guides/rel_notes/deprecation.rst | 5 -----
doc/guides/rel_notes/release_16_04.rst | 4 ++++
drivers/net/i40e/i40e_ethdev.c | 12 ++++++------
lib/librte_ether/rte_eth_ctrl.h | 4 ++--
5 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 81ba2bd..5104301 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6628,8 +6628,10 @@ cmd_tunnel_filter_parsed(void *parsed_result,
struct rte_eth_tunnel_filter_conf tunnel_filter_conf;
int ret = 0;
- tunnel_filter_conf.outer_mac = &res->outer_mac;
- tunnel_filter_conf.inner_mac = &res->inner_mac;
+ rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac,
+ ETHER_ADDR_LEN);
+ rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac,
+ ETHER_ADDR_LEN);
tunnel_filter_conf.inner_vlan = res->inner_vlan;
if (res->ip_value.family == AF_INET) {
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index f033bbc..a2017f1 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -34,10 +34,5 @@ Deprecation Notices
RTE_ETH_FLOW_MAX. The release 2.2 does not contain these ABI changes,
but release 2.3 will.
-* ABI changes are planned for rte_eth_tunnel_filter_conf. Change the fields
- of outer_mac and inner_mac from pointer to struct in order to keep the
- code's readability. The release 2.2 does not contain these ABI changes, but
- release 2.3 will, and no backwards compatibility is planned.
-
* The scheduler statistics structure will change to allow keeping track of
RED actions.
diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index aa9eabc..3211747 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -162,6 +162,10 @@ This section should contain API changes. Sample format:
handlers are updated: the pipeline parameter is added,
the packets mask parameter has been either removed or made input-only.
+* The ``outer_mac`` and ``inner_mac`` fields in structure
+ ``rte_eth_tunnel_filter_conf`` are changed from pointer to struct in order
+ to keep code's readability.
+
ABI Changes
-----------
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7e68c61..127ed72 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5839,10 +5839,10 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
}
pfilter = cld_filter;
- (void)rte_memcpy(&pfilter->outer_mac, tunnel_filter->outer_mac,
- sizeof(struct ether_addr));
- (void)rte_memcpy(&pfilter->inner_mac, tunnel_filter->inner_mac,
- sizeof(struct ether_addr));
+ (void)rte_memcpy(&pfilter->outer_mac, &tunnel_filter->outer_mac,
+ ETHER_ADDR_LEN);
+ (void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac,
+ ETHER_ADDR_LEN);
pfilter->inner_vlan = tunnel_filter->inner_vlan;
if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) {
@@ -6142,13 +6142,13 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf,
}
if ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) &&
- (is_zero_ether_addr(filter->outer_mac))) {
+ (is_zero_ether_addr(&filter->outer_mac))) {
PMD_DRV_LOG(ERR, "Cannot add NULL outer MAC address");
return -EINVAL;
}
if ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) &&
- (is_zero_ether_addr(filter->inner_mac))) {
+ (is_zero_ether_addr(&filter->inner_mac))) {
PMD_DRV_LOG(ERR, "Cannot add NULL inner MAC address");
return -EINVAL;
}
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index d433e0b..736cfc1 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -280,8 +280,8 @@ enum rte_tunnel_iptype {
* Tunneling Packet filter configuration.
*/
struct rte_eth_tunnel_filter_conf {
- struct ether_addr *outer_mac; /**< Outer MAC address filter. */
- struct ether_addr *inner_mac; /**< Inner MAC address filter. */
+ struct ether_addr outer_mac; /**< Outer MAC address filter. */
+ struct ether_addr inner_mac; /**< Inner MAC address filter. */
uint16_t inner_vlan; /**< Inner VLAN filter. */
enum rte_tunnel_iptype ip_type; /**< IP address type. */
union {
--
2.4.0
More information about the dev
mailing list