summaryrefslogtreecommitdiff
path: root/lib/netdev-dpdk.c
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2015-05-18 08:49:24 -0700
committerEthan Jackson <ethan@nicira.com>2015-05-19 14:47:00 -0700
commitbce01e3a89ac4b05d9e81408aa57717f2776f0be (patch)
treed96c308ac9eba1f7d6328639e1d3c4ffb13a951a /lib/netdev-dpdk.c
parentfa7de3220ce79ffe293d84cc9c98b1a88980273b (diff)
downloadopenvswitch-bce01e3a89ac4b05d9e81408aa57717f2776f0be.tar.gz
netdev-dpdk: Fix sparse warnings.
These are all minor style issues. Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
Diffstat (limited to 'lib/netdev-dpdk.c')
-rw-r--r--lib/netdev-dpdk.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 505ab751e..5f8c60f26 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -102,7 +102,7 @@ BUILD_ASSERT_DECL((MAX_NB_MBUF / ROUND_DOWN_POW2(MAX_NB_MBUF/MIN_NB_MBUF))
#define MAX_PKT_BURST 32 /* Max burst size for RX/TX */
/* Character device cuse_dev_name. */
-char *cuse_dev_name = NULL;
+static char *cuse_dev_name = NULL;
/*
* Maximum amount of time in micro seconds to try and enqueue to vhost.
@@ -173,7 +173,7 @@ static struct ovs_list dpdk_mp_list OVS_GUARDED_BY(dpdk_mutex)
/* This mutex must be used by non pmd threads when allocating or freeing
* mbufs through mempools. Since dpdk_queue_pkts() and dpdk_queue_flush() may
* use mempools, a non pmd thread should hold this mutex while calling them */
-struct ovs_mutex nonpmd_mempool_mutex = OVS_MUTEX_INITIALIZER;
+static struct ovs_mutex nonpmd_mempool_mutex = OVS_MUTEX_INITIALIZER;
struct dpdk_mp {
struct rte_mempool *mp;
@@ -589,7 +589,7 @@ dpdk_dev_parse_name(const char dev_name[], const char prefix[],
}
cport = dev_name + strlen(prefix);
- *port_no = strtol(cport, 0, 0); /* string must be null terminated */
+ *port_no = strtol(cport, NULL, 0); /* string must be null terminated */
return 0;
}
@@ -1004,8 +1004,14 @@ dpdk_do_tx_copy(struct netdev *netdev, int qid, struct dp_packet **pkts,
int cnt)
OVS_NO_THREAD_SAFETY_ANALYSIS
{
+#if !defined(__CHECKER__) && !defined(_WIN32)
+ const size_t PKT_ARRAY_SIZE = cnt;
+#else
+ /* Sparse or MSVC doesn't like variable length array. */
+ enum { PKT_ARRAY_SIZE = NETDEV_MAX_RX_BATCH };
+#endif
struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
- struct rte_mbuf *mbufs[cnt];
+ struct rte_mbuf *mbufs[PKT_ARRAY_SIZE];
int dropped = 0;
int newcnt = 0;
int i;
@@ -1650,7 +1656,7 @@ netdev_dpdk_get_virtio(const struct netdev_dpdk *dev)
* These callbacks allow virtio-net devices to be added to vhost ports when
* configuration has been fully complete.
*/
-const struct virtio_net_device_ops virtio_net_device_ops =
+static const struct virtio_net_device_ops virtio_net_device_ops =
{
.new_device = new_device,
.destroy_device = destroy_device,
@@ -1957,7 +1963,7 @@ dpdk_init(int argc, char **argv)
return result + 1 + base;
}
-const struct netdev_class dpdk_class =
+static const struct netdev_class dpdk_class =
NETDEV_DPDK_CLASS(
"dpdk",
NULL,
@@ -1971,7 +1977,7 @@ const struct netdev_class dpdk_class =
netdev_dpdk_get_status,
netdev_dpdk_rxq_recv);
-const struct netdev_class dpdk_ring_class =
+static const struct netdev_class dpdk_ring_class =
NETDEV_DPDK_CLASS(
"dpdkr",
NULL,
@@ -1985,7 +1991,7 @@ const struct netdev_class dpdk_ring_class =
netdev_dpdk_get_status,
netdev_dpdk_rxq_recv);
-const struct netdev_class dpdk_vhost_class =
+static const struct netdev_class dpdk_vhost_class =
NETDEV_DPDK_CLASS(
"dpdkvhost",
dpdk_vhost_class_init,