summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Marchand <david.marchand@redhat.com>2019-06-04 11:29:08 +0200
committerIan Stokes <ian.stokes@intel.com>2019-06-20 16:49:02 +0100
commit75e5e39e5468cb9f15114f7d8b367d39bc26756c (patch)
tree7d505a2eba274017bbf84ae9e96d944f4d01592e
parent446a2a7ede1f377687e8c0d848d63eb5e9988cfa (diff)
downloadopenvswitch-dpdk-hwol.tar.gz
netdev-dpdk: Prefix network structures with rte_.dpdk-hwol
Following a rework of dpdk network structures names [1], update the concerned parts. Ran Olivier script [2]: sh prefix-net-rte.sh $(find -name "*dpdk*.c") sh prefix-net-rte.sh $(find -name "*dpdk*.h") sh prefix-net-rte.sh $(find -name "*rte*.c") sh prefix-net-rte.sh $(find -name "*rte*.h") 1: http://mails.dpdk.org/archives/dev/2019-May/132612.html 2: http://mails.dpdk.org/archives/dev/2019-May/133081.html Signed-off-by: David Marchand <david.marchand@redhat.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
-rw-r--r--include/sparse/rte_esp.h2
-rw-r--r--include/sparse/rte_flow.h18
-rw-r--r--include/sparse/rte_icmp.h6
-rw-r--r--include/sparse/rte_ip.h70
-rw-r--r--include/sparse/rte_sctp.h2
-rw-r--r--include/sparse/rte_tcp.h2
-rw-r--r--include/sparse/rte_udp.h2
-rw-r--r--lib/netdev-dpdk.c21
8 files changed, 62 insertions, 61 deletions
diff --git a/include/sparse/rte_esp.h b/include/sparse/rte_esp.h
index d3fc19e32..749107451 100644
--- a/include/sparse/rte_esp.h
+++ b/include/sparse/rte_esp.h
@@ -53,7 +53,7 @@ extern "C" {
/**
* ESP Header
*/
-struct esp_hdr {
+struct rte_esp_hdr {
ovs_be32 spi; /**< Security Parameters Index */
ovs_be32 seq; /**< packet sequence number */
} __attribute__((__packed__));
diff --git a/include/sparse/rte_flow.h b/include/sparse/rte_flow.h
index 02fa523b4..e5f9f93c5 100644
--- a/include/sparse/rte_flow.h
+++ b/include/sparse/rte_flow.h
@@ -479,8 +479,8 @@ static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
* Matches an Ethernet header.
*/
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. */
};
@@ -523,7 +523,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. */
@@ -544,7 +544,7 @@ static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = {
* Note: IPv6 options are handled by dedicated pattern items.
*/
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. */
@@ -567,7 +567,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. */
@@ -586,7 +586,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. */
@@ -605,7 +605,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. */
@@ -624,7 +624,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. */
@@ -806,7 +806,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. */
diff --git a/include/sparse/rte_icmp.h b/include/sparse/rte_icmp.h
index 62e8b0400..f4844ede8 100644
--- a/include/sparse/rte_icmp.h
+++ b/include/sparse/rte_icmp.h
@@ -87,7 +87,7 @@ extern "C" {
/**
* ICMP Header
*/
-struct icmp_hdr {
+struct rte_icmp_hdr {
uint8_t icmp_type; /* ICMP packet type. */
uint8_t icmp_code; /* ICMP packet code. */
ovs_be16 icmp_cksum; /* ICMP packet checksum. */
@@ -96,8 +96,8 @@ struct icmp_hdr {
} __attribute__((__packed__));
/* ICMP packet types */
-#define IP_ICMP_ECHO_REPLY 0
-#define IP_ICMP_ECHO_REQUEST 8
+#define RTE_IP_ICMP_ECHO_REPLY 0
+#define RTE_IP_ICMP_ECHO_REQUEST 8
#ifdef __cplusplus
}
diff --git a/include/sparse/rte_ip.h b/include/sparse/rte_ip.h
index b171308c0..024aadaa7 100644
--- a/include/sparse/rte_ip.h
+++ b/include/sparse/rte_ip.h
@@ -90,7 +90,7 @@ extern "C" {
/**
* IPv4 Header
*/
-struct ipv4_hdr {
+struct rte_ipv4_hdr {
uint8_t version_ihl; /**< version and header length */
uint8_t type_of_service; /**< type of service */
ovs_be16 total_length; /**< length of packet */
@@ -104,52 +104,52 @@ struct ipv4_hdr {
} __attribute__((__packed__));
/** Create IPv4 address */
-#define IPv4(a,b,c,d) ((uint32_t)(((a) & 0xff) << 24) | \
+#define RTE_IPV4(a,b,c,d) ((uint32_t)(((a) & 0xff) << 24) | \
(((b) & 0xff) << 16) | \
(((c) & 0xff) << 8) | \
((d) & 0xff))
/** Maximal IPv4 packet length (including a header) */
-#define IPV4_MAX_PKT_LEN 65535
+#define RTE_IPV4_MAX_PKT_LEN 65535
/** Internet header length mask for version_ihl field */
-#define IPV4_HDR_IHL_MASK (0x0f)
+#define RTE_IPV4_HDR_IHL_MASK (0x0f)
/**
* Internet header length field multiplier (IHL field specifies overall header
* length in number of 4-byte words)
*/
-#define IPV4_IHL_MULTIPLIER (4)
+#define RTE_IPV4_IHL_MULTIPLIER (4)
/* Fragment Offset * Flags. */
-#define IPV4_HDR_DF_SHIFT 14
-#define IPV4_HDR_MF_SHIFT 13
-#define IPV4_HDR_FO_SHIFT 3
+#define RTE_IPV4_HDR_DF_SHIFT 14
+#define RTE_IPV4_HDR_MF_SHIFT 13
+#define RTE_IPV4_HDR_FO_SHIFT 3
-#define IPV4_HDR_DF_FLAG (1 << IPV4_HDR_DF_SHIFT)
-#define IPV4_HDR_MF_FLAG (1 << IPV4_HDR_MF_SHIFT)
+#define RTE_IPV4_HDR_DF_FLAG (1 << RTE_IPV4_HDR_DF_SHIFT)
+#define RTE_IPV4_HDR_MF_FLAG (1 << RTE_IPV4_HDR_MF_SHIFT)
-#define IPV4_HDR_OFFSET_MASK ((1 << IPV4_HDR_MF_SHIFT) - 1)
+#define RTE_IPV4_HDR_OFFSET_MASK ((1 << RTE_IPV4_HDR_MF_SHIFT) - 1)
-#define IPV4_HDR_OFFSET_UNITS 8
+#define RTE_IPV4_HDR_OFFSET_UNITS 8
/*
* IPv4 address types
*/
-#define IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */
-#define IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */
-#define IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */
-#define IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */
-#define IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */
-#define IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */
+#define RTE_IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */
+#define RTE_IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */
+#define RTE_IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */
+#define RTE_IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */
+#define RTE_IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */
+#define RTE_IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */
/*
* IPv4 Multicast-related macros
*/
-#define IPV4_MIN_MCAST IPv4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */
-#define IPV4_MAX_MCAST IPv4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */
+#define RTE_IPV4_MIN_MCAST RTE_IPV4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */
+#define RTE_IPV4_MAX_MCAST RTE_IPV4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */
-#define IS_IPV4_MCAST(x) \
- ((x) >= IPV4_MIN_MCAST && (x) <= IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */
+#define RTE_IS_IPV4_MCAST(x) \
+ ((x) >= RTE_IPV4_MIN_MCAST && (x) <= RTE_IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */
/**
* @internal Calculate a sum of all words in the buffer.
@@ -311,10 +311,10 @@ rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len,
* The complemented checksum to set in the IP packet.
*/
static inline uint16_t
-rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr)
+rte_ipv4_cksum(const struct rte_ipv4_hdr *ipv4_hdr)
{
uint16_t cksum;
- cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct ipv4_hdr));
+ cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct rte_ipv4_hdr));
return (cksum == 0xffff) ? cksum : ~cksum;
}
@@ -337,7 +337,7 @@ rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr)
* The non-complemented checksum to set in the L4 header.
*/
static inline uint16_t
-rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
+rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
{
struct ipv4_psd_header {
ovs_be32 src_addr; /* IP address of source host. */
@@ -356,7 +356,7 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
} else {
psd_hdr.len = rte_cpu_to_be_16(
(uint16_t)(rte_be_to_cpu_16(ipv4_hdr->total_length)
- - sizeof(struct ipv4_hdr)));
+ - sizeof(struct rte_ipv4_hdr)));
}
return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr));
}
@@ -375,13 +375,13 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
* The complemented checksum to set in the IP packet.
*/
static inline uint16_t
-rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)
+rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
{
uint32_t cksum;
uint32_t l4_len;
l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
- sizeof(struct ipv4_hdr);
+ sizeof(struct rte_ipv4_hdr);
cksum = rte_raw_cksum(l4_hdr, l4_len);
cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0);
@@ -397,7 +397,7 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)
/**
* IPv6 Header
*/
-struct ipv6_hdr {
+struct rte_ipv6_hdr {
ovs_be32 vtc_flow; /**< IP version, traffic class & flow label. */
ovs_be16 payload_len; /**< IP packet length - includes sizeof(ip_header). */
uint8_t proto; /**< Protocol, next header. */
@@ -407,10 +407,10 @@ struct ipv6_hdr {
} __attribute__((__packed__));
/* IPv6 vtc_flow: IPv / TC / flow_label */
-#define IPV6_HDR_FL_SHIFT 0
-#define IPV6_HDR_TC_SHIFT 20
-#define IPV6_HDR_FL_MASK ((1u << IPV6_HDR_TC_SHIFT) - 1)
-#define IPV6_HDR_TC_MASK (0xf << IPV6_HDR_TC_SHIFT)
+#define RTE_IPV6_HDR_FL_SHIFT 0
+#define RTE_IPV6_HDR_TC_SHIFT 20
+#define RTE_IPV6_HDR_FL_MASK ((1u << RTE_IPV6_HDR_TC_SHIFT) - 1)
+#define RTE_IPV6_HDR_TC_MASK (0xf << RTE_IPV6_HDR_TC_SHIFT)
/**
* Process the pseudo-header checksum of an IPv6 header.
@@ -429,7 +429,7 @@ struct ipv6_hdr {
* The non-complemented checksum to set in the L4 header.
*/
static inline uint16_t
-rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
+rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
{
uint32_t sum;
struct {
@@ -465,7 +465,7 @@ rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags)
* The complemented checksum to set in the IP packet.
*/
static inline uint16_t
-rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr)
+rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
{
uint32_t cksum;
uint32_t l4_len;
diff --git a/include/sparse/rte_sctp.h b/include/sparse/rte_sctp.h
index 74287905d..1cca2fb20 100644
--- a/include/sparse/rte_sctp.h
+++ b/include/sparse/rte_sctp.h
@@ -89,7 +89,7 @@ extern "C" {
/**
* SCTP Header
*/
-struct sctp_hdr {
+struct rte_sctp_hdr {
ovs_be16 src_port; /**< Source port. */
ovs_be16 dst_port; /**< Destin port. */
ovs_be32 tag; /**< Validation tag. */
diff --git a/include/sparse/rte_tcp.h b/include/sparse/rte_tcp.h
index 729529695..0d898d490 100644
--- a/include/sparse/rte_tcp.h
+++ b/include/sparse/rte_tcp.h
@@ -89,7 +89,7 @@ extern "C" {
/**
* TCP Header
*/
-struct tcp_hdr {
+struct rte_tcp_hdr {
ovs_be16 src_port; /**< TCP source port. */
ovs_be16 dst_port; /**< TCP destination port. */
ovs_be32 sent_seq; /**< TX data sequence number. */
diff --git a/include/sparse/rte_udp.h b/include/sparse/rte_udp.h
index 8694a1dcf..4155a567f 100644
--- a/include/sparse/rte_udp.h
+++ b/include/sparse/rte_udp.h
@@ -89,7 +89,7 @@ extern "C" {
/**
* UDP Header
*/
-struct udp_hdr {
+struct rte_udp_hdr {
ovs_be16 src_port; /**< UDP source port. */
ovs_be16 dst_port; /**< UDP destination port. */
ovs_be16 dgram_len; /**< UDP datagram length */
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 9e232ef0f..381d96b42 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -83,12 +83,13 @@ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
* The minimum mbuf size is limited to avoid scatter behaviour and drop in
* performance for standard Ethernet MTU.
*/
-#define ETHER_HDR_MAX_LEN (ETHER_HDR_LEN + ETHER_CRC_LEN \
+#define ETHER_HDR_MAX_LEN (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN \
+ (2 * VLAN_HEADER_LEN))
-#define MTU_TO_FRAME_LEN(mtu) ((mtu) + ETHER_HDR_LEN + ETHER_CRC_LEN)
+#define MTU_TO_FRAME_LEN(mtu) ((mtu) + RTE_ETHER_HDR_LEN + \
+ RTE_ETHER_CRC_LEN)
#define MTU_TO_MAX_FRAME_LEN(mtu) ((mtu) + ETHER_HDR_MAX_LEN)
#define FRAME_LEN_TO_MTU(frame_len) ((frame_len) \
- - ETHER_HDR_LEN - ETHER_CRC_LEN)
+ - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN)
#define NETDEV_DPDK_MBUF_ALIGN 1024
#define NETDEV_DPDK_MAX_PKT_LEN 9728
@@ -593,7 +594,7 @@ dpdk_calculate_mbufs(struct netdev_dpdk *dev, int mtu, bool per_port_mp)
* can change dynamically at runtime. For now, use this rough
* heurisitic.
*/
- if (mtu >= ETHER_MTU) {
+ if (mtu >= RTE_ETHER_MTU) {
n_mbufs = MAX_NB_MBUF;
} else {
n_mbufs = MIN_NB_MBUF;
@@ -908,7 +909,7 @@ dpdk_eth_dev_port_config(struct netdev_dpdk *dev, int n_rxq, int n_txq)
* scatter to support jumbo RX.
* Setting scatter for the device is done after checking for
* scatter support in the device capabilites. */
- if (dev->mtu > ETHER_MTU) {
+ if (dev->mtu > RTE_ETHER_MTU) {
if (dev->hw_ol_features & NETDEV_RX_HW_SCATTER) {
conf.rxmode.offloads |= DEV_RX_OFFLOAD_SCATTER;
}
@@ -1020,7 +1021,7 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev)
{
struct rte_pktmbuf_pool_private *mbp_priv;
struct rte_eth_dev_info info;
- struct ether_addr eth_addr;
+ struct rte_ether_addr eth_addr;
int diag;
int n_rxq, n_txq;
uint32_t rx_chksm_offload_capa = DEV_RX_OFFLOAD_UDP_CKSUM |
@@ -1145,7 +1146,7 @@ common_construct(struct netdev *netdev, dpdk_port_t port_no,
dev->port_id = port_no;
dev->type = type;
dev->flags = 0;
- dev->requested_mtu = ETHER_MTU;
+ dev->requested_mtu = RTE_ETHER_MTU;
dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu);
dev->requested_lsc_interrupt_mode = 0;
ovsrcu_index_init(&dev->vid, -1);
@@ -1661,7 +1662,7 @@ netdev_dpdk_get_port_by_mac(const char *mac_str)
}
RTE_ETH_FOREACH_DEV (port_id) {
- struct ether_addr ea;
+ struct rte_ether_addr ea;
rte_eth_macaddr_get(port_id, &ea);
memcpy(port_mac.ea, ea.addr_bytes, ETH_ADDR_LEN);
@@ -2030,7 +2031,7 @@ netdev_dpdk_policer_pkt_handle(struct rte_meter_srtcm *meter,
struct rte_meter_srtcm_profile *profile,
struct rte_mbuf *pkt, uint64_t time)
{
- uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - sizeof(struct ether_hdr);
+ uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - sizeof(struct rte_ether_hdr);
return rte_meter_srtcm_color_blind_check(meter, profile, time, pkt_len) ==
RTE_COLOR_GREEN;
@@ -2559,7 +2560,7 @@ netdev_dpdk_set_mtu(struct netdev *netdev, int mtu)
* a method to retrieve the upper bound MTU for a given device.
*/
if (MTU_TO_MAX_FRAME_LEN(mtu) > NETDEV_DPDK_MAX_PKT_LEN
- || mtu < ETHER_MIN_MTU) {
+ || mtu < RTE_ETHER_MIN_MTU) {
VLOG_WARN("%s: unsupported MTU %d\n", dev->up.name, mtu);
return EINVAL;
}