From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id 783E75B3A for ; Fri, 26 Oct 2018 13:28:59 +0200 (CEST) Received: from rsa59-2-82-233-193-189.fbx.proxad.net ([82.233.193.189] helo=droids-corp.org) by mail.droids-corp.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gG0Jk-0002oo-4G; Fri, 26 Oct 2018 13:30:17 +0200 Received: by droids-corp.org (sSMTP sendmail emulation); Fri, 26 Oct 2018 13:28:55 +0200 Date: Fri, 26 Oct 2018 13:28:55 +0200 From: Olivier Matz To: Bruce Richardson Cc: dev@dpdk.org Message-ID: <20181026112855.xtzlibbcyyntgndq@platinum> References: <20181024081833.21432-1-olivier.matz@6wind.com> <20181024163909.GA12444@bricha3-MOBL.ger.corp.intel.com> <20181026072015.ojjuoqnwsxlqcase@platinum> <20181026101514.GB14620@bricha3-MOBL.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181026101514.GB14620@bricha3-MOBL.ger.corp.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [RFC 00/14] prefix network structures X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2018 11:28:59 -0000 On Fri, Oct 26, 2018 at 11:15:14AM +0100, Bruce Richardson wrote: > On Fri, Oct 26, 2018 at 09:20:15AM +0200, Olivier Matz wrote: > > Hi, > > > > On Wed, Oct 24, 2018 at 05:39:09PM +0100, Bruce Richardson wrote: > > > On Wed, Oct 24, 2018 at 10:18:19AM +0200, Olivier Matz wrote: > > > > This RFC targets 19.02. > > > > > > > > The rte_net headers conflict with the libc headers, because > > > > some definitions are duplicated, sometimes with few differences. > > > > This was discussed in [1], and more recently at the techboard. > > > > > > > > Before sending the deprecation notice (target for this is 18.11), > > > > here is a draft that can be discussed. > > > > > > > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > > > > and defines in rte_net library. This is a big changeset, that will > > > > break the API of many functions, but not the ABI. > > > > > > > > One question I'm asking is how can we manage the transition. > > > > Initially, I hoped it was possible to have a compat layer during > > > > one release (supporting both prefixed and unprefixed names), but > > > > now that the patch is done, it seems the impact is too big, and > > > > impacts too many libraries. > > > > > > > > Few examples: > > > > - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > > > > - many rte_flow structures use the rte_ prefixed net structures > > > > - the mac field of virtio_net structure is rte_ether_addr > > > > - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > > > > ... > > > > > > > > Therefore, it is clear that doing this would break the compilation > > > > of many external applications. > > > > > > > > > > Can you clarify a bit as to why we can't keep around compatibility versions > > > of the headers, alongside the new versions? I'm not following the logic > > > above. Can we not introduce completely new headers with the replacements > > > while leaving the old ones intact? > > > > This is something I tried to do, it is not in the RFC because it was > > not satisfying, but you can find it there: > > > > http://git.droids-corp.org/?p=dpdk.git;a=commitdiff;h=ba1e8e498306 > > > > With this patch, the usage of unprefixed structures, defines and > > functions in rte net is still possible by an external application, > > except if RTE_NET_NO_COMPAT is defined. > > > > However, functions and structures that are not in librte_net (the > > examples from my previous mail, quoted above) use the rte_ prefixed > > structures in their prototypes. For instance, an application that use > > rte_eth_macaddr_get() will no compile anymore because it will pass > > a (struct ether_addr *) instead of a (struct rte_ether_addr *). > > > > I don't see any good mean to fix this. Maybe we can do something with > > defines, but I don't think it is possible to provide both APIs for > > functions like rte_eth_macaddr_get(). I'm also not convinced it will be > > that helpful. At the end, if the patchset is applied, we want the > > applications to switch to the new API. To ease the transition, we can > > provide a script to patch an application, very similar to the one I use > > to generate the patchset. > > > > Out of interest, about how many non rte_net functions are we talking about here? I didn't count, but many. And not only functions, also structures. To give an idea, here is the output of: git diff origin/master..HEAD lib/ | filterdiff -i '*.h' -x 'a/lib/librte_net/*' diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h index 5ea8ae24c..821d971cd 100644 --- a/lib/librte_ethdev/rte_eth_ctrl.h +++ b/lib/librte_ethdev/rte_eth_ctrl.h @@ -110,7 +110,7 @@ struct rte_eth_mac_filter { uint8_t is_vf; /**< 1 for VF, 0 for port dev */ uint16_t dst_id; /**< VF ID, available when is_vf is 1*/ enum rte_mac_filter_type filter_type; /**< MAC filter type */ - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; /** @@ -126,7 +126,7 @@ struct rte_eth_mac_filter { * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations. */ struct rte_eth_ethertype_filter { - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ uint16_t ether_type; /**< Ether type to match */ uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */ uint16_t queue; /**< Queue assigned to when match*/ @@ -265,8 +265,8 @@ enum rte_tunnel_iptype { * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct ether_addr outer_mac; /**< Outer MAC address to match. */ - struct ether_addr inner_mac; /**< Inner MAC address to match. */ + struct rte_ether_addr outer_mac; /**< Outer MAC address to match. */ + struct rte_ether_addr inner_mac; /**< Inner MAC address to match. */ uint16_t inner_vlan; /**< Inner VLAN to match. */ enum rte_tunnel_iptype ip_type; /**< IP address type. */ /** Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP @@ -473,7 +473,7 @@ struct rte_eth_sctpv6_flow { * A structure used to define the input for MAC VLAN flow */ struct rte_eth_mac_vlan_flow { - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ }; /** @@ -493,7 +493,7 @@ struct rte_eth_tunnel_flow { enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */ /** Tunnel ID to match. TNI, VNI... in big endian. */ uint32_t tunnel_id; - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ }; /** diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index fb40c89e0..5deb4e38e 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2159,7 +2159,7 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, * A pointer to a structure of type *ether_addr* to be filled with * the Ethernet address of the Ethernet device. */ -void rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr); +void rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr); /** * Retrieve the contextual information of an Ethernet device. @@ -2843,7 +2843,7 @@ int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id, * - (-ENOSPC) if no more MAC addresses can be added. * - (-EINVAL) if MAC address is invalid. */ -int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, +int rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *mac_addr, uint32_t pool); /** @@ -2859,7 +2859,7 @@ int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, * - (-ENODEV) if *port* invalid. * - (-EADDRINUSE) if attempting to remove the default MAC address */ -int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); +int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *mac_addr); /** * Set the default MAC address. @@ -2875,7 +2875,7 @@ int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); * - (-EINVAL) if MAC address is invalid. */ int rte_eth_dev_default_mac_addr_set(uint16_t port_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device. @@ -2936,7 +2936,7 @@ int rte_eth_dev_rss_reta_query(uint16_t port_id, * - (-EIO) if device is removed. * - (-EINVAL) if bad parameter. */ -int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr, +int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, uint8_t on); /** @@ -3479,7 +3479,7 @@ rte_eth_dev_get_module_eeprom(uint16_t port_id, * - (-ENOSPC) if *port_id* has not enough multicast filtering resources. */ int rte_eth_dev_set_mc_addr_list(uint16_t port_id, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /** diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index 0d28fd902..fa518620e 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -250,17 +250,17 @@ typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index); /**< @internal Remove MAC address from receive address register */ typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint8_t on); /**< @internal Set a Unicast Hash bitmap */ @@ -292,7 +292,7 @@ typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, /**< @internal Delete tunneling UDP port */ typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /**< @internal set the list of multicast addresses on an Ethernet device */ @@ -597,10 +597,10 @@ struct rte_eth_dev_data { /**< Common rx buffer size handled by all queues */ uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */ - struct ether_addr* mac_addrs;/**< Device Ethernet Link address. */ + struct rte_ether_addr* mac_addrs;/**< Device Ethernet Link address. */ uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR]; /** bitmap array of associating Ethernet MAC addresses to pools */ - struct ether_addr* hash_mac_addrs; + struct rte_ether_addr* hash_mac_addrs; /** Device Ethernet MAC addresses of hash filtering. */ uint16_t port_id; /**< Device [external] port identifier. */ __extension__ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 26e2fcfa0..c27d590a1 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -577,8 +577,8 @@ static const struct rte_flow_item_raw rte_flow_item_raw_mask = { * same order as on the wire. */ struct rte_flow_item_eth { - struct ether_addr dst; /**< Destination MAC. */ - struct ether_addr src; /**< Source MAC. */ + struct rte_ether_addr dst; /**< Destination MAC. */ + struct rte_ether_addr src; /**< Source MAC. */ rte_be16_t type; /**< EtherType or TPID. */ }; @@ -597,7 +597,7 @@ static const struct rte_flow_item_eth rte_flow_item_eth_mask = { * Matches an 802.1Q/ad VLAN tag. * * The corresponding standard outer EtherType (TPID) values are - * ETHER_TYPE_VLAN or ETHER_TYPE_QINQ. It can be overridden by the preceding + * RTE_ETHER_TYPE_VLAN or RTE_ETHER_TYPE_QINQ. It can be overridden by the preceding * pattern item. */ struct rte_flow_item_vlan { @@ -621,7 +621,7 @@ static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = { * Note: IPv4 options are handled by dedicated pattern items. */ struct rte_flow_item_ipv4 { - struct ipv4_hdr hdr; /**< IPv4 header definition. */ + struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */ @@ -643,7 +643,7 @@ static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = { * RTE_FLOW_ITEM_TYPE_IPV6_EXT. */ struct rte_flow_item_ipv6 { - struct ipv6_hdr hdr; /**< IPv6 header definition. */ + struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */ @@ -666,7 +666,7 @@ static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = { * Matches an ICMP header. */ struct rte_flow_item_icmp { - struct icmp_hdr hdr; /**< ICMP header definition. */ + struct rte_icmp_hdr hdr; /**< ICMP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */ @@ -685,7 +685,7 @@ static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = { * Matches a UDP header. */ struct rte_flow_item_udp { - struct udp_hdr hdr; /**< UDP header definition. */ + struct rte_udp_hdr hdr; /**< UDP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */ @@ -704,7 +704,7 @@ static const struct rte_flow_item_udp rte_flow_item_udp_mask = { * Matches a TCP header. */ struct rte_flow_item_tcp { - struct tcp_hdr hdr; /**< TCP header definition. */ + struct rte_tcp_hdr hdr; /**< TCP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */ @@ -723,7 +723,7 @@ static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = { * Matches a SCTP header. */ struct rte_flow_item_sctp { - struct sctp_hdr hdr; /**< SCTP header definition. */ + struct rte_sctp_hdr hdr; /**< SCTP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */ @@ -761,7 +761,7 @@ static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = { * Matches a E-tag header. * * The corresponding standard outer EtherType (TPID) value is - * ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item. + * RTE_ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item. */ struct rte_flow_item_e_tag { /** @@ -908,7 +908,7 @@ static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = { * Matches an ESP header. */ struct rte_flow_item_esp { - struct esp_hdr hdr; /**< ESP header definition. */ + struct rte_esp_hdr hdr; /**< ESP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */ @@ -974,9 +974,9 @@ struct rte_flow_item_arp_eth_ipv4 { uint8_t hln; /**< Hardware address length, normally 6. */ uint8_t pln; /**< Protocol address length, normally 4. */ rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */ - struct ether_addr sha; /**< Sender hardware address. */ + struct rte_ether_addr sha; /**< Sender hardware address. */ rte_be32_t spa; /**< Sender IPv4 address. */ - struct ether_addr tha; /**< Target hardware address. */ + struct rte_ether_addr tha; /**< Target hardware address. */ rte_be32_t tpa; /**< Target IPv4 address. */ }; @@ -1120,7 +1120,7 @@ rte_flow_item_icmp6_nd_opt_mask = { struct rte_flow_item_icmp6_nd_opt_sla_eth { uint8_t type; /**< ND option type, normally 1. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr sla; /**< Source Ethernet LLA. */ + struct rte_ether_addr sla; /**< Source Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */ @@ -1145,7 +1145,7 @@ rte_flow_item_icmp6_nd_opt_sla_eth_mask = { struct rte_flow_item_icmp6_nd_opt_tla_eth { uint8_t type; /**< ND option type, normally 2. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr tla; /**< Target Ethernet LLA. */ + struct rte_ether_addr tla; /**< Target Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */ @@ -2036,7 +2036,7 @@ struct rte_flow_action_set_ttl { * Set MAC address from the matched flow */ struct rte_flow_action_set_mac { - uint8_t mac_addr[ETHER_ADDR_LEN]; + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; }; /* diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 6bb30cdb9..63f06bec4 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -19,8 +19,8 @@ /* Header fields representing a TCP/IPv4 flow */ struct tcp4_flow_key { - struct ether_addr eth_saddr; - struct ether_addr eth_daddr; + struct rte_ether_addr eth_saddr; + struct rte_ether_addr eth_daddr; uint32_t ip_src_addr; uint32_t ip_dst_addr; @@ -182,8 +182,8 @@ uint32_t gro_tcp4_tbl_pkt_count(void *tbl); static inline int is_same_tcp4_flow(struct tcp4_flow_key k1, struct tcp4_flow_key k2) { - return (is_same_ether_addr(&k1.eth_saddr, &k2.eth_saddr) && - is_same_ether_addr(&k1.eth_daddr, &k2.eth_daddr) && + return (rte_is_same_ether_addr(&k1.eth_saddr, &k2.eth_saddr) && + rte_is_same_ether_addr(&k1.eth_daddr, &k2.eth_daddr) && (k1.ip_src_addr == k2.ip_src_addr) && (k1.ip_dst_addr == k2.ip_dst_addr) && (k1.recv_ack == k2.recv_ack) && @@ -255,7 +255,7 @@ merge_two_tcp4_packets(struct gro_tcp4_item *item, */ static inline int check_seq_option(struct gro_tcp4_item *item, - struct tcp_hdr *tcph, + struct rte_tcp_hdr *tcph, uint32_t sent_seq, uint16_t ip_id, uint16_t tcp_hl, @@ -264,17 +264,17 @@ check_seq_option(struct gro_tcp4_item *item, uint8_t is_atomic) { struct rte_mbuf *pkt_orig = item->firstseg; - struct ipv4_hdr *iph_orig; - struct tcp_hdr *tcph_orig; + struct rte_ipv4_hdr *iph_orig; + struct rte_tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; - iph_orig = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + + iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + l2_offset + pkt_orig->l2_len); - tcph_orig = (struct tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); + tcph_orig = (struct rte_tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; /* Check if TCP option fields equal */ - len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct tcp_hdr); + len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct rte_tcp_hdr); if ((tcp_hl != tcp_hl_orig) || ((len > 0) && (memcmp(tcph + 1, tcph_orig + 1, len) != 0))) diff --git a/lib/librte_gro/gro_vxlan_tcp4.h b/lib/librte_gro/gro_vxlan_tcp4.h index 0cafb9211..7832942a6 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.h +++ b/lib/librte_gro/gro_vxlan_tcp4.h @@ -12,10 +12,10 @@ /* Header fields representing a VxLAN flow */ struct vxlan_tcp4_flow_key { struct tcp4_flow_key inner_key; - struct vxlan_hdr vxlan_hdr; + struct rte_vxlan_hdr vxlan_hdr; - struct ether_addr outer_eth_saddr; - struct ether_addr outer_eth_daddr; + struct rte_ether_addr outer_eth_saddr; + struct rte_ether_addr outer_eth_daddr; uint32_t outer_ip_src_addr; uint32_t outer_ip_dst_addr; diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 6cd764ff5..48ad1686f 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -12,8 +12,8 @@ #include #include -#define IS_FRAGMENTED(frag_off) (((frag_off) & IPV4_HDR_OFFSET_MASK) != 0 \ - || ((frag_off) & IPV4_HDR_MF_FLAG) == IPV4_HDR_MF_FLAG) +#define IS_FRAGMENTED(frag_off) (((frag_off) & RTE_IPV4_HDR_OFFSET_MASK) != 0 \ + || ((frag_off) & RTE_IPV4_HDR_MF_FLAG) == RTE_IPV4_HDR_MF_FLAG) #define TCP_HDR_PSH_MASK ((uint8_t)0x08) #define TCP_HDR_FIN_MASK ((uint8_t)0x01) @@ -46,9 +46,9 @@ static inline void update_udp_header(struct rte_mbuf *pkt, uint16_t udp_offset) { - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; - udp_hdr = (struct udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + udp_hdr = (struct rte_udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + udp_offset); udp_hdr->dgram_len = rte_cpu_to_be_16(pkt->pkt_len - udp_offset); } @@ -71,9 +71,9 @@ static inline void update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, uint8_t non_tail) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; - tcp_hdr = (struct tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + tcp_hdr = (struct rte_tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l4_offset); tcp_hdr->sent_seq = rte_cpu_to_be_32(sent_seq); if (likely(non_tail)) @@ -98,9 +98,9 @@ update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, static inline void update_ipv4_header(struct rte_mbuf *pkt, uint16_t l3_offset, uint16_t id) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l3_offset); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - l3_offset); ipv4_hdr->packet_id = rte_cpu_to_be_16(id); diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index a626a11e3..3aab297f4 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -18,12 +18,12 @@ extern "C" { #include /* Minimum GSO segment size for TCP based packets. */ -#define RTE_GSO_SEG_SIZE_MIN (sizeof(struct ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct tcp_hdr) + 1) +#define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ -#define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr) + 1) +#define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ #define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) diff --git a/lib/librte_hash/rte_thash.h b/lib/librte_hash/rte_thash.h index a6ddb7bf7..adbaf8f70 100644 --- a/lib/librte_hash/rte_thash.h +++ b/lib/librte_hash/rte_thash.h @@ -168,7 +168,7 @@ rte_convert_rss_key(const uint32_t *orig, uint32_t *targ, int len) * Pointer to rte_ipv6_tuple structure */ static inline void -rte_thash_load_v6_addrs(const struct ipv6_hdr *orig, union rte_thash_tuple *targ) +rte_thash_load_v6_addrs(const struct rte_ipv6_hdr *orig, union rte_thash_tuple *targ) { #ifdef RTE_ARCH_X86 __m128i ipv6 = _mm_loadu_si128((const __m128i *)orig->src_addr); diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 7f425f610..28ba33dac 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -210,7 +210,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv6_hdr *ip_hdr, + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr); /** @@ -225,7 +225,7 @@ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * present. */ static inline struct ipv6_extension_fragment * -rte_ipv6_frag_get_ipv6_fragment_header(struct ipv6_hdr *hdr) +rte_ipv6_frag_get_ipv6_fragment_header(struct rte_ipv6_hdr *hdr) { if (hdr->proto == IPPROTO_FRAGMENT) { return (struct ipv6_extension_fragment *) ++hdr; @@ -284,7 +284,7 @@ int32_t rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv4_hdr *ip_hdr); + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv4_hdr *ip_hdr); /** * Check if the IPv4 packet is fragmented @@ -295,12 +295,12 @@ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * 1 if fragmented, 0 if not fragmented */ static inline int -rte_ipv4_frag_pkt_is_fragmented(const struct ipv4_hdr * hdr) { +rte_ipv4_frag_pkt_is_fragmented(const struct rte_ipv4_hdr * hdr) { uint16_t flag_offset, ip_flag, ip_ofs; flag_offset = rte_be_to_cpu_16(hdr->fragment_offset); - ip_ofs = (uint16_t)(flag_offset & IPV4_HDR_OFFSET_MASK); - ip_flag = (uint16_t)(flag_offset & IPV4_HDR_MF_FLAG); + ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); + ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); return ip_flag != 0 || ip_ofs != 0; } diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h index 601abdfc6..ce86b19a2 100644 --- a/lib/librte_kni/rte_kni.h +++ b/lib/librte_kni/rte_kni.h @@ -68,7 +68,7 @@ struct rte_kni_conf { __extension__ uint8_t force_bind : 1; /* Flag to bind kernel thread */ - char mac_addr[ETHER_ADDR_LEN]; /* MAC address assigned to KNI */ + char mac_addr[RTE_ETHER_ADDR_LEN]; /* MAC address assigned to KNI */ uint16_t mtu; }; diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h index c96061291..400bd5e2c 100644 --- a/lib/librte_pipeline/rte_table_action.h +++ b/lib/librte_pipeline/rte_table_action.h @@ -384,8 +384,8 @@ enum rte_table_action_encap_type { /** Pre-computed Ethernet header fields for encapsulation action. */ struct rte_table_action_ether_hdr { - struct ether_addr da; /**< Destination address. */ - struct ether_addr sa; /**< Source address. */ + struct rte_ether_addr da; /**< Destination address. */ + struct rte_ether_addr sa; /**< Source address. */ }; /** Pre-computed VLAN header fields for encapsulation action. */ diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index b4abad30c..064ebb951 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -356,7 +356,7 @@ struct virtio_net { uint64_t log_size; uint64_t log_base; uint64_t log_addr; - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t mtu; struct vhost_device_ops const *notify_ops;