{
struct dscp_table_entry_data *dscp_entry = &dscp_table->entry[dscp];
uint32_t queue_id = data->queue_id |
- (dscp_entry->tc << 2) |
dscp_entry->tc_queue;
rte_mbuf_sched_set(mbuf, queue_id, dscp_entry->tc,
(uint8_t)dscp_entry->color);
struct encap_vxlan_ipv4_data {
struct rte_ether_hdr ether;
- struct ipv4_hdr ipv4;
- struct udp_hdr udp;
+ struct rte_ipv4_hdr ipv4;
+ struct rte_udp_hdr udp;
struct rte_vxlan_hdr vxlan;
} __attribute__((__packed__));
struct encap_vxlan_ipv4_vlan_data {
struct rte_ether_hdr ether;
struct rte_vlan_hdr vlan;
- struct ipv4_hdr ipv4;
- struct udp_hdr udp;
+ struct rte_ipv4_hdr ipv4;
+ struct rte_udp_hdr udp;
struct rte_vxlan_hdr vxlan;
} __attribute__((__packed__));
struct encap_vxlan_ipv6_data {
struct rte_ether_hdr ether;
- struct ipv6_hdr ipv6;
- struct udp_hdr udp;
+ struct rte_ipv6_hdr ipv6;
+ struct rte_udp_hdr udp;
struct rte_vxlan_hdr vxlan;
} __attribute__((__packed__));
struct encap_vxlan_ipv6_vlan_data {
struct rte_ether_hdr ether;
struct rte_vlan_hdr vlan;
- struct ipv6_hdr ipv6;
- struct udp_hdr udp;
+ struct rte_ipv6_hdr ipv6;
+ struct rte_udp_hdr udp;
struct rte_vxlan_hdr vxlan;
} __attribute__((__packed__));
{
struct encap_ether_data *d = data;
uint16_t ethertype = (common_cfg->ip_version) ?
- RTE_ETHER_TYPE_IPv4 :
- RTE_ETHER_TYPE_IPv6;
+ RTE_ETHER_TYPE_IPV4 :
+ RTE_ETHER_TYPE_IPV6;
/* Ethernet */
rte_ether_addr_copy(&p->ether.ether.da, &d->ether.d_addr);
{
struct encap_vlan_data *d = data;
uint16_t ethertype = (common_cfg->ip_version) ?
- RTE_ETHER_TYPE_IPv4 :
- RTE_ETHER_TYPE_IPv6;
+ RTE_ETHER_TYPE_IPV4 :
+ RTE_ETHER_TYPE_IPV6;
/* Ethernet */
rte_ether_addr_copy(&p->vlan.ether.da, &d->ether.d_addr);
{
struct encap_qinq_data *d = data;
uint16_t ethertype = (common_cfg->ip_version) ?
- RTE_ETHER_TYPE_IPv4 :
- RTE_ETHER_TYPE_IPv6;
+ RTE_ETHER_TYPE_IPV4 :
+ RTE_ETHER_TYPE_IPV6;
/* Ethernet */
rte_ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr);
d->cvlan.vlan_tci = rte_htons(VLAN(p->qinq.cvlan.pcp,
p->qinq.cvlan.dei,
p->qinq.cvlan.vid));
- d->cvlan.eth_proto = rte_htons(ETHER_TYPE_PPPOE_SESSION);
+ d->cvlan.eth_proto = rte_htons(RTE_ETHER_TYPE_PPPOE_SESSION);
/* PPPoE and PPP*/
d->pppoe_ppp.ver_type_code = rte_htons(0x1100);
/* Ethernet */
rte_ether_addr_copy(&p->pppoe.ether.da, &d->ether.d_addr);
rte_ether_addr_copy(&p->pppoe.ether.sa, &d->ether.s_addr);
- d->ether.ether_type = rte_htons(ETHER_TYPE_PPPOE_SESSION);
+ d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_PPPOE_SESSION);
/* PPPoE and PPP*/
d->pppoe_ppp.ver_type_code = rte_htons(0x1100);
d->vlan.vlan_tci = rte_htons(VLAN(p->vxlan.vlan.pcp,
p->vxlan.vlan.dei,
p->vxlan.vlan.vid));
- d->vlan.eth_proto = rte_htons(RTE_ETHER_TYPE_IPv4);
+ d->vlan.eth_proto = rte_htons(RTE_ETHER_TYPE_IPV4);
/* IPv4*/
d->ipv4.version_ihl = 0x45;
&d->ether.d_addr);
rte_ether_addr_copy(&p->vxlan.ether.sa,
&d->ether.s_addr);
- d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_IPv4);
+ d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_IPV4);
/* IPv4*/
d->ipv4.version_ihl = 0x45;
d->vlan.vlan_tci = rte_htons(VLAN(p->vxlan.vlan.pcp,
p->vxlan.vlan.dei,
p->vxlan.vlan.vid));
- d->vlan.eth_proto = rte_htons(RTE_ETHER_TYPE_IPv6);
+ d->vlan.eth_proto = rte_htons(RTE_ETHER_TYPE_IPV6);
/* IPv6*/
d->ipv6.vtc_flow = rte_htonl((6 << 28) |
&d->ether.d_addr);
rte_ether_addr_copy(&p->vxlan.ether.sa,
&d->ether.s_addr);
- d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_IPv6);
+ d->ether.ether_type = rte_htons(RTE_ETHER_TYPE_IPV6);
/* IPv6*/
d->ipv6.vtc_flow = rte_htonl((6 << 28) |
ether_length = (uint16_t)mbuf->pkt_len;
ipv4_total_length = ether_length +
(sizeof(struct rte_vxlan_hdr) +
- sizeof(struct udp_hdr) +
- sizeof(struct ipv4_hdr));
+ sizeof(struct rte_udp_hdr) +
+ sizeof(struct rte_ipv4_hdr));
ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum,
rte_htons(ipv4_total_length));
udp_length = ether_length +
(sizeof(struct rte_vxlan_hdr) +
- sizeof(struct udp_hdr));
+ sizeof(struct rte_udp_hdr));
vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl));
vxlan_pkt->ipv4.total_length = rte_htons(ipv4_total_length);
ether_length = (uint16_t)mbuf->pkt_len;
ipv4_total_length = ether_length +
(sizeof(struct rte_vxlan_hdr) +
- sizeof(struct udp_hdr) +
- sizeof(struct ipv4_hdr));
+ sizeof(struct rte_udp_hdr) +
+ sizeof(struct rte_ipv4_hdr));
ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum,
rte_htons(ipv4_total_length));
udp_length = ether_length +
(sizeof(struct rte_vxlan_hdr) +
- sizeof(struct udp_hdr));
+ sizeof(struct rte_udp_hdr));
vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl));
vxlan_pkt->ipv4.total_length = rte_htons(ipv4_total_length);
ether_length = (uint16_t)mbuf->pkt_len;
ipv6_payload_length = ether_length +
(sizeof(struct rte_vxlan_hdr) +
- sizeof(struct udp_hdr));
+ sizeof(struct rte_udp_hdr));
udp_length = ether_length +
(sizeof(struct rte_vxlan_hdr) +
- sizeof(struct udp_hdr));
+ sizeof(struct rte_udp_hdr));
vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl));
vxlan_pkt->ipv6.payload_len = rte_htons(ipv6_payload_length);
ether_length = (uint16_t)mbuf->pkt_len;
ipv6_payload_length = ether_length +
(sizeof(struct rte_vxlan_hdr) +
- sizeof(struct udp_hdr));
+ sizeof(struct rte_udp_hdr));
udp_length = ether_length +
(sizeof(struct rte_vxlan_hdr) +
- sizeof(struct udp_hdr));
+ sizeof(struct rte_udp_hdr));
vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl));
vxlan_pkt->ipv6.payload_len = rte_htons(ipv6_payload_length);
}
static __rte_always_inline void
-pkt_ipv4_work_nat(struct ipv4_hdr *ip,
+pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip,
struct nat_ipv4_data *data,
struct rte_table_action_nat_config *cfg)
{
if (cfg->source_nat) {
if (cfg->proto == 0x6) {
- struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1];
+ struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1];
uint16_t ip_cksum, tcp_cksum;
ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum,
tcp->src_port = data->port;
tcp->cksum = tcp_cksum;
} else {
- struct udp_hdr *udp = (struct udp_hdr *) &ip[1];
+ struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1];
uint16_t ip_cksum, udp_cksum;
ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum,
}
} else {
if (cfg->proto == 0x6) {
- struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1];
+ struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1];
uint16_t ip_cksum, tcp_cksum;
ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum,
tcp->dst_port = data->port;
tcp->cksum = tcp_cksum;
} else {
- struct udp_hdr *udp = (struct udp_hdr *) &ip[1];
+ struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1];
uint16_t ip_cksum, udp_cksum;
ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum,
}
static __rte_always_inline void
-pkt_ipv6_work_nat(struct ipv6_hdr *ip,
+pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip,
struct nat_ipv6_data *data,
struct rte_table_action_nat_config *cfg)
{
if (cfg->source_nat) {
if (cfg->proto == 0x6) {
- struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1];
+ struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1];
uint16_t tcp_cksum;
tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum,
tcp->src_port = data->port;
tcp->cksum = tcp_cksum;
} else {
- struct udp_hdr *udp = (struct udp_hdr *) &ip[1];
+ struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1];
uint16_t udp_cksum;
udp_cksum = nat_ipv6_tcp_udp_checksum_update(udp->dgram_cksum,
}
} else {
if (cfg->proto == 0x6) {
- struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1];
+ struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1];
uint16_t tcp_cksum;
tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum,
tcp->dst_port = data->port;
tcp->cksum = tcp_cksum;
} else {
- struct udp_hdr *udp = (struct udp_hdr *) &ip[1];
+ struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1];
uint16_t udp_cksum;
udp_cksum = nat_ipv6_tcp_udp_checksum_update(udp->dgram_cksum,
}
static __rte_always_inline uint64_t
-pkt_ipv4_work_ttl(struct ipv4_hdr *ip,
+pkt_ipv4_work_ttl(struct rte_ipv4_hdr *ip,
struct ttl_data *data)
{
uint32_t drop;
}
static __rte_always_inline uint64_t
-pkt_ipv6_work_ttl(struct ipv6_hdr *ip,
+pkt_ipv6_work_ttl(struct rte_ipv6_hdr *ip,
struct ttl_data *data)
{
uint32_t drop;
uint16_t total_length;
if (cfg->common.ip_version) {
- struct ipv4_hdr *hdr = ip;
+ struct rte_ipv4_hdr *hdr = ip;
dscp = hdr->type_of_service >> 2;
total_length = rte_ntohs(hdr->total_length);
} else {
- struct ipv6_hdr *hdr = ip;
+ struct rte_ipv6_hdr *hdr = ip;
dscp = (rte_ntohl(hdr->vtc_flow) & 0x0F600000) >> 18;
- total_length =
- rte_ntohs(hdr->payload_len) + sizeof(struct ipv6_hdr);
+ total_length = rte_ntohs(hdr->payload_len) +
+ sizeof(struct rte_ipv6_hdr);
}
if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) {
uint16_t total_length0, total_length1, total_length2, total_length3;
if (cfg->common.ip_version) {
- struct ipv4_hdr *hdr0 = ip0;
- struct ipv4_hdr *hdr1 = ip1;
- struct ipv4_hdr *hdr2 = ip2;
- struct ipv4_hdr *hdr3 = ip3;
+ struct rte_ipv4_hdr *hdr0 = ip0;
+ struct rte_ipv4_hdr *hdr1 = ip1;
+ struct rte_ipv4_hdr *hdr2 = ip2;
+ struct rte_ipv4_hdr *hdr3 = ip3;
dscp0 = hdr0->type_of_service >> 2;
dscp1 = hdr1->type_of_service >> 2;
total_length2 = rte_ntohs(hdr2->total_length);
total_length3 = rte_ntohs(hdr3->total_length);
} else {
- struct ipv6_hdr *hdr0 = ip0;
- struct ipv6_hdr *hdr1 = ip1;
- struct ipv6_hdr *hdr2 = ip2;
- struct ipv6_hdr *hdr3 = ip3;
+ struct rte_ipv6_hdr *hdr0 = ip0;
+ struct rte_ipv6_hdr *hdr1 = ip1;
+ struct rte_ipv6_hdr *hdr2 = ip2;
+ struct rte_ipv6_hdr *hdr3 = ip3;
dscp0 = (rte_ntohl(hdr0->vtc_flow) & 0x0F600000) >> 18;
dscp1 = (rte_ntohl(hdr1->vtc_flow) & 0x0F600000) >> 18;
dscp2 = (rte_ntohl(hdr2->vtc_flow) & 0x0F600000) >> 18;
dscp3 = (rte_ntohl(hdr3->vtc_flow) & 0x0F600000) >> 18;
- total_length0 =
- rte_ntohs(hdr0->payload_len) + sizeof(struct ipv6_hdr);
- total_length1 =
- rte_ntohs(hdr1->payload_len) + sizeof(struct ipv6_hdr);
- total_length2 =
- rte_ntohs(hdr2->payload_len) + sizeof(struct ipv6_hdr);
- total_length3 =
- rte_ntohs(hdr3->payload_len) + sizeof(struct ipv6_hdr);
+ total_length0 = rte_ntohs(hdr0->payload_len) +
+ sizeof(struct rte_ipv6_hdr);
+ total_length1 = rte_ntohs(hdr1->payload_len) +
+ sizeof(struct rte_ipv6_hdr);
+ total_length2 = rte_ntohs(hdr2->payload_len) +
+ sizeof(struct rte_ipv6_hdr);
+ total_length3 = rte_ntohs(hdr3->payload_len) +
+ sizeof(struct rte_ipv6_hdr);
}
if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) {