From dd76f93c2d37f0bcab123b86a11ff6a834c15b8d Mon Sep 17 00:00:00 2001 From: Xutao Sun Date: Thu, 10 Mar 2016 11:05:59 +0800 Subject: [PATCH] ethdev: rework tunnel filtering structure 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 Signed-off-by: Jijiang Liu Signed-off-by: Thomas Monjalon --- app/test-pmd/cmdline.c | 4 ++-- doc/guides/rel_notes/deprecation.rst | 5 ----- doc/guides/rel_notes/release_16_04.rst | 4 ++++ drivers/net/i40e/i40e_ethdev.c | 10 ++++------ examples/tep_termination/vxlan_setup.c | 8 ++++---- lib/librte_ether/rte_eth_ctrl.h | 4 ++-- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 102d50dd62..86616d39ef 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6669,8 +6669,8 @@ 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; + ether_addr_copy(&res->outer_mac, &tunnel_filter_conf.outer_mac); + ether_addr_copy(&res->inner_mac, &tunnel_filter_conf.inner_mac); 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 f033bbc869..a2017f163e 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 f4a07c7c18..b729b67799 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -212,6 +212,10 @@ This section should contain API changes. Sample format: have been renamed into ``rte_eth_dev_udp_tunnel_port_add`` and ``rte_eth_dev_udp_tunnel_port_delete``. +* 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. + * The fields in ethdev structure ``rte_eth_fdir_masks`` were changed to be in big endian. diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 6dd8bda226..1b5c31572c 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5908,10 +5908,8 @@ 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)); + ether_addr_copy(&tunnel_filter->outer_mac, (struct ether_addr*)&pfilter->outer_mac); + ether_addr_copy(&tunnel_filter->inner_mac, (struct ether_addr*)&pfilter->inner_mac); pfilter->inner_vlan = tunnel_filter->inner_vlan; if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) { @@ -6211,13 +6209,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/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 88366034d3..2a48e1429a 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -278,11 +278,11 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) memset(&tunnel_filter_conf, 0, sizeof(struct rte_eth_tunnel_filter_conf)); - tunnel_filter_conf.outer_mac = &ports_eth_addr[0]; + ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); tunnel_filter_conf.filter_type = tep_filter_type[filter_idx]; /* inner MAC */ - tunnel_filter_conf.inner_mac = &vdev->mac_address; + ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.queue_id = vdev->rx_q; tunnel_filter_conf.tenant_id = tenant_id_conf[vdev->rx_q]; @@ -366,8 +366,8 @@ vxlan_unlink(struct vhost_dev *vdev) memset(&tunnel_filter_conf, 0, sizeof(struct rte_eth_tunnel_filter_conf)); - tunnel_filter_conf.outer_mac = &ports_eth_addr[0]; - tunnel_filter_conf.inner_mac = &vdev->mac_address; + ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); + ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.tenant_id = tenant_id_conf[vdev->rx_q]; tunnel_filter_conf.filter_type = tep_filter_type[filter_idx]; diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index 4c79bd357f..255435a275 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -282,8 +282,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.20.1