Skip to contentSkip to conversation

enicpmd: replace the type u_int* with uint* to remove compilation errors on a few platforms

PATCH Superseded Sujith Sankar 2 participants 3 messages Nov 28, 2014 2 messages not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 enicpmd: replace the type u_int* with uint* to remove compilation errors on a few platforms

ENIC PMD was giving compilation errors on ppc_64-power8-linuxapp-gcc because of types such as u_int32_t. This patch replaces all those with uint32_t and similar ones.

---
 lib/librte_pmd_enic/enic.h             |  2 +-
 lib/librte_pmd_enic/enic_compat.h      | 16 ++++++++--------
 lib/librte_pmd_enic/enic_main.c        | 18 +++++++++---------
 lib/librte_pmd_enic/vnic/vnic_devcmd.h |  6 +++---
 4 files changed, 21 insertions(+), 21 deletions(-)
lib/librte_pmd_enic/enic.h +1 -1
index 9f80fc0..6400d24 100644
@@ -106,7 +106,7 @@ struct enic {
 	int iommu_group_fd;
 	int iommu_groupid;
 	int eventfd;
-	u_int8_t mac_addr[ETH_ALEN];
+	uint8_t mac_addr[ETH_ALEN];
 	pthread_t err_intr_thread;
 	int promisc;
 	int allmulti;
lib/librte_pmd_enic/enic_compat.h +8 -8
index d22578e..7c62bf2 100644
@@ -89,9 +89,9 @@ typedef		unsigned int        u32;
 typedef         unsigned long long  u64;
 typedef         unsigned long long  dma_addr_t;
 
-static inline u_int32_t ioread32(volatile void *addr)
+static inline uint32_t ioread32(volatile void *addr)
 {
-	return *(volatile u_int32_t *)addr;
+	return *(volatile uint32_t *)addr;
 }
 
 static inline u16 ioread16(volatile void *addr)
@@ -99,14 +99,14 @@ static inline u16 ioread16(volatile void *addr)
 	return *(volatile u16 *)addr;
 }
 
-static inline u_int8_t ioread8(volatile void *addr)
+static inline uint8_t ioread8(volatile void *addr)
 {
-	return *(volatile u_int8_t *)addr;
+	return *(volatile uint8_t *)addr;
 }
 
-static inline void iowrite32(u_int32_t val, volatile void *addr)
+static inline void iowrite32(uint32_t val, volatile void *addr)
 {
-	*(volatile u_int32_t *)addr = val;
+	*(volatile uint32_t *)addr = val;
 }
 
 static inline void iowrite16(u16 val, volatile void *addr)
@@ -114,9 +114,9 @@ static inline void iowrite16(u16 val, volatile void *addr)
 	*(volatile u16 *)addr = val;
 }
 
-static inline void iowrite8(u_int8_t val, volatile void *addr)
+static inline void iowrite8(uint8_t val, volatile void *addr)
 {
-	*(volatile u_int8_t *)addr = val;
+	*(volatile uint8_t *)addr = val;
 }
 
 static inline unsigned int readl(volatile void __iomem *addr)
lib/librte_pmd_enic/enic_main.c +9 -9
index f6f00d3..853dd04 100644
@@ -172,17 +172,17 @@ unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq)
 
 int enic_send_pkt(struct enic *enic, struct vnic_wq *wq,
 	struct rte_mbuf *tx_pkt, unsigned short len,
-	u_int8_t sop, u_int8_t eop,
-	u_int16_t ol_flags, u_int16_t vlan_tag)
+	uint8_t sop, uint8_t eop,
+	uint16_t ol_flags, uint16_t vlan_tag)
 {
 	struct wq_enet_desc *desc = vnic_wq_next_desc(wq);
-	u_int16_t mss = 0;
-	u_int16_t header_length = 0;
-	u_int8_t cq_entry = eop;
-	u_int8_t vlan_tag_insert = 0;
+	uint16_t mss = 0;
+	uint16_t header_length = 0;
+	uint8_t cq_entry = eop;
+	uint8_t vlan_tag_insert = 0;
 	unsigned char *buf = (unsigned char *)(tx_pkt->buf_addr) +
 	    RTE_PKTMBUF_HEADROOM;
-	u_int64_t bus_addr = (dma_addr_t)
+	uint64_t bus_addr = (dma_addr_t)
 	    (tx_pkt->buf_physaddr + RTE_PKTMBUF_HEADROOM);
 
 	if (sop) {
@@ -342,8 +342,8 @@ static int enic_rq_alloc_buf(struct vnic_rq *rq)
 	void *buf;
 	dma_addr_t dma_addr;
 	struct rq_enet_desc *desc = vnic_rq_next_desc(rq);
-	u_int8_t type = RQ_ENET_TYPE_ONLY_SOP;
-	u_int16_t len = ENIC_MAX_MTU + VLAN_ETH_HLEN;
+	uint8_t type = RQ_ENET_TYPE_ONLY_SOP;
+	uint16_t len = ENIC_MAX_MTU + VLAN_ETH_HLEN;
 	u16 split_hdr_size = vnic_get_hdr_split_size(enic->vdev);
 	struct rte_mbuf *mbuf = enic_rxmbuf_alloc(rq->mp);
 	struct rte_mbuf *hdr_mbuf = NULL;
lib/librte_pmd_enic/vnic/vnic_devcmd.h +3 -3
index b4c87c1..e7ecf31 100644
@@ -691,9 +691,9 @@ enum {
 #define FILTER_MAX_BUF_SIZE 100  /* Maximum size of buffer to CMD_ADD_FILTER */
 
 struct filter_tlv {
-	u_int32_t type;
-	u_int32_t length;
-	u_int32_t val[0];
+	uint32_t type;
+	uint32_t length;
+	uint32_t val[0];
 };
 
 enum {
Signature · 1 line
1.9.1

A message that is not in the archive (sent off-list or not yet received): 1417158120-29434-1-git-send-email-ssujith-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org

#2 lore raw

Hello Sujith,

Why keep those u8, u16, u32 etc... ?
Especially, you can see in this patch that the ioread16 uses u16, while ioread8, ioread32 uses uint*.
I like consistency and "standard" types (unless there is a reason why we use different types).

Anyway, this patch builds fine on ppc.

Signature · 1 line
David Marchand
Quoted 142 lines · Sujith Sankar

ENIC PMD was giving compilation errors on ppc_64-power8-linuxapp-gcc because
of types such as u_int32_t. This patch replaces all those with uint32_t and
similar ones.

---
 lib/librte_pmd_enic/enic.h             |  2 +-
 lib/librte_pmd_enic/enic_compat.h      | 16 ++++++++--------
 lib/librte_pmd_enic/enic_main.c        | 18 +++++++++---------
 lib/librte_pmd_enic/vnic/vnic_devcmd.h |  6 +++---
 4 files changed, 21 insertions(+), 21 deletions(-)
lib/librte_pmd_enic/enic.h +1 -1
index 9f80fc0..6400d24 100644
@@ -106,7 +106,7 @@ struct enic {
        int iommu_group_fd;
        int iommu_groupid;
        int eventfd;
-       u_int8_t mac_addr[ETH_ALEN];
+       uint8_t mac_addr[ETH_ALEN];
        pthread_t err_intr_thread;
        int promisc;
        int allmulti;
lib/librte_pmd_enic/enic_compat.h +8 -8
index d22578e..7c62bf2 100644
@@ -89,9 +89,9 @@ typedef               unsigned int        u32;
 typedef         unsigned long long  u64;
 typedef         unsigned long long  dma_addr_t;
 
-static inline u_int32_t ioread32(volatile void *addr)
+static inline uint32_t ioread32(volatile void *addr)
 {
-       return *(volatile u_int32_t *)addr;
+       return *(volatile uint32_t *)addr;
 }
 
 static inline u16 ioread16(volatile void *addr)
@@ -99,14 +99,14 @@ static inline u16 ioread16(volatile void *addr)
        return *(volatile u16 *)addr;
 }
 
-static inline u_int8_t ioread8(volatile void *addr)
+static inline uint8_t ioread8(volatile void *addr)
 {
-       return *(volatile u_int8_t *)addr;
+       return *(volatile uint8_t *)addr;
 }
 
-static inline void iowrite32(u_int32_t val, volatile void *addr)
+static inline void iowrite32(uint32_t val, volatile void *addr)
 {
-       *(volatile u_int32_t *)addr = val;
+       *(volatile uint32_t *)addr = val;
 }
 
 static inline void iowrite16(u16 val, volatile void *addr)
@@ -114,9 +114,9 @@ static inline void iowrite16(u16 val, volatile void
 *addr)
        *(volatile u16 *)addr = val;
 }
 
-static inline void iowrite8(u_int8_t val, volatile void *addr)
+static inline void iowrite8(uint8_t val, volatile void *addr)
 {
-       *(volatile u_int8_t *)addr = val;
+       *(volatile uint8_t *)addr = val;
 }
 

static inline unsigned int readl(volatile void __iomem *addr)

lib/librte_pmd_enic/enic_main.c +7 -7
index f6f00d3..853dd04 100644
@@ -172,17 +172,17 @@ unsigned int enic_cleanup_wq(struct enic *enic,
 struct vnic_wq *wq)
 
 int enic_send_pkt(struct enic *enic, struct vnic_wq *wq,
        struct rte_mbuf *tx_pkt, unsigned short len,
-       u_int8_t sop, u_int8_t eop,
-       u_int16_t ol_flags, u_int16_t vlan_tag)
+       uint8_t sop, uint8_t eop,
+       uint16_t ol_flags, uint16_t vlan_tag)
 {
        struct wq_enet_desc *desc = vnic_wq_next_desc(wq);
-       u_int16_t mss = 0;
-       u_int16_t header_length = 0;
-       u_int8_t cq_entry = eop;
-       u_int8_t vlan_tag_insert = 0;
+       uint16_t mss = 0;
+       uint16_t header_length = 0;
+       uint8_t cq_entry = eop;
+       uint8_t vlan_tag_insert = 0;
        unsigned char *buf = (unsigned char *)(tx_pkt->buf_addr) +
            RTE_PKTMBUF_HEADROOM;
-       u_int64_t bus_addr = (dma_addr_t)
+       uint64_t bus_addr = (dma_addr_t)
            (tx_pkt->buf_physaddr + RTE_PKTMBUF_HEADROOM);
 
        if (sop) {
lib/librte_pmd_enic/enic_main.c +2 -2
@@ -342,8 +342,8 @@ static int enic_rq_alloc_buf(struct vnic_rq *rq)
        void *buf;
        dma_addr_t dma_addr;
        struct rq_enet_desc *desc = vnic_rq_next_desc(rq);
-       u_int8_t type = RQ_ENET_TYPE_ONLY_SOP;
-       u_int16_t len = ENIC_MAX_MTU + VLAN_ETH_HLEN;
+       uint8_t type = RQ_ENET_TYPE_ONLY_SOP;
+       uint16_t len = ENIC_MAX_MTU + VLAN_ETH_HLEN;
        u16 split_hdr_size = vnic_get_hdr_split_size(enic->vdev);
        struct rte_mbuf *mbuf = enic_rxmbuf_alloc(rq->mp);
        struct rte_mbuf *hdr_mbuf = NULL;
lib/librte_pmd_enic/vnic/vnic_devcmd.h +0 -0
index b4c87c1..e7ecf31 100644
@@ -691,9 +691,9 @@ enum {
 #define FILTER_MAX_BUF_SIZE 100  /* Maximum size of buffer to

CMD_ADD_FILTER */

struct filter_tlv {

lib/librte_pmd_enic/vnic/vnic_devcmd.h +3 -4
-       u_int32_t type;
-       u_int32_t length;
-       u_int32_t val[0];
+       uint32_t type;
+       uint32_t length;
+       uint32_t val[0];
 };
 
 enum {
--

1.9.1

A message that is not in the archive (sent off-list or not yet received): CALwxeUsObyGCO_AW_fJkaSi+n1M4_5O3RQEuL+RX8xHZcVogCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

Hi David,

The u8, u16, etc are there because enicpmd shares a lot of code with kernel mode driver and these are used at a lot of places. I agree with you on bringing in consistency. Let me change ioread16 with uint16 and upload a new patch.

Hope this is ok with you.

Thanks,
-Sujith

From: David Marchand <[email protected]<mailto:[email protected]>>
Date: Friday, 28 November 2014 2:18 pm
To: "Sujith Sankar (ssujith)" <[email protected]<mailto:[email protected]>>
Cc: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
Subject: Re: [dpdk-dev] [PATCH] enicpmd: replace the type u_int* with uint* to remove compilation errors on a few platforms

Hello Sujith,

Why keep those u8, u16, u32 etc... ?
Especially, you can see in this patch that the ioread16 uses u16, while ioread8, ioread32 uses uint*. I like consistency and "standard" types (unless there is a reason why we use different types).

Anyway, this patch builds fine on ppc.

--
David Marchand

On Fri, Nov 28, 2014 at 8:02 AM, Sujith Sankar <[email protected]<mailto:[email protected]>> wrote:
ENIC PMD was giving compilation errors on ppc_64-power8-linuxapp-gcc because
of types such as u_int32_t. This patch replaces all those with uint32_t and
similar ones.

---
 lib/librte_pmd_enic/enic.h             |  2 +-
 lib/librte_pmd_enic/enic_compat.h      | 16 ++++++++--------
 lib/librte_pmd_enic/enic_main.c        | 18 +++++++++---------
 lib/librte_pmd_enic/vnic/vnic_devcmd.h |  6 +++---
 4 files changed, 21 insertions(+), 21 deletions(-)
lib/librte_pmd_enic/enic.h +1 -1
index 9f80fc0..6400d24 100644
@@ -106,7 +106,7 @@ struct enic {
        int iommu_group_fd;
        int iommu_groupid;
        int eventfd;
-       u_int8_t mac_addr[ETH_ALEN];
+       uint8_t mac_addr[ETH_ALEN];
        pthread_t err_intr_thread;
        int promisc;
        int allmulti;
lib/librte_pmd_enic/enic_compat.h +8 -8
index d22578e..7c62bf2 100644
@@ -89,9 +89,9 @@ typedef               unsigned int        u32;
 typedef         unsigned long long  u64;
 typedef         unsigned long long  dma_addr_t;
 
-static inline u_int32_t ioread32(volatile void *addr)
+static inline uint32_t ioread32(volatile void *addr)
 {
-       return *(volatile u_int32_t *)addr;
+       return *(volatile uint32_t *)addr;
 }
 
 static inline u16 ioread16(volatile void *addr)
@@ -99,14 +99,14 @@ static inline u16 ioread16(volatile void *addr)
        return *(volatile u16 *)addr;
 }
 
-static inline u_int8_t ioread8(volatile void *addr)
+static inline uint8_t ioread8(volatile void *addr)
 {
-       return *(volatile u_int8_t *)addr;
+       return *(volatile uint8_t *)addr;
 }
 
-static inline void iowrite32(u_int32_t val, volatile void *addr)
+static inline void iowrite32(uint32_t val, volatile void *addr)
 {
-       *(volatile u_int32_t *)addr = val;
+       *(volatile uint32_t *)addr = val;
 }
 
 static inline void iowrite16(u16 val, volatile void *addr)
@@ -114,9 +114,9 @@ static inline void iowrite16(u16 val, volatile void *addr)
        *(volatile u16 *)addr = val;
 }
 
-static inline void iowrite8(u_int8_t val, volatile void *addr)
+static inline void iowrite8(uint8_t val, volatile void *addr)
 {
-       *(volatile u_int8_t *)addr = val;
+       *(volatile uint8_t *)addr = val;
 }
 
 static inline unsigned int readl(volatile void __iomem *addr)
lib/librte_pmd_enic/enic_main.c +9 -9
index f6f00d3..853dd04 100644
@@ -172,17 +172,17 @@ unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq)
 
 int enic_send_pkt(struct enic *enic, struct vnic_wq *wq,
        struct rte_mbuf *tx_pkt, unsigned short len,
-       u_int8_t sop, u_int8_t eop,
-       u_int16_t ol_flags, u_int16_t vlan_tag)
+       uint8_t sop, uint8_t eop,
+       uint16_t ol_flags, uint16_t vlan_tag)
 {
        struct wq_enet_desc *desc = vnic_wq_next_desc(wq);
-       u_int16_t mss = 0;
-       u_int16_t header_length = 0;
-       u_int8_t cq_entry = eop;
-       u_int8_t vlan_tag_insert = 0;
+       uint16_t mss = 0;
+       uint16_t header_length = 0;
+       uint8_t cq_entry = eop;
+       uint8_t vlan_tag_insert = 0;
        unsigned char *buf = (unsigned char *)(tx_pkt->buf_addr) +
            RTE_PKTMBUF_HEADROOM;
-       u_int64_t bus_addr = (dma_addr_t)
+       uint64_t bus_addr = (dma_addr_t)
            (tx_pkt->buf_physaddr + RTE_PKTMBUF_HEADROOM);
 
        if (sop) {
@@ -342,8 +342,8 @@ static int enic_rq_alloc_buf(struct vnic_rq *rq)
        void *buf;
        dma_addr_t dma_addr;
        struct rq_enet_desc *desc = vnic_rq_next_desc(rq);
-       u_int8_t type = RQ_ENET_TYPE_ONLY_SOP;
-       u_int16_t len = ENIC_MAX_MTU + VLAN_ETH_HLEN;
+       uint8_t type = RQ_ENET_TYPE_ONLY_SOP;
+       uint16_t len = ENIC_MAX_MTU + VLAN_ETH_HLEN;
        u16 split_hdr_size = vnic_get_hdr_split_size(enic->vdev);
        struct rte_mbuf *mbuf = enic_rxmbuf_alloc(rq->mp);
        struct rte_mbuf *hdr_mbuf = NULL;
lib/librte_pmd_enic/vnic/vnic_devcmd.h +3 -3
index b4c87c1..e7ecf31 100644
@@ -691,9 +691,9 @@ enum {
 #define FILTER_MAX_BUF_SIZE 100  /* Maximum size of buffer to CMD_ADD_FILTER */
 
 struct filter_tlv {
-       u_int32_t type;
-       u_int32_t length;
-       u_int32_t val[0];
+       uint32_t type;
+       uint32_t length;
+       uint32_t val[0];
 };
 
 enum {

--
1.9.1