From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by dpdk.org (Postfix) with ESMTP id 1D72032A5 for ; Tue, 2 Dec 2014 15:59:53 +0100 (CET) Received: by mail-wi0-f169.google.com with SMTP id r20so30188388wiv.2 for ; Tue, 02 Dec 2014 06:59:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=Xurn3i0HzQz1+BtDL3lYjc7eYPqGeMHIaAFifMXsUok=; b=gMghMq3Orx7Irz9I6a62bk5Zp4oDBSLcbC7yk2xaBd3QYGaorf3oyNcsG6Voios9pu 8Luhv0gzn8gLTyM38lLnj3EPdm3Av8/yxpucel49sfW4Wv191Idz41BLlTs45Xzo/iAi cYCKOxGMRNYLfYbscHQ3gfdATqA7v2mv7tCDAXYNgxeAlcEXfolFnOjAB1y8ShipLT32 TJR5KQBlqIo6D8S2v0bRlmrJLnH2njII305BNRuiPxmTjgBPe0hXSpg3bdDYCcwMkYsK Xn0Xvs62t7FHjd7AjjJPo+IygKS7s4rg8yDYoruhKPDjB+hKfDtD5o0uIltL7Y/fjTyK G/SA== X-Gm-Message-State: ALoCoQnPZYlpSMyExn8m5AdU3J1MS/mnfJ7xfS7iArIPyi5+pDEvXD1BRhQH/h+tsllxgGEz2gHd X-Received: by 10.194.6.164 with SMTP id c4mr5832259wja.77.1417532392774; Tue, 02 Dec 2014 06:59:52 -0800 (PST) Received: from XPS13.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id eu15sm33085857wid.18.2014.12.02.06.59.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Dec 2014 06:59:52 -0800 (PST) From: Thomas Monjalon To: dev@dpdk.org Date: Tue, 2 Dec 2014 15:59:20 +0100 Message-Id: <1417532360-8568-1-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.1.3 Subject: [dpdk-dev] [PATCH] enic: fix warnings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2014 14:59:53 -0000 A lot of warnings were not seen because $(WERROR_FLAGS) was not set in the Makefile. But they appear with toolchains that enforce more checks. -Wno-deprecated seems useless. -Wno-strict-aliasing is added to avoid false positives. This patch cleans up unused variable, unused functions, wrong types, static declarations, etc. A lot of functions have unused parameters; it suggests that more clean-up could be needed. Signed-off-by: Thomas Monjalon --- lib/librte_pmd_enic/Makefile | 3 +- lib/librte_pmd_enic/enic.h | 4 +- lib/librte_pmd_enic/enic_ethdev.c | 20 ++++----- lib/librte_pmd_enic/enic_main.c | 81 +++++++++++------------------------- lib/librte_pmd_enic/vnic/vnic_cq.h | 1 - lib/librte_pmd_enic/vnic/vnic_dev.c | 22 +++------- lib/librte_pmd_enic/vnic/vnic_dev.h | 4 +- lib/librte_pmd_enic/vnic/vnic_intr.c | 5 --- 8 files changed, 46 insertions(+), 94 deletions(-) diff --git a/lib/librte_pmd_enic/Makefile b/lib/librte_pmd_enic/Makefile index 948ec96..a2a623f 100644 --- a/lib/librte_pmd_enic/Makefile +++ b/lib/librte_pmd_enic/Makefile @@ -39,7 +39,8 @@ LIB = librte_pmd_enic.a CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_enic/vnic/ CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_enic/ -CFLAGS += -O3 -Wno-deprecated +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) -Wno-strict-aliasing VPATH += $(RTE_SDK)/lib/librte_pmd_enic/src diff --git a/lib/librte_pmd_enic/enic.h b/lib/librte_pmd_enic/enic.h index f128e64..c43417c 100644 --- a/lib/librte_pmd_enic/enic.h +++ b/lib/librte_pmd_enic/enic.h @@ -134,7 +134,7 @@ struct enic { unsigned int intr_count; }; -static inline unsigned int enic_cq_rq(struct enic *enic, unsigned int rq) +static inline unsigned int enic_cq_rq(__rte_unused struct enic *enic, unsigned int rq) { return rq; } @@ -144,7 +144,7 @@ static inline unsigned int enic_cq_wq(struct enic *enic, unsigned int wq) return enic->rq_count + wq; } -static inline unsigned int enic_msix_err_intr(struct enic *enic) +static inline unsigned int enic_msix_err_intr(__rte_unused struct enic *enic) { return 0; } diff --git a/lib/librte_pmd_enic/enic_ethdev.c b/lib/librte_pmd_enic/enic_ethdev.c index f582152..9cb6666 100644 --- a/lib/librte_pmd_enic/enic_ethdev.c +++ b/lib/librte_pmd_enic/enic_ethdev.c @@ -67,7 +67,7 @@ RTE_PCI_DEV_ID_DECL_ENIC(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_VF) static int enicpmd_fdir_remove_perfect_filter(struct rte_eth_dev *eth_dev, struct rte_fdir_filter *fdir_filter, - uint16_t soft_id) + __rte_unused uint16_t soft_id) { struct enic *enic = pmd_priv(eth_dev); @@ -76,7 +76,7 @@ static int enicpmd_fdir_remove_perfect_filter(struct rte_eth_dev *eth_dev, } static int enicpmd_fdir_add_perfect_filter(struct rte_eth_dev *eth_dev, - struct rte_fdir_filter *fdir_filter, uint16_t soft_id, + struct rte_fdir_filter *fdir_filter, __rte_unused uint16_t soft_id, uint8_t queue, uint8_t drop) { struct enic *enic = pmd_priv(eth_dev); @@ -103,7 +103,7 @@ static void enicpmd_dev_tx_queue_release(void *txq) static int enicpmd_dev_setup_intr(struct enic *enic) { int ret; - int index; + unsigned int index; ENICPMD_FUNC_TRACE(); @@ -134,7 +134,7 @@ static int enicpmd_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, - const struct rte_eth_txconf *tx_conf) + __rte_unused const struct rte_eth_txconf *tx_conf) { int ret; struct enic *enic = pmd_priv(eth_dev); @@ -215,7 +215,7 @@ static int enicpmd_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, - const struct rte_eth_rxconf *rx_conf, + __rte_unused const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp) { int ret; @@ -334,7 +334,7 @@ static void enicpmd_dev_close(struct rte_eth_dev *eth_dev) } static int enicpmd_dev_link_update(struct rte_eth_dev *eth_dev, - int wait_to_complete) + __rte_unused int wait_to_complete) { struct enic *enic = pmd_priv(eth_dev); int ret; @@ -428,7 +428,7 @@ static void enicpmd_dev_allmulticast_disable(struct rte_eth_dev *eth_dev) static void enicpmd_add_mac_addr(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr, - uint32_t index, uint32_t pool) + __rte_unused uint32_t index, __rte_unused uint32_t pool) { struct enic *enic = pmd_priv(eth_dev); @@ -436,7 +436,7 @@ static void enicpmd_add_mac_addr(struct rte_eth_dev *eth_dev, enic_set_mac_address(enic, mac_addr->addr_bytes); } -static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, uint32_t index) +static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, __rte_unused uint32_t index) { struct enic *enic = pmd_priv(eth_dev); @@ -457,7 +457,6 @@ static uint16_t enicpmd_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, struct rte_mbuf *tx_pkt; struct vnic_wq *wq = (struct vnic_wq *)tx_queue; struct enic *enic = vnic_dev_priv(wq->vdev); - unsigned char *buf; unsigned short vlan_id; unsigned short ol_flags; @@ -595,7 +594,8 @@ static struct eth_driver rte_enic_pmd = { * Invoked once at EAL init time. * Register as the [Poll Mode] Driver of Cisco ENIC device. */ -int rte_enic_pmd_init(const char *name __rte_unused, +static int +rte_enic_pmd_init(const char *name __rte_unused, const char *params __rte_unused) { ENICPMD_FUNC_TRACE(); diff --git a/lib/librte_pmd_enic/enic_main.c b/lib/librte_pmd_enic/enic_main.c index 4bbf1e4..e4f43c5 100644 --- a/lib/librte_pmd_enic/enic_main.c +++ b/lib/librte_pmd_enic/enic_main.c @@ -90,32 +90,12 @@ enic_rxmbuf_alloc(struct rte_mempool *mp) return m; } -static const struct rte_memzone *ring_dma_zone_reserve( - struct rte_eth_dev *dev, const char *ring_name, - uint16_t queue_id, uint32_t ring_size, int socket_id) -{ - char z_name[RTE_MEMZONE_NAMESIZE]; - const struct rte_memzone *mz; - - snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", - dev->driver->pci_drv.name, ring_name, - dev->data->port_id, queue_id); - - mz = rte_memzone_lookup(z_name); - if (mz) - return mz; - - return rte_memzone_reserve_aligned((const char *)z_name, - (uint64_t) ring_size, - socket_id, RTE_MEMZONE_1GB, ENIC_ALIGN); -} - void enic_set_hdr_split_size(struct enic *enic, u16 split_hdr_size) { vnic_set_hdr_split_size(enic->vdev, split_hdr_size); } -static void enic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf) +static void enic_free_wq_buf(__rte_unused struct vnic_wq *wq, struct vnic_wq_buf *buf) { struct rte_mbuf *mbuf = (struct rte_mbuf *)buf->os_buf; @@ -124,13 +104,15 @@ static void enic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf) } static void enic_wq_free_buf(struct vnic_wq *wq, - struct cq_desc *cq_desc, struct vnic_wq_buf *buf, void *opaque) + __rte_unused struct cq_desc *cq_desc, + struct vnic_wq_buf *buf, + __rte_unused void *opaque) { enic_free_wq_buf(wq, buf); } static int enic_wq_service(struct vnic_dev *vdev, struct cq_desc *cq_desc, - u8 type, u16 q_number, u16 completed_index, void *opaque) + __rte_unused u8 type, u16 q_number, u16 completed_index, void *opaque) { struct enic *enic = vnic_dev_priv(vdev); @@ -178,11 +160,8 @@ int enic_send_pkt(struct enic *enic, struct vnic_wq *wq, { struct wq_enet_desc *desc = vnic_wq_next_desc(wq); 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; uint64_t bus_addr = (dma_addr_t) (tx_pkt->buf_physaddr + RTE_PKTMBUF_HEADROOM); @@ -282,10 +261,9 @@ void enic_set_mac_address(struct enic *enic, uint8_t *mac_addr) } } -static void enic_free_rq_buf(struct vnic_rq *rq, struct vnic_rq_buf *buf) +static void +enic_free_rq_buf(__rte_unused struct vnic_rq *rq, struct vnic_rq_buf *buf) { - struct enic *enic = vnic_dev_priv(rq->vdev); - if (!buf->os_buf) return; @@ -297,8 +275,7 @@ void enic_init_vnic_resources(struct enic *enic) { unsigned int error_interrupt_enable = 1; unsigned int error_interrupt_offset = 0; - int index = 0; - unsigned int cq_index = 0; + unsigned int index = 0; for (index = 0; index < enic->rq_count; index++) { vnic_rq_init(&enic->rq[index], @@ -340,11 +317,9 @@ void enic_init_vnic_resources(struct enic *enic) static int enic_rq_alloc_buf(struct vnic_rq *rq) { struct enic *enic = vnic_dev_priv(rq->vdev); - void *buf; dma_addr_t dma_addr; struct rq_enet_desc *desc = vnic_rq_next_desc(rq); 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; @@ -368,7 +343,6 @@ static int enic_rq_alloc_buf(struct vnic_rq *rq) } hdr_mbuf->data_off = RTE_PKTMBUF_HEADROOM; - buf = rte_pktmbuf_mtod(hdr_mbuf, void *); hdr_mbuf->nb_segs = 2; hdr_mbuf->port = rq->index; @@ -390,7 +364,6 @@ static int enic_rq_alloc_buf(struct vnic_rq *rq) } mbuf->data_off = RTE_PKTMBUF_HEADROOM; - buf = rte_pktmbuf_mtod(mbuf, void *); mbuf->next = NULL; dma_addr = (dma_addr_t) @@ -525,7 +498,7 @@ static int enic_rq_indicate_buf(struct vnic_rq *rq, } static int enic_rq_service(struct vnic_dev *vdev, struct cq_desc *cq_desc, - u8 type, u16 q_number, u16 completed_index, void *opaque) + __rte_unused u8 type, u16 q_number, u16 completed_index, void *opaque) { struct enic *enic = vnic_dev_priv(vdev); @@ -557,10 +530,10 @@ int enic_poll(struct vnic_rq *rq, struct rte_mbuf **rx_pkts, return err; } -void *enic_alloc_consistent(void *priv, size_t size, +static void * +enic_alloc_consistent(__rte_unused void *priv, size_t size, dma_addr_t *dma_handle, u8 *name) { - struct enic *enic = (struct enic *)priv; void *vaddr; const struct rte_memzone *rz; *dma_handle = 0; @@ -579,13 +552,17 @@ void *enic_alloc_consistent(void *priv, size_t size, return vaddr; } -void enic_free_consistent(struct rte_pci_device *hwdev, size_t size, - void *vaddr, dma_addr_t dma_handle) +static void +enic_free_consistent(__rte_unused struct rte_pci_device *hwdev, + __rte_unused size_t size, + __rte_unused void *vaddr, + __rte_unused dma_addr_t dma_handle) { /* Nothing to be done */ } -void enic_intr_handler(__rte_unused struct rte_intr_handle *handle, +static void +enic_intr_handler(__rte_unused struct rte_intr_handle *handle, void *arg) { struct enic *enic = pmd_priv((struct rte_eth_dev *)arg); @@ -598,10 +575,7 @@ void enic_intr_handler(__rte_unused struct rte_intr_handle *handle, int enic_enable(struct enic *enic) { - int index; - void *res; - char mz_name[RTE_MEMZONE_NAMESIZE]; - const struct rte_memzone *rmz; + unsigned int index; struct rte_eth_dev *eth_dev = enic->rte_dev; eth_dev->data->dev_link.link_speed = vnic_dev_port_speed(enic->vdev); @@ -869,11 +843,11 @@ static int enic_set_rsskey(struct enic *enic) { dma_addr_t rss_key_buf_pa; union vnic_rss_key *rss_key_buf_va = NULL; - union vnic_rss_key rss_key = { - .key[0].b = {85, 67, 83, 97, 119, 101, 115, 111, 109, 101}, - .key[1].b = {80, 65, 76, 79, 117, 110, 105, 113, 117, 101}, - .key[2].b = {76, 73, 78, 85, 88, 114, 111, 99, 107, 115}, - .key[3].b = {69, 78, 73, 67, 105, 115, 99, 111, 111, 108}, + static union vnic_rss_key rss_key = { + .key[0] = {.b = {85, 67, 83, 97, 119, 101, 115, 111, 109, 101}}, + .key[1] = {.b = {80, 65, 76, 79, 117, 110, 105, 113, 117, 101}}, + .key[2] = {.b = {76, 73, 78, 85, 88, 114, 111, 99, 107, 115}}, + .key[3] = {.b = {69, 78, 73, 67, 105, 115, 99, 111, 111, 108}}, }; int err; u8 name[NAME_MAX]; @@ -900,7 +874,7 @@ static int enic_set_rsscpu(struct enic *enic, u8 rss_hash_bits) { dma_addr_t rss_cpu_buf_pa; union vnic_rss_cpu *rss_cpu_buf_va = NULL; - unsigned int i; + int i; int err; u8 name[NAME_MAX]; @@ -1105,7 +1079,6 @@ static void enic_clear_intr_mode(struct enic *enic) static void enic_dev_deinit(struct enic *enic) { - unsigned int i; struct rte_eth_dev *eth_dev = enic->rte_dev; if (eth_dev->data->mac_addrs) @@ -1140,7 +1113,6 @@ int enic_set_vnic_res(struct enic *enic) static int enic_dev_init(struct enic *enic) { - unsigned int i; int err; struct rte_eth_dev *eth_dev = enic->rte_dev; @@ -1189,10 +1161,7 @@ static int enic_dev_init(struct enic *enic) int enic_probe(struct enic *enic) { - const char *bdf = enic->bdf_name; struct rte_pci_device *pdev = enic->pdev; - struct rte_eth_dev *eth_dev = enic->rte_dev; - unsigned int i; int err = -1; dev_info(enic, " Initializing ENIC PMD version %s\n", DRV_VERSION); diff --git a/lib/librte_pmd_enic/vnic/vnic_cq.h b/lib/librte_pmd_enic/vnic/vnic_cq.h index 9ed9b1d..0928d72 100644 --- a/lib/librte_pmd_enic/vnic/vnic_cq.h +++ b/lib/librte_pmd_enic/vnic/vnic_cq.h @@ -103,7 +103,6 @@ static inline unsigned int vnic_cq_service(struct vnic_cq *cq, u8 type, color; struct rte_mbuf **rx_pkts = opaque; unsigned int ret; - unsigned int split_hdr_size = vnic_get_hdr_split_size(cq->vdev); cq_desc = (struct cq_desc *)((u8 *)cq->ring.descs + cq->ring.desc_size * cq->to_clean); diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.c b/lib/librte_pmd_enic/vnic/vnic_dev.c index 682c9c9..21d5521 100644 --- a/lib/librte_pmd_enic/vnic/vnic_dev.c +++ b/lib/librte_pmd_enic/vnic/vnic_dev.c @@ -267,7 +267,8 @@ void vnic_dev_clear_desc_ring(struct vnic_dev_ring *ring) memset(ring->descs, 0, ring->size); } -int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring, +int vnic_dev_alloc_desc_ring(__attribute__((unused)) struct vnic_dev *vdev, + struct vnic_dev_ring *ring, unsigned int desc_count, unsigned int desc_size, unsigned int socket_id, char *z_name) { @@ -305,7 +306,8 @@ int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring, return 0; } -void vnic_dev_free_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring) +void vnic_dev_free_desc_ring(__attribute__((unused)) struct vnic_dev *vdev, + struct vnic_dev_ring *ring) { if (ring->descs) ring->descs = NULL; @@ -761,7 +763,7 @@ int vnic_dev_notify_setcmd(struct vnic_dev *vdev, int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) { - void *notify_addr; + void *notify_addr = NULL; dma_addr_t notify_pa; char name[NAME_MAX]; static u32 instance; @@ -973,20 +975,6 @@ struct rte_pci_device *vnic_dev_get_pdev(struct vnic_dev *vdev) return vdev->pdev; } -static int vnic_dev_cmd_status(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, - int *status) -{ - u64 a0 = cmd, a1 = 0; - int wait = 1000; - int ret; - - ret = vnic_dev_cmd(vdev, CMD_STATUS, &a0, &a1, wait); - if (!ret) - *status = (int)a0; - - return ret; -} - int vnic_dev_set_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) { u64 a0, a1; diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.h b/lib/librte_pmd_enic/vnic/vnic_dev.h index 8cc036b..d1373a5 100644 --- a/lib/librte_pmd_enic/vnic/vnic_dev.h +++ b/lib/librte_pmd_enic/vnic/vnic_dev.h @@ -48,14 +48,14 @@ #ifndef readq static inline u64 readq(void __iomem *reg) { - return ((u64)readl(reg + 0x4UL) << 32) | + return ((u64)readl((char *)reg + 0x4UL) << 32) | (u64)readl(reg); } static inline void writeq(u64 val, void __iomem *reg) { writel(val & 0xffffffff, reg); - writel(val >> 32, reg + 0x4UL); + writel(val >> 32, (char *)reg + 0x4UL); } #endif diff --git a/lib/librte_pmd_enic/vnic/vnic_intr.c b/lib/librte_pmd_enic/vnic/vnic_intr.c index 9be3744..84368af 100644 --- a/lib/librte_pmd_enic/vnic/vnic_intr.c +++ b/lib/librte_pmd_enic/vnic/vnic_intr.c @@ -76,8 +76,3 @@ void vnic_intr_clean(struct vnic_intr *intr) { iowrite32(0, &intr->ctrl->int_credits); } - -void vnic_intr_raise(struct vnic_intr *intr) -{ - vnic_dev_raise_intr(intr->vdev, (u16)intr->index); -} -- 2.1.3