X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_pipeline%2Frte_table_action.c;h=98f3438774697769cb885f0fba5974484528ef30;hb=378cd4887d6c02bf771eee3a8b56a3af41f37b7c;hp=ef9e2fa8c278aa89a3bedf2b1327a25026b753d9;hpb=f41b5156feb575b9cfeb177974c8e625e09b480f;p=dpdk.git diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index ef9e2fa8c2..98f3438774 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -63,7 +64,7 @@ lb_cfg_check(struct rte_table_action_lb_config *cfg) struct lb_data { uint32_t out[RTE_TABLE_ACTION_LB_TABLE_SIZE]; -} __attribute__((__packed__)); +} __rte_packed; static int lb_apply(struct lb_data *data, @@ -110,7 +111,7 @@ mtr_cfg_check(struct rte_table_action_mtr_config *mtr) struct mtr_trtcm_data { struct rte_meter_trtcm trtcm; uint64_t stats[RTE_COLORS]; -} __attribute__((__packed__)); +} __rte_packed; #define MTR_TRTCM_DATA_METER_PROFILE_ID_GET(data) \ (((data)->stats[RTE_COLOR_GREEN] & 0xF8LLU) >> 3) @@ -360,7 +361,7 @@ tm_cfg_check(struct rte_table_action_tm_config *tm) struct tm_data { uint32_t queue_id; uint32_t reserved; -} __attribute__((__packed__)); +} __rte_packed; static int tm_apply_check(struct rte_table_action_tm_params *p, @@ -401,7 +402,6 @@ pkt_work_tm(struct rte_mbuf *mbuf, { 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); @@ -439,7 +439,7 @@ encap_cfg_check(struct rte_table_action_encap_config *encap) struct encap_ether_data { struct rte_ether_hdr ether; -} __attribute__((__packed__)); +}; #define VLAN(pcp, dei, vid) \ ((uint16_t)((((uint64_t)(pcp)) & 0x7LLU) << 13) | \ @@ -449,13 +449,13 @@ struct encap_ether_data { struct encap_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; -} __attribute__((__packed__)); +}; struct encap_qinq_data { struct rte_ether_hdr ether; struct rte_vlan_hdr svlan; struct rte_vlan_hdr cvlan; -} __attribute__((__packed__)); +}; #define ETHER_TYPE_MPLS_UNICAST 0x8847 @@ -471,7 +471,7 @@ struct encap_mpls_data { struct rte_ether_hdr ether; uint32_t mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX]; uint32_t mpls_count; -} __attribute__((__packed__)); +} __rte_packed __rte_aligned(2); #define PPP_PROTOCOL_IP 0x0021 @@ -480,51 +480,51 @@ struct pppoe_ppp_hdr { uint16_t session_id; uint16_t length; uint16_t protocol; -} __attribute__((__packed__)); +}; struct encap_pppoe_data { struct rte_ether_hdr ether; struct pppoe_ppp_hdr pppoe_ppp; -} __attribute__((__packed__)); +}; #define IP_PROTO_UDP 17 struct encap_vxlan_ipv4_data { struct rte_ether_hdr ether; struct rte_ipv4_hdr ipv4; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; -} __attribute__((__packed__)); +} __rte_packed __rte_aligned(2); struct encap_vxlan_ipv4_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv4_hdr ipv4; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; -} __attribute__((__packed__)); +} __rte_packed __rte_aligned(2); struct encap_vxlan_ipv6_data { struct rte_ether_hdr ether; struct rte_ipv6_hdr ipv6; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; -} __attribute__((__packed__)); +} __rte_packed __rte_aligned(2); struct encap_vxlan_ipv6_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv6_hdr ipv6; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; -} __attribute__((__packed__)); +} __rte_packed __rte_aligned(2); struct encap_qinq_pppoe_data { struct rte_ether_hdr ether; struct rte_vlan_hdr svlan; struct rte_vlan_hdr cvlan; struct pppoe_ppp_hdr pppoe_ppp; -} __attribute__((__packed__)); +} __rte_packed __rte_aligned(2); static size_t encap_data_size(struct rte_table_action_encap_config *encap) @@ -611,8 +611,8 @@ encap_ether_apply(void *data, { 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); @@ -629,8 +629,8 @@ encap_vlan_apply(void *data, { 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); @@ -653,8 +653,8 @@ encap_qinq_apply(void *data, { 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); @@ -697,7 +697,7 @@ encap_qinq_pppoe_apply(void *data, 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); @@ -748,7 +748,7 @@ encap_pppoe_apply(void *data, /* 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); @@ -786,7 +786,7 @@ encap_vxlan_apply(void *data, 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; @@ -821,7 +821,7 @@ encap_vxlan_apply(void *data, &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; @@ -864,7 +864,7 @@ encap_vxlan_apply(void *data, 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) | @@ -899,7 +899,7 @@ encap_vxlan_apply(void *data, &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) | @@ -1006,13 +1006,13 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_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); @@ -1036,13 +1036,13 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_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); @@ -1066,10 +1066,10 @@ pkt_work_encap_vxlan_ipv6(struct rte_mbuf *mbuf, 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); @@ -1092,10 +1092,10 @@ pkt_work_encap_vxlan_ipv6_vlan(struct rte_mbuf *mbuf, 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); @@ -1209,12 +1209,12 @@ nat_cfg_check(struct rte_table_action_nat_config *nat) struct nat_ipv4_data { uint32_t addr; uint16_t port; -} __attribute__((__packed__)); +} __rte_packed; struct nat_ipv6_data { uint8_t addr[16]; uint16_t port; -} __attribute__((__packed__)); +} __rte_packed; static size_t nat_data_size(struct rte_table_action_nat_config *nat __rte_unused, @@ -1366,7 +1366,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, 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, @@ -1405,7 +1405,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, 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, @@ -1447,7 +1447,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, 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, @@ -1475,7 +1475,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, 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, @@ -1505,7 +1505,7 @@ ttl_cfg_check(struct rte_table_action_ttl_config *ttl) struct ttl_data { uint32_t n_packets; -} __attribute__((__packed__)); +} __rte_packed; #define TTL_INIT(data, decrement) \ ((data)->n_packets = (decrement) ? 1 : 0) @@ -1589,7 +1589,7 @@ stats_cfg_check(struct rte_table_action_stats_config *stats) struct stats_data { uint64_t n_packets; uint64_t n_bytes; -} __attribute__((__packed__)); +} __rte_packed; static int stats_apply(struct stats_data *data, @@ -1614,7 +1614,7 @@ pkt_work_stats(struct stats_data *data, */ struct time_data { uint64_t time; -} __attribute__((__packed__)); +} __rte_packed; static int time_apply(struct time_data *data, @@ -1727,7 +1727,7 @@ struct sym_crypto_data { /** Private data size to store cipher iv / aad. */ uint8_t iv_aad_data[32]; -} __attribute__((__packed__)); +} __rte_packed; static int sym_crypto_cfg_check(struct rte_table_action_sym_crypto_config *cfg) @@ -2070,7 +2070,7 @@ pkt_work_sym_crypto(struct rte_mbuf *mbuf, struct sym_crypto_data *data, */ struct tag_data { uint32_t tag; -} __attribute__((__packed__)); +} __rte_packed; static int tag_apply(struct tag_data *data, @@ -2114,7 +2114,7 @@ pkt4_work_tag(struct rte_mbuf *mbuf0, */ struct decap_data { uint16_t n; -} __attribute__((__packed__)); +} __rte_packed; static int decap_apply(struct decap_data *data,