mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
rocker: do not pollute the namespace
Do not leave the __le* macros defined, in fact do not use them at all. Fixes a build failure on Alpine with the TDX patches: In file included from ../hw/net/rocker/rocker_of_dpa.c:25: ../hw/net/rocker/rocker_hw.h:14:16: error: conflicting types for 'uint64_t'; have '__u64' {aka 'long long unsigned int'} 14 | #define __le64 uint64_t | ^~~~~~~~ In file included from /usr/include/stdint.h:20, from ../include/qemu/osdep.h:111, from ../hw/net/rocker/rocker_of_dpa.c:17: /usr/include/bits/alltypes.h:136:25: note: previous declaration of 'uint64_t' with type 'uint64_t' {aka 'long unsigned int'} 136 | typedef unsigned _Int64 uint64_t; | ^~~~~~~~ because the Linux headers include a typedef of __leNN. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
341ed3eae4
commit
5150004ccf
3 changed files with 31 additions and 43 deletions
|
@ -36,15 +36,7 @@ static inline G_GNUC_PRINTF(1, 2) int DPRINTF(const char *fmt, ...)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define __le16 uint16_t
|
static inline bool ipv4_addr_is_multicast(uint32_t addr)
|
||||||
#define __le32 uint32_t
|
|
||||||
#define __le64 uint64_t
|
|
||||||
|
|
||||||
#define __be16 uint16_t
|
|
||||||
#define __be32 uint32_t
|
|
||||||
#define __be64 uint64_t
|
|
||||||
|
|
||||||
static inline bool ipv4_addr_is_multicast(__be32 addr)
|
|
||||||
{
|
{
|
||||||
return (addr & htonl(0xf0000000)) == htonl(0xe0000000);
|
return (addr & htonl(0xf0000000)) == htonl(0xe0000000);
|
||||||
}
|
}
|
||||||
|
@ -52,8 +44,8 @@ static inline bool ipv4_addr_is_multicast(__be32 addr)
|
||||||
typedef struct ipv6_addr {
|
typedef struct ipv6_addr {
|
||||||
union {
|
union {
|
||||||
uint8_t addr8[16];
|
uint8_t addr8[16];
|
||||||
__be16 addr16[8];
|
uint16_t addr16[8];
|
||||||
__be32 addr32[4];
|
uint32_t addr32[4];
|
||||||
};
|
};
|
||||||
} Ipv6Addr;
|
} Ipv6Addr;
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,6 @@
|
||||||
#ifndef ROCKER_HW_H
|
#ifndef ROCKER_HW_H
|
||||||
#define ROCKER_HW_H
|
#define ROCKER_HW_H
|
||||||
|
|
||||||
#define __le16 uint16_t
|
|
||||||
#define __le32 uint32_t
|
|
||||||
#define __le64 uint64_t
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return codes
|
* Return codes
|
||||||
*/
|
*/
|
||||||
|
@ -124,12 +120,12 @@ enum {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct rocker_desc {
|
typedef struct rocker_desc {
|
||||||
__le64 buf_addr;
|
uint64_t buf_addr;
|
||||||
uint64_t cookie;
|
uint64_t cookie;
|
||||||
__le16 buf_size;
|
uint16_t buf_size;
|
||||||
__le16 tlv_size;
|
uint16_t tlv_size;
|
||||||
__le16 rsvd[5]; /* pad to 32 bytes */
|
uint16_t rsvd[5]; /* pad to 32 bytes */
|
||||||
__le16 comp_err;
|
uint16_t comp_err;
|
||||||
} __attribute__((packed, aligned(8))) RockerDesc;
|
} __attribute__((packed, aligned(8))) RockerDesc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -137,9 +133,9 @@ typedef struct rocker_desc {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct rocker_tlv {
|
typedef struct rocker_tlv {
|
||||||
__le32 type;
|
uint32_t type;
|
||||||
__le16 len;
|
uint16_t len;
|
||||||
__le16 rsvd;
|
uint16_t rsvd;
|
||||||
} __attribute__((packed, aligned(8))) RockerTlv;
|
} __attribute__((packed, aligned(8))) RockerTlv;
|
||||||
|
|
||||||
/* cmd msg */
|
/* cmd msg */
|
||||||
|
|
|
@ -52,10 +52,10 @@ typedef struct of_dpa_flow_key {
|
||||||
uint32_t tunnel_id; /* overlay tunnel id */
|
uint32_t tunnel_id; /* overlay tunnel id */
|
||||||
uint32_t tbl_id; /* table id */
|
uint32_t tbl_id; /* table id */
|
||||||
struct {
|
struct {
|
||||||
__be16 vlan_id; /* 0 if no VLAN */
|
uint16_t vlan_id; /* 0 if no VLAN */
|
||||||
MACAddr src; /* ethernet source address */
|
MACAddr src; /* ethernet source address */
|
||||||
MACAddr dst; /* ethernet destination address */
|
MACAddr dst; /* ethernet destination address */
|
||||||
__be16 type; /* ethernet frame type */
|
uint16_t type; /* ethernet frame type */
|
||||||
} eth;
|
} eth;
|
||||||
struct {
|
struct {
|
||||||
uint8_t proto; /* IP protocol or ARP opcode */
|
uint8_t proto; /* IP protocol or ARP opcode */
|
||||||
|
@ -66,14 +66,14 @@ typedef struct of_dpa_flow_key {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
struct {
|
struct {
|
||||||
__be32 src; /* IP source address */
|
uint32_t src; /* IP source address */
|
||||||
__be32 dst; /* IP destination address */
|
uint32_t dst; /* IP destination address */
|
||||||
} addr;
|
} addr;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
__be16 src; /* TCP/UDP/SCTP source port */
|
uint16_t src; /* TCP/UDP/SCTP source port */
|
||||||
__be16 dst; /* TCP/UDP/SCTP destination port */
|
uint16_t dst; /* TCP/UDP/SCTP destination port */
|
||||||
__be16 flags; /* TCP flags */
|
uint16_t flags; /* TCP flags */
|
||||||
} tp;
|
} tp;
|
||||||
struct {
|
struct {
|
||||||
MACAddr sha; /* ARP source hardware address */
|
MACAddr sha; /* ARP source hardware address */
|
||||||
|
@ -86,11 +86,11 @@ typedef struct of_dpa_flow_key {
|
||||||
Ipv6Addr src; /* IPv6 source address */
|
Ipv6Addr src; /* IPv6 source address */
|
||||||
Ipv6Addr dst; /* IPv6 destination address */
|
Ipv6Addr dst; /* IPv6 destination address */
|
||||||
} addr;
|
} addr;
|
||||||
__be32 label; /* IPv6 flow label */
|
uint32_t label; /* IPv6 flow label */
|
||||||
struct {
|
struct {
|
||||||
__be16 src; /* TCP/UDP/SCTP source port */
|
uint16_t src; /* TCP/UDP/SCTP source port */
|
||||||
__be16 dst; /* TCP/UDP/SCTP destination port */
|
uint16_t dst; /* TCP/UDP/SCTP destination port */
|
||||||
__be16 flags; /* TCP flags */
|
uint16_t flags; /* TCP flags */
|
||||||
} tp;
|
} tp;
|
||||||
struct {
|
struct {
|
||||||
Ipv6Addr target; /* ND target address */
|
Ipv6Addr target; /* ND target address */
|
||||||
|
@ -112,13 +112,13 @@ typedef struct of_dpa_flow_action {
|
||||||
struct {
|
struct {
|
||||||
uint32_t group_id;
|
uint32_t group_id;
|
||||||
uint32_t tun_log_lport;
|
uint32_t tun_log_lport;
|
||||||
__be16 vlan_id;
|
uint16_t vlan_id;
|
||||||
} write;
|
} write;
|
||||||
struct {
|
struct {
|
||||||
__be16 new_vlan_id;
|
uint16_t new_vlan_id;
|
||||||
uint32_t out_pport;
|
uint32_t out_pport;
|
||||||
uint8_t copy_to_cpu;
|
uint8_t copy_to_cpu;
|
||||||
__be16 vlan_id;
|
uint16_t vlan_id;
|
||||||
} apply;
|
} apply;
|
||||||
} OfDpaFlowAction;
|
} OfDpaFlowAction;
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ typedef struct of_dpa_flow {
|
||||||
typedef struct of_dpa_flow_pkt_fields {
|
typedef struct of_dpa_flow_pkt_fields {
|
||||||
uint32_t tunnel_id;
|
uint32_t tunnel_id;
|
||||||
struct eth_header *ethhdr;
|
struct eth_header *ethhdr;
|
||||||
__be16 *h_proto;
|
uint16_t *h_proto;
|
||||||
struct vlan_header *vlanhdr;
|
struct vlan_header *vlanhdr;
|
||||||
struct ip_header *ipv4hdr;
|
struct ip_header *ipv4hdr;
|
||||||
struct ip6_header *ipv6hdr;
|
struct ip6_header *ipv6hdr;
|
||||||
|
@ -180,7 +180,7 @@ typedef struct of_dpa_group {
|
||||||
uint32_t group_id;
|
uint32_t group_id;
|
||||||
MACAddr src_mac;
|
MACAddr src_mac;
|
||||||
MACAddr dst_mac;
|
MACAddr dst_mac;
|
||||||
__be16 vlan_id;
|
uint16_t vlan_id;
|
||||||
} l2_rewrite;
|
} l2_rewrite;
|
||||||
struct {
|
struct {
|
||||||
uint16_t group_count;
|
uint16_t group_count;
|
||||||
|
@ -190,13 +190,13 @@ typedef struct of_dpa_group {
|
||||||
uint32_t group_id;
|
uint32_t group_id;
|
||||||
MACAddr src_mac;
|
MACAddr src_mac;
|
||||||
MACAddr dst_mac;
|
MACAddr dst_mac;
|
||||||
__be16 vlan_id;
|
uint16_t vlan_id;
|
||||||
uint8_t ttl_check;
|
uint8_t ttl_check;
|
||||||
} l3_unicast;
|
} l3_unicast;
|
||||||
};
|
};
|
||||||
} OfDpaGroup;
|
} OfDpaGroup;
|
||||||
|
|
||||||
static int of_dpa_mask2prefix(__be32 mask)
|
static int of_dpa_mask2prefix(uint32_t mask)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int count = 32;
|
int count = 32;
|
||||||
|
@ -451,7 +451,7 @@ static void of_dpa_flow_pkt_parse(OfDpaFlowContext *fc,
|
||||||
fc->iovcnt = iovcnt + 2;
|
fc->iovcnt = iovcnt + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void of_dpa_flow_pkt_insert_vlan(OfDpaFlowContext *fc, __be16 vlan_id)
|
static void of_dpa_flow_pkt_insert_vlan(OfDpaFlowContext *fc, uint16_t vlan_id)
|
||||||
{
|
{
|
||||||
OfDpaFlowPktFields *fields = &fc->fields;
|
OfDpaFlowPktFields *fields = &fc->fields;
|
||||||
uint16_t h_proto = fields->ethhdr->h_proto;
|
uint16_t h_proto = fields->ethhdr->h_proto;
|
||||||
|
@ -486,7 +486,7 @@ static void of_dpa_flow_pkt_strip_vlan(OfDpaFlowContext *fc)
|
||||||
|
|
||||||
static void of_dpa_flow_pkt_hdr_rewrite(OfDpaFlowContext *fc,
|
static void of_dpa_flow_pkt_hdr_rewrite(OfDpaFlowContext *fc,
|
||||||
uint8_t *src_mac, uint8_t *dst_mac,
|
uint8_t *src_mac, uint8_t *dst_mac,
|
||||||
__be16 vlan_id)
|
uint16_t vlan_id)
|
||||||
{
|
{
|
||||||
OfDpaFlowPktFields *fields = &fc->fields;
|
OfDpaFlowPktFields *fields = &fc->fields;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue