[dpdk-dev] [PATCH 05/19] kni: prefer unsigned int to unsigned
Ferruh Yigit
ferruh.yigit at intel.com
Thu Sep 15 17:46:31 CEST 2016
Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
lib/librte_eal/linuxapp/kni/kni_dev.h | 4 ++--
lib/librte_eal/linuxapp/kni/kni_fifo.h | 22 +++++++++++-----------
lib/librte_eal/linuxapp/kni/kni_net.c | 22 +++++++++++-----------
lib/librte_eal/linuxapp/kni/kni_vhost.c | 12 ++++++------
4 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/lib/librte_eal/linuxapp/kni/kni_dev.h b/lib/librte_eal/linuxapp/kni/kni_dev.h
index 059defc..d30d7ab 100644
--- a/lib/librte_eal/linuxapp/kni/kni_dev.h
+++ b/lib/librte_eal/linuxapp/kni/kni_dev.h
@@ -50,7 +50,7 @@ struct kni_dev {
struct net_device_stats stats;
int status;
uint16_t group_id; /* Group ID of a group of KNI devices */
- unsigned core_id; /* Core ID to bind */
+ unsigned int core_id; /* Core ID to bind */
char name[RTE_KNI_NAMESIZE]; /* Network device name */
struct task_struct *pthread;
@@ -91,7 +91,7 @@ struct kni_dev {
void *mbuf_va;
/* mbuf size */
- unsigned mbuf_size;
+ unsigned int mbuf_size;
/* synchro for request processing */
unsigned long synchro;
diff --git a/lib/librte_eal/linuxapp/kni/kni_fifo.h b/lib/librte_eal/linuxapp/kni/kni_fifo.h
index 4006b1f..71bc2a9 100644
--- a/lib/librte_eal/linuxapp/kni/kni_fifo.h
+++ b/lib/librte_eal/linuxapp/kni/kni_fifo.h
@@ -31,12 +31,12 @@
* Adds num elements into the fifo. Return the number actually written
*/
static inline unsigned
-kni_fifo_put(struct rte_kni_fifo *fifo, void **data, unsigned num)
+kni_fifo_put(struct rte_kni_fifo *fifo, void **data, unsigned int num)
{
- unsigned i = 0;
- unsigned fifo_write = fifo->write;
- unsigned fifo_read = fifo->read;
- unsigned new_write = fifo_write;
+ unsigned int i = 0;
+ unsigned int fifo_write = fifo->write;
+ unsigned int fifo_read = fifo->read;
+ unsigned int new_write = fifo_write;
for (i = 0; i < num; i++) {
new_write = (new_write + 1) & (fifo->len - 1);
@@ -55,11 +55,11 @@ kni_fifo_put(struct rte_kni_fifo *fifo, void **data, unsigned num)
* Get up to num elements from the fifo. Return the number actully read
*/
static inline unsigned
-kni_fifo_get(struct rte_kni_fifo *fifo, void **data, unsigned num)
+kni_fifo_get(struct rte_kni_fifo *fifo, void **data, unsigned int num)
{
- unsigned i = 0;
- unsigned new_read = fifo->read;
- unsigned fifo_write = fifo->write;
+ unsigned int i = 0;
+ unsigned int new_read = fifo->read;
+ unsigned int fifo_write = fifo->write;
for (i = 0; i < num; i++) {
if (new_read == fifo_write)
@@ -85,7 +85,7 @@ kni_fifo_count(struct rte_kni_fifo *fifo)
/**
* Get the num of available elements in the fifo
*/
-static inline unsigned
+static inline unsigned int
kni_fifo_free_count(struct rte_kni_fifo *fifo)
{
return (fifo->read - fifo->write - 1) & (fifo->len - 1);
@@ -96,7 +96,7 @@ kni_fifo_free_count(struct rte_kni_fifo *fifo)
* Initializes the kni fifo structure
*/
static inline void
-kni_fifo_init(struct rte_kni_fifo *fifo, unsigned size)
+kni_fifo_init(struct rte_kni_fifo *fifo, unsigned int size)
{
fifo->write = 0;
fifo->read = 0;
diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c
index aa17f2c..f4afd83 100644
--- a/lib/librte_eal/linuxapp/kni/kni_net.c
+++ b/lib/librte_eal/linuxapp/kni/kni_net.c
@@ -121,9 +121,9 @@ kni_net_config(struct net_device *dev, struct ifmap *map)
static void
kni_net_rx_normal(struct kni_dev *kni)
{
- unsigned ret;
+ unsigned int ret;
uint32_t len;
- unsigned i, num_rx, num_fq;
+ unsigned int i, num_rx, num_fq;
struct rte_kni_mbuf *kva;
struct rte_kni_mbuf *va[MBUF_BURST_SZ];
void *data_kva;
@@ -139,7 +139,7 @@ kni_net_rx_normal(struct kni_dev *kni)
}
/* Calculate the number of entries to dequeue from rx_q */
- num_rx = min(num_fq, (unsigned)MBUF_BURST_SZ);
+ num_rx = min(num_fq, (unsigned int)MBUF_BURST_SZ);
/* Burst dequeue from rx_q */
num_rx = kni_fifo_get(kni->rx_q, (void **)va, num_rx);
@@ -209,9 +209,9 @@ kni_net_rx_normal(struct kni_dev *kni)
static void
kni_net_rx_lo_fifo(struct kni_dev *kni)
{
- unsigned ret;
+ unsigned int ret;
uint32_t len;
- unsigned i, num, num_rq, num_tq, num_aq, num_fq;
+ unsigned int i, num, num_rq, num_tq, num_aq, num_fq;
struct rte_kni_mbuf *kva;
struct rte_kni_mbuf *va[MBUF_BURST_SZ];
void *data_kva;
@@ -236,7 +236,7 @@ kni_net_rx_lo_fifo(struct kni_dev *kni)
num = min(num_rq, num_tq);
num = min(num, num_aq);
num = min(num, num_fq);
- num = min(num, (unsigned)MBUF_BURST_SZ);
+ num = min(num, (unsigned int)MBUF_BURST_SZ);
/* Return if no entry to dequeue from rx_q */
if (num == 0)
@@ -298,9 +298,9 @@ kni_net_rx_lo_fifo(struct kni_dev *kni)
static void
kni_net_rx_lo_fifo_skb(struct kni_dev *kni)
{
- unsigned ret;
+ unsigned int ret;
uint32_t len;
- unsigned i, num_rq, num_fq, num;
+ unsigned int i, num_rq, num_fq, num;
struct rte_kni_mbuf *kva;
struct rte_kni_mbuf *va[MBUF_BURST_SZ];
void *data_kva;
@@ -316,7 +316,7 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni)
/* Calculate the number of entries to dequeue from rx_q */
num = min(num_rq, num_fq);
- num = min(num, (unsigned)MBUF_BURST_SZ);
+ num = min(num, (unsigned int)MBUF_BURST_SZ);
/* Return if no entry to dequeue from rx_q */
if (num == 0)
@@ -423,7 +423,7 @@ static int
kni_net_tx(struct sk_buff *skb, struct net_device *dev)
{
int len = 0;
- unsigned ret;
+ unsigned int ret;
struct kni_dev *kni = netdev_priv(dev);
struct rte_kni_mbuf *pkt_kva = NULL;
struct rte_kni_mbuf *pkt_va = NULL;
@@ -569,7 +569,7 @@ kni_net_process_request(struct kni_dev *kni, struct rte_kni_request *req)
{
int ret = -1;
void *resp_va;
- unsigned num;
+ unsigned int num;
int ret_val;
if (!kni || !req) {
diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index b4d91ca..f1345c3 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -69,7 +69,7 @@ static struct proto kni_raw_proto = {
static inline int
kni_vhost_net_tx(struct kni_dev *kni, struct msghdr *m,
- unsigned offset, unsigned len)
+ unsigned int offset, unsigned int len)
{
struct rte_kni_mbuf *pkt_kva = NULL;
struct rte_kni_mbuf *pkt_va = NULL;
@@ -145,7 +145,7 @@ drop:
static inline int
kni_vhost_net_rx(struct kni_dev *kni, struct msghdr *m,
- unsigned offset, unsigned len)
+ unsigned int offset, unsigned int len)
{
uint32_t pkt_len;
struct rte_kni_mbuf *kva;
@@ -280,9 +280,9 @@ int
kni_chk_vhost_rx(struct kni_dev *kni)
{
struct kni_vhost_queue *q = kni->vhost_queue;
- unsigned nb_in, nb_mbuf, nb_skb;
- const unsigned BURST_MASK = RX_BURST_SZ - 1;
- unsigned nb_burst, nb_backlog, i;
+ unsigned int nb_in, nb_mbuf, nb_skb;
+ const unsigned int BURST_MASK = RX_BURST_SZ - 1;
+ unsigned int nb_burst, nb_backlog, i;
struct sk_buff *skb[RX_BURST_SZ];
struct rte_kni_mbuf *va[RX_BURST_SZ];
@@ -298,7 +298,7 @@ kni_chk_vhost_rx(struct kni_dev *kni)
nb_mbuf = kni_fifo_count(kni->rx_q);
nb_in = min(nb_mbuf, nb_skb);
- nb_in = min(nb_in, (unsigned)RX_BURST_SZ);
+ nb_in = min(nb_in, (unsigned int)RX_BURST_SZ);
nb_burst = (nb_in & ~BURST_MASK);
nb_backlog = (nb_in & BURST_MASK);
--
2.7.4
More information about the dev
mailing list