Minor update to fix compilation issues on recent gcc and dpdk 86/72286/1
authorXavier Simonart <simonartxavier@gmail.com>
Mon, 29 Mar 2021 09:45:47 +0000 (11:45 +0200)
committerXavier Simonart <simonartxavier@gmail.com>
Mon, 29 Mar 2021 09:56:44 +0000 (11:56 +0200)
Fixes compilation issues seen on gcc 9.3.0 on dpdk 20.05.

Signed-off-by: Xavier Simonart <simonartxavier@gmail.com>
Change-Id: Ib7989c1bac66e82551165ab49e06941ebc772347

VNFs/DPPD-PROX/acl_field_def.h
VNFs/DPPD-PROX/arp.h
VNFs/DPPD-PROX/bng_pkts.h
VNFs/DPPD-PROX/handle_cgnat.c
VNFs/DPPD-PROX/handle_fm.c
VNFs/DPPD-PROX/handle_lb_qinq.c
VNFs/DPPD-PROX/handle_nat.c
VNFs/DPPD-PROX/prox_lua_types.h
VNFs/DPPD-PROX/prox_port_cfg.c
VNFs/DPPD-PROX/qinq.h

index 4f05ae8..da60e1c 100644 (file)
@@ -27,7 +27,7 @@ struct pkt_eth_ipv4_udp {
        prox_rte_ether_hdr ether_hdr;
        prox_rte_ipv4_hdr ipv4_hdr;
        prox_rte_udp_hdr udp_hdr;
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 static struct rte_acl_field_def pkt_eth_ipv4_udp_defs[] = {
        /* first input field - always one byte long. */
index 3e8e0d9..ebf8a89 100644 (file)
@@ -30,7 +30,7 @@ struct _arp_ipv4 {
        uint32_t spa;          /* Sender protocol address */
        prox_rte_ether_addr tha; /* Target hardware address */
        uint32_t tpa;          /* Target protocol address */
-} __attribute__((__packed__));
+} __attribute__((__packed__)) __attribute__((__aligned__(2)));
 typedef struct _arp_ipv4 arp_ipv4_t;
 
 struct my_arp_t {
@@ -40,7 +40,7 @@ struct my_arp_t {
        uint8_t    plen;
        uint16_t   oper;
        arp_ipv4_t data;
-} __attribute__((__packed__));
+} __attribute__((__packed__)) __attribute__((__aligned__(2)));
 
 struct ether_hdr_arp {
        prox_rte_ether_hdr ether_hdr;
index 50780e3..85114a0 100644 (file)
@@ -37,12 +37,12 @@ struct cpe_pkt {
 #endif
        prox_rte_ipv4_hdr ipv4_hdr;
        prox_rte_udp_hdr udp_hdr;
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 struct cpe_packet_arp {
        struct qinq_hdr qinq_hdr;
        struct my_arp_t arp;
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 /* Struct used for setting all the values a packet
    going to the core netwerk. Payload may follow
@@ -59,7 +59,7 @@ struct core_net_pkt_m {
        struct gre_hdr gre_hdr;
        prox_rte_ipv4_hdr ip_hdr;
        prox_rte_udp_hdr udp_hdr;
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 struct core_net_pkt {
        prox_rte_ether_hdr ether_hdr;
@@ -67,7 +67,7 @@ struct core_net_pkt {
        struct gre_hdr gre_hdr;
        prox_rte_ipv4_hdr ip_hdr;
        prox_rte_udp_hdr udp_hdr;
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 #define UPSTREAM_DELTA   ((uint32_t)(sizeof(struct core_net_pkt) - sizeof(struct cpe_pkt)))
 #define DOWNSTREAM_DELTA ((uint32_t)(sizeof(struct core_net_pkt_m) - sizeof(struct cpe_pkt)))
@@ -75,7 +75,7 @@ struct core_net_pkt {
 struct cpe_pkt_delta {
        uint8_t encap[DOWNSTREAM_DELTA];
        struct cpe_pkt pkt;
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 static inline void extract_key_cpe(struct rte_mbuf *mbuf, uint64_t* key)
 {
index f516921..55a35c2 100644 (file)
@@ -114,7 +114,7 @@ struct pkt_eth_ipv4 {
        prox_rte_ether_hdr ether_hdr;
        prox_rte_ipv4_hdr  ipv4_hdr;
        prox_rte_udp_hdr  udp_hdr;
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 void task_cgnat_dump_public_hash(struct task_nat *task)
 {
index 470082b..75d0cee 100644 (file)
@@ -57,7 +57,7 @@ struct eth_ip4_udp {
                prox_rte_udp_hdr   udp;
                prox_rte_tcp_hdr   tcp;
        } l4;
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 union pkt_type {
        struct {
index 49ed1b7..a2f1b1f 100644 (file)
@@ -248,13 +248,13 @@ struct qinq_packet {
                prox_rte_ipv4_hdr ipv4_hdr;
                prox_rte_ipv6_hdr ipv6_hdr;
        };
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 struct qinq_packet_data {
        prox_rte_ether_addr  d_addr;
        prox_rte_ether_addr  s_addr;
        uint64_t qinq;
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 struct ether_packet {
        prox_rte_ether_hdr ether_hdr;
@@ -262,7 +262,7 @@ struct ether_packet {
                prox_rte_ipv4_hdr ipv4_hdr;
                prox_rte_ipv6_hdr ipv6_hdr;
        };
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 struct cpe_packet {
        union {
index 4cd2de2..83c9ebc 100644 (file)
@@ -47,7 +47,7 @@ struct task_nat {
 struct pkt_eth_ipv4 {
        prox_rte_ether_hdr ether_hdr;
        prox_rte_ipv4_hdr  ipv4_hdr;
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 static int handle_nat(struct task_nat *task, struct rte_mbuf *mbuf)
 {
index ce6bd9d..83cc73c 100644 (file)
@@ -73,7 +73,7 @@ struct ipv6_tun_binding_entry {
        prox_rte_ether_addr       next_hop_mac;   // mac addr of next hop towards lwB4
        uint32_t                public_ipv4;    // Public IPv4 address
        uint16_t                public_port;    // Public base port (together with port mask, defines the Port Set)
-} __attribute__((__packed__));
+} __attribute__((__packed__)) __attribute__((__aligned__(2)));
 
 struct ipv6_tun_binding_table {
        uint32_t                num_binding_entries;
index 60809f1..b93198d 100644 (file)
@@ -190,7 +190,7 @@ static void set_ip_address(char *devname, uint32_t ip, uint8_t prefix)
        in_addr.sin_family = AF_INET;
        in_addr.sin_addr = *(struct in_addr *)&ip_cpu;
 
-       strncpy(ifreq.ifr_name, devname, IFNAMSIZ);
+       prox_strncpy(ifreq.ifr_name, devname, IFNAMSIZ);
        ifreq.ifr_addr = *(struct sockaddr *)&in_addr;
        rc = ioctl(fd, SIOCSIFADDR, &ifreq);
        PROX_PANIC(rc < 0, "Failed to set IP address %x on device %s: error = %d (%s)\n", ip_cpu, devname, errno, strerror(errno));
index 1d11114..03c89b9 100644 (file)
@@ -36,6 +36,6 @@ struct qinq_hdr {
        struct my_vlan_hdr svlan;
        struct my_vlan_hdr cvlan;
        uint16_t ether_type;
-} __attribute__((packed));
+} __attribute__((packed)) __attribute__((__aligned__(2)));
 
 #endif /* _QINQ_H_ */