return rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr);
}
/* Parse an IPv4 header to fill l3_len, l4_len, and l4_proto */
static void
return rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr);
}
/* Parse an IPv4 header to fill l3_len, l4_len, and l4_proto */
static void
info->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4;
info->l4_proto = ipv4_hdr->next_proto_id;
/* only fill l4_len for TCP, it's useful for TSO */
if (info->l4_proto == IPPROTO_TCP) {
info->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4;
info->l4_proto = ipv4_hdr->next_proto_id;
/* only fill l4_len for TCP, it's useful for TSO */
if (info->l4_proto == IPPROTO_TCP) {
info->l4_proto = ipv6_hdr->proto;
/* only fill l4_len for TCP, it's useful for TSO */
if (info->l4_proto == IPPROTO_TCP) {
info->l4_proto = ipv6_hdr->proto;
/* only fill l4_len for TCP, it's useful for TSO */
if (info->l4_proto == IPPROTO_TCP) {
- if (info->ethertype == _htons(ETHER_TYPE_VLAN)) {
- struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1);
+ if (info->ethertype == _htons(RTE_ETHER_TYPE_VLAN)) {
+ struct rte_vlan_hdr *vlan_hdr = (
+ struct rte_vlan_hdr *)(eth_hdr + 1);
- case _htons(ETHER_TYPE_IPv4):
- ipv4_hdr = (struct ipv4_hdr *) ((char *)eth_hdr + info->l2_len);
+ case _htons(RTE_ETHER_TYPE_IPV4):
+ ipv4_hdr = (struct rte_ipv4_hdr *)
+ ((char *)eth_hdr + info->l2_len);
- case _htons(ETHER_TYPE_IPv6):
- ipv6_hdr = (struct ipv6_hdr *) ((char *)eth_hdr + info->l2_len);
+ case _htons(RTE_ETHER_TYPE_IPV6):
+ ipv6_hdr = (struct rte_ipv6_hdr *)
+ ((char *)eth_hdr + info->l2_len);
/* check udp destination port, 4789 is the default vxlan port
* (rfc7348) or that the rx offload flag is set (i40e only
/* check udp destination port, 4789 is the default vxlan port
* (rfc7348) or that the rx offload flag is set (i40e only
- eth_hdr = (struct ether_hdr *)((char *)udp_hdr +
- sizeof(struct udp_hdr) +
- sizeof(struct vxlan_hdr));
+ eth_hdr = (struct rte_ether_hdr *)((char *)udp_hdr +
+ sizeof(struct rte_udp_hdr) +
+ sizeof(struct rte_vxlan_hdr));
- struct ether_hdr *eth_hdr;
- struct ipv4_hdr *ipv4_hdr;
- struct ipv6_hdr *ipv6_hdr;
- struct vxlan_gpe_hdr *vxlan_gpe_hdr;
+ struct rte_ether_hdr *eth_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr;
+ struct rte_ipv6_hdr *ipv6_hdr;
+ struct rte_vxlan_gpe_hdr *vxlan_gpe_hdr;
uint8_t vxlan_gpe_len = sizeof(*vxlan_gpe_hdr);
/* Check udp destination port. */
if (udp_hdr->dst_port != _htons(vxlan_gpe_udp_port))
return;
uint8_t vxlan_gpe_len = sizeof(*vxlan_gpe_hdr);
/* Check udp destination port. */
if (udp_hdr->dst_port != _htons(vxlan_gpe_udp_port))
return;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
- struct ether_hdr *eth_hdr;
- struct ipv4_hdr *ipv4_hdr;
- struct ipv6_hdr *ipv6_hdr;
+ struct rte_ether_hdr *eth_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr;
+ struct rte_ipv6_hdr *ipv6_hdr;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
info->is_tunnel = 1;
info->outer_ethertype = info->ethertype;
info->outer_l2_len = info->l2_len;
info->outer_l3_len = info->l3_len;
info->outer_l4_proto = info->l4_proto;
- struct ipv4_hdr *ipv4_hdr = l3_hdr;
- struct udp_hdr *udp_hdr;
- struct tcp_hdr *tcp_hdr;
- struct sctp_hdr *sctp_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr = l3_hdr;
+ struct rte_udp_hdr *udp_hdr;
+ struct rte_tcp_hdr *tcp_hdr;
+ struct rte_sctp_hdr *sctp_hdr;
ol_flags |= PKT_TX_IPV6;
else
return 0; /* packet type not supported, nothing to do */
if (info->l4_proto == IPPROTO_UDP) {
ol_flags |= PKT_TX_IPV6;
else
return 0; /* packet type not supported, nothing to do */
if (info->l4_proto == IPPROTO_UDP) {
/* do not recalculate udp cksum if it was 0 */
if (udp_hdr->dgram_cksum != 0) {
udp_hdr->dgram_cksum = 0;
/* do not recalculate udp cksum if it was 0 */
if (udp_hdr->dgram_cksum != 0) {
udp_hdr->dgram_cksum = 0;
process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info,
uint64_t tx_offloads, int tso_enabled)
{
process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info,
uint64_t tx_offloads, int tso_enabled)
{
- struct ipv4_hdr *ipv4_hdr = outer_l3_hdr;
- struct ipv6_hdr *ipv6_hdr = outer_l3_hdr;
- struct udp_hdr *udp_hdr;
+ struct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr;
+ struct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr;
+ struct rte_udp_hdr *udp_hdr;
/* outer UDP checksum is done in software. In the other side, for
* UDP tunneling, like VXLAN or Geneve, outer UDP checksum can be
/* outer UDP checksum is done in software. In the other side, for
* UDP tunneling, like VXLAN or Geneve, outer UDP checksum can be
/* do not recalculate udp cksum if it was 0 */
if (udp_hdr->dgram_cksum != 0) {
udp_hdr->dgram_cksum = 0;
/* do not recalculate udp cksum if it was 0 */
if (udp_hdr->dgram_cksum != 0) {
udp_hdr->dgram_cksum = 0;
/* step 1: dissect packet, parsing optional vlan, ip4/ip6, vxlan
* and inner headers */
/* step 1: dissect packet, parsing optional vlan, ip4/ip6, vxlan
* and inner headers */
- eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
- ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
+ eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
+ rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr],
ð_hdr->s_addr);
parse_ethernet(eth_hdr, &info);
l3_hdr = (char *)eth_hdr + info.l2_len;
ð_hdr->s_addr);
parse_ethernet(eth_hdr, &info);
l3_hdr = (char *)eth_hdr + info.l2_len;
parse_vxlan_gpe(udp_hdr, &info);
if (info.is_tunnel) {
tx_ol_flags |= PKT_TX_TUNNEL_VXLAN_GPE;
parse_vxlan_gpe(udp_hdr, &info);
if (info.is_tunnel) {
tx_ol_flags |= PKT_TX_TUNNEL_VXLAN_GPE;