#include <stdint.h>
#include "main.h"
#include "vxlan.h"
static uint16_t
get_psd_sum(void *l3_hdr, uint16_t ethertype, uint64_t ol_flags)
{
else
}
static void
parse_ethernet(
struct ether_hdr *eth_hdr,
union tunnel_offload_info *info,
uint8_t *l4_proto)
{
uint16_t ethertype;
info->outer_l2_len =
sizeof(
struct ether_hdr);
info->outer_l2_len +=
sizeof(
struct vlan_hdr);
}
switch (ethertype) {
((char *)eth_hdr + info->outer_l2_len);
info->outer_l3_len =
sizeof(
struct ipv4_hdr);
break;
((char *)eth_hdr + info->outer_l2_len);
info->outer_l3_len =
sizeof(
struct ipv6_hdr);
break;
default:
info->outer_l3_len = 0;
*l4_proto = 0;
break;
}
}
static uint64_t
process_inner_cksums(
struct ether_hdr *eth_hdr,
union tunnel_offload_info *info)
{
void *l3_hdr = NULL;
uint8_t l4_proto;
uint16_t ethertype;
uint64_t ol_flags = 0;
info->l2_len +=
sizeof(
struct vlan_hdr);
}
l3_hdr = (char *)eth_hdr + info->l2_len;
} else
return 0;
if (l4_proto == IPPROTO_UDP) {
ethertype, ol_flags);
} else if (l4_proto == IPPROTO_TCP) {
if (tso_segsz != 0) {
info->tso_segsz = tso_segsz;
}
} else if (l4_proto == IPPROTO_SCTP) {
}
return ol_flags;
}
int
{
uint8_t l4_proto = 0;
uint16_t outer_header_len;
union tunnel_offload_info info = { .data = 0 };
parse_ethernet(phdr, &info, &l4_proto);
if (l4_proto != IPPROTO_UDP)
return -1;
info.outer_l2_len + info.outer_l3_len);
return -1;
outer_header_len = info.outer_l2_len + info.outer_l3_len
return 0;
}
void
encapsulation(
struct rte_mbuf *m, uint8_t queue_id)
{
uint vport_id;
uint64_t ol_flags = 0;
uint32_t old_len = m->
pkt_len, hash;
union tunnel_offload_info tx_offload = { .data = 0 };
vport_id = queue_id - 1;
if (tx_checksum) {
ol_flags |= process_inner_cksums(phdr, &tx_offload);
m->
l2_len = tx_offload.l2_len;
m->
l3_len = tx_offload.l3_len;
m->
l4_len = tx_offload.l4_len;
}
+ PORT_MIN);
return;
}