Skip to contentSkip to conversation

net/avf: remove unused variables and label

PATCH Applied Bruce Richardson 4 participants 19 messages Sep 13, 2018 – Sep 21, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/avf: remove unused variables and label

Compiling with all warnings turned on causes errors about unused variables and an unused label. Remove these to allow building without having to disable those warnings.

---
 drivers/net/avf/avf_ethdev.c | 15 +--------------
 drivers/net/avf/avf_rxtx.c   | 17 +++++------------
 drivers/net/avf/avf_vchnl.c  |  2 --
 3 files changed, 6 insertions(+), 28 deletions(-)
drivers/net/avf/avf_ethdev.c +1 -14
index 3a2baaf28..be9f163be 100644
@@ -154,7 +154,6 @@ static int
 avf_init_rss(struct avf_adapter *adapter)
 {
 	struct avf_info *vf =  AVF_DEV_PRIVATE_TO_VF(adapter);
-	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_eth_rss_conf *rss_conf;
 	uint8_t i, j, nb_q;
 	int ret;
@@ -259,11 +258,8 @@ avf_init_rxq(struct rte_eth_dev *dev, struct avf_rx_queue *rxq)
 static int
 avf_init_queues(struct rte_eth_dev *dev)
 {
-	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct avf_rx_queue **rxq =
 		(struct avf_rx_queue **)dev->data->rx_queues;
-	struct avf_tx_queue **txq =
-		(struct avf_tx_queue **)dev->data->tx_queues;
 	int i, ret = AVF_SUCCESS;
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
@@ -415,7 +411,6 @@ avf_dev_start(struct rte_eth_dev *dev)
 		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
 
 	PMD_INIT_FUNC_TRACE();
@@ -476,9 +471,7 @@ avf_dev_stop(struct rte_eth_dev *dev)
 	struct avf_adapter *adapter =
 		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
-	int ret, i;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -503,8 +496,6 @@ avf_dev_stop(struct rte_eth_dev *dev)
 static void
 avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
-	struct avf_adapter *adapter =
-		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
 	memset(dev_info, 0, sizeof(*dev_info));
@@ -915,7 +906,6 @@ avf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 static int
 avf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
-	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	uint32_t frame_size = mtu + AVF_ETH_OVERHEAD;
 	int ret = 0;
 
@@ -1045,8 +1035,6 @@ avf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 static int
 avf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
 {
-	struct avf_adapter *adapter =
-		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint16_t msix_intr;
@@ -1089,7 +1077,7 @@ avf_check_vf_reset_done(struct avf_hw *hw)
 static int
 avf_init_vf(struct rte_eth_dev *dev)
 {
-	int i, err, bufsz;
+	int err, bufsz;
 	struct avf_adapter *adapter =
 		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1198,7 +1186,6 @@ avf_dev_interrupt_handler(void *param)
 
 	avf_handle_virtchnl_msg(dev);
 
-done:
 	avf_enable_irq0(hw);
 }
 
drivers/net/avf/avf_rxtx.c +5 -12
index e03a136fc..edff48d27 100644
@@ -247,7 +247,6 @@ alloc_rxq_mbufs(struct avf_rx_queue *rxq)
 static inline void
 release_rxq_mbufs(struct avf_rx_queue *rxq)
 {
-	struct rte_mbuf *mbuf;
 	uint16_t i;
 
 	if (!rxq->sw_ring)
@@ -310,9 +309,8 @@ avf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	struct avf_rx_queue *rxq;
 	const struct rte_memzone *mz;
 	uint32_t ring_size;
-	uint16_t len, i;
+	uint16_t len;
 	uint16_t rx_free_thresh;
-	uint16_t base, bsf, tc_mapping;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -428,13 +426,10 @@ avf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		       const struct rte_eth_txconf *tx_conf)
 {
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct avf_adapter *ad =
-		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_tx_queue *txq;
 	const struct rte_memzone *mz;
 	uint32_t ring_size;
 	uint16_t tx_rs_thresh, tx_free_thresh;
-	uint16_t i, base, bsf, tc_mapping;
 	uint64_t offloads;
 
 	PMD_INIT_FUNC_TRACE();
@@ -515,8 +510,11 @@ avf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->ops = &def_txq_ops;
 
 #ifdef RTE_LIBRTE_AVF_INC_VECTOR
-	if (check_tx_vec_allow(txq) == FALSE)
+	if (check_tx_vec_allow(txq) == FALSE) {
+		struct avf_adapter *ad =
+			AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 		ad->tx_vec_allowed = false;
+	}
 #endif
 
 	return 0;
@@ -1268,7 +1266,6 @@ static inline uint16_t
 rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 {
 	struct avf_rx_queue *rxq = (struct avf_rx_queue *)rx_queue;
-	struct rte_eth_dev *dev;
 	uint16_t nb_rx = 0;
 
 	if (!nb_pkts)
@@ -1584,10 +1581,6 @@ avf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		if (nb_ctx) {
 			/* Setup TX context descriptor if required */
-			volatile struct avf_tx_context_desc *ctx_txd =
-				(volatile struct avf_tx_context_desc *)
-					&txr[tx_id];
-			uint16_t cd_l2tag2 = 0;
 			uint64_t cd_type_cmd_tso_mss =
 				AVF_TX_DESC_DTYPE_CONTEXT;
 
drivers/net/avf/avf_vchnl.c +0 -2
index fa71014e1..fd90cc2c3 100644
@@ -69,7 +69,6 @@ avf_execute_vf_cmd(struct avf_adapter *adapter, struct avf_cmd_info *args)
 {
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(adapter);
 	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(adapter);
-	struct avf_arq_event_info event_info;
 	enum avf_status_code ret;
 	int err = 0;
 	int i = 0;
@@ -600,7 +599,6 @@ avf_config_irq_map(struct avf_adapter *adapter)
 	struct virtchnl_irq_map_info *map_info;
 	struct virtchnl_vector_map *vecmap;
 	struct avf_cmd_info args;
-	uint32_t vector_id;
 	int len, i, err;
 
 	len = sizeof(struct virtchnl_irq_map_info) +
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Bruce Richardson

Compiling with all warnings turned on causes errors about unused variables
and an unused label. Remove these to allow building without having to disable those warnings.

---
 drivers/net/avf/avf_ethdev.c | 15 +-------------- drivers/net/avf/avf_rxtx.c   | 17 +++++------------ drivers/net/avf/avf_vchnl.c  |  2 --

 3 files changed, 6 insertions(+), 28 deletions(-)
Signature · 2 lines
Kind regards,
Luca Boccassi
Applied
#2 lore raw
Quoted 22 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Luca Boccassi
Sent: Friday, September 14, 2018 12:26 AM
To: Richardson, Bruce <[email protected]>; Wu, Jingjing <[email protected]>; Lu, Wenzhuo <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/avf: remove unused variables and label

Quoted 10 lines · Bruce Richardson

Compiling with all warnings turned on causes errors about unused variables and an unused label. Remove these to allow building without having to disable those warnings.

---
 drivers/net/avf/avf_ethdev.c | 15 +-------------- drivers/net/avf/avf_rxtx.c   | 17 +++++------------ drivers/net/avf/avf_vchnl.c  |  2 --

 3 files changed, 6 insertions(+), 28 deletions(-)
Quoted 5 lines

--
Kind regards,
Luca Boccassi

Applied to dpdk-next-net-intel.

Thanks
Qi

#3 lore raw
In reply to Bruce Richardson
Quoted 3 lines · Bruce Richardson

Compiling with all warnings turned on causes errors about unused variables and an unused label. Remove these to allow building without having to disable those warnings.

If this is fixing some build errors should it be backported?

And why we didn't get those warnings until now, aren't we already compiling with all warnings turned on?

Quoted 2 lines

<...>

#4 lore raw
Quoted 13 lines · Ferruh Yigit
Quoted 3 lines · Bruce Richardson

Compiling with all warnings turned on causes errors about unused variables and an unused label. Remove these to allow building without having to disable those warnings.

If this is fixing some build errors should it be backported?

And why we didn't get those warnings until now, aren't we already compiling with all warnings turned on?

Quoted 2 lines

It does not appear so. When we add support for building this driver with meson, the compiler warnings then appeared [See
http://patches.dpdk.org/patch/44698/].

While you can backport I'm not sure it's worthwhile, unless you plan on backporting the new meson support too. The warnings don't come from external header files that apps would be using directly with unknown compiler flags, but are internal to DPDK and don't seem to cause any issues with "make" builds.

Regards,
/Bruce

#5 lore raw
Quoted 18 lines · Bruce Richardson
Quoted 13 lines · Ferruh Yigit
Quoted 3 lines · Bruce Richardson

Compiling with all warnings turned on causes errors about unused variables and an unused label. Remove these to allow building without having to disable those warnings.

If this is fixing some build errors should it be backported?

And why we didn't get those warnings until now, aren't we already compiling with all warnings turned on?

Quoted 2 lines

It does not appear so. When we add support for building this driver with meson, the compiler warnings then appeared [See
http://patches.dpdk.org/patch/44698/].

Quoted 5 lines

While you can backport I'm not sure it's worthwhile, unless you plan on backporting the new meson support too. The warnings don't come from external header files that apps would be using directly with unknown compiler flags, but are internal to DPDK and don't seem to cause any issues with "make" builds.

Argh, it is missing warning flags in Makefile:
+CFLAGS += $(WERROR_FLAGS)

When above added "make" also gives "unused variable" warnings.

Even we don't observe the issue with current makefile, if someone builds with:
'make EXTRA_CFLAGS="-Wunused-variable"' will observe the warnings.

That is why I am for backporting this patch, does it make sense?

And would you mind adding above CFLAGS update into this patch?

#6 lore raw
Quoted 28 lines · Ferruh Yigit
Quoted 18 lines · Bruce Richardson
Quoted 13 lines · Ferruh Yigit
Quoted 3 lines · Bruce Richardson

Compiling with all warnings turned on causes errors about unused variables and an unused label. Remove these to allow building without having to disable those warnings.

If this is fixing some build errors should it be backported?

And why we didn't get those warnings until now, aren't we already compiling with all warnings turned on?

Quoted 2 lines

It does not appear so. When we add support for building this driver with meson, the compiler warnings then appeared [See
http://patches.dpdk.org/patch/44698/].

Quoted 5 lines

While you can backport I'm not sure it's worthwhile, unless you plan on backporting the new meson support too. The warnings don't come from external header files that apps would be using directly with unknown compiler flags, but are internal to DPDK and don't seem to cause any issues with "make" builds.

Argh, it is missing warning flags in Makefile:
+CFLAGS += $(WERROR_FLAGS)

Quoted 8 lines

When above added "make" also gives "unused variable" warnings.

Even we don't observe the issue with current makefile, if someone builds with:
'make EXTRA_CFLAGS="-Wunused-variable"' will observe the warnings.

That is why I am for backporting this patch, does it make sense?

And would you mind adding above CFLAGS update into this patch?

Ok, I'll do up a V2.

#7 lore raw

PATCH v2 1/2 net/avf: fix unused variables and label

In reply to Bruce Richardson

Compiling with all warnings turned on causes errors about unused variables and an unused label. Remove these to allow building without having to disable those warnings.

Fixes 69dd4c3d0898 ("net/avf: enable queue and device")
Fixes 3fd7a3719c66 ("net/avf: enable ops for MTU setting")
Fixes d6bde6b5eae9 ("net/avf: enable Rx interrupt")
Fixes 22b123a36d07 ("net/avf: initialize PMD")
Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")
Fixes a2b29a7733ef ("net/avf: enable basic Rx Tx")
---
 drivers/net/avf/avf_ethdev.c | 15 +--------------
 drivers/net/avf/avf_rxtx.c   | 17 +++++------------
 drivers/net/avf/avf_vchnl.c  |  2 --
 3 files changed, 6 insertions(+), 28 deletions(-)
drivers/net/avf/avf_ethdev.c +1 -14
index a7d69828c..6b6ff7d55 100644
@@ -154,7 +154,6 @@ static int
 avf_init_rss(struct avf_adapter *adapter)
 {
 	struct avf_info *vf =  AVF_DEV_PRIVATE_TO_VF(adapter);
-	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_eth_rss_conf *rss_conf;
 	uint8_t i, j, nb_q;
 	int ret;
@@ -259,11 +258,8 @@ avf_init_rxq(struct rte_eth_dev *dev, struct avf_rx_queue *rxq)
 static int
 avf_init_queues(struct rte_eth_dev *dev)
 {
-	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct avf_rx_queue **rxq =
 		(struct avf_rx_queue **)dev->data->rx_queues;
-	struct avf_tx_queue **txq =
-		(struct avf_tx_queue **)dev->data->tx_queues;
 	int i, ret = AVF_SUCCESS;
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
@@ -415,7 +411,6 @@ avf_dev_start(struct rte_eth_dev *dev)
 		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
 
 	PMD_INIT_FUNC_TRACE();
@@ -476,9 +471,7 @@ avf_dev_stop(struct rte_eth_dev *dev)
 	struct avf_adapter *adapter =
 		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
-	int ret, i;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -503,8 +496,6 @@ avf_dev_stop(struct rte_eth_dev *dev)
 static void
 avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
-	struct avf_adapter *adapter =
-		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
 	memset(dev_info, 0, sizeof(*dev_info));
@@ -914,7 +905,6 @@ avf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 static int
 avf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
-	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	uint32_t frame_size = mtu + AVF_ETH_OVERHEAD;
 	int ret = 0;
 
@@ -1044,8 +1034,6 @@ avf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 static int
 avf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
 {
-	struct avf_adapter *adapter =
-		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint16_t msix_intr;
@@ -1088,7 +1076,7 @@ avf_check_vf_reset_done(struct avf_hw *hw)
 static int
 avf_init_vf(struct rte_eth_dev *dev)
 {
-	int i, err, bufsz;
+	int err, bufsz;
 	struct avf_adapter *adapter =
 		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1197,7 +1185,6 @@ avf_dev_interrupt_handler(void *param)
 
 	avf_handle_virtchnl_msg(dev);
 
-done:
 	avf_enable_irq0(hw);
 }
 
drivers/net/avf/avf_rxtx.c +5 -12
index e03a136fc..edff48d27 100644
@@ -247,7 +247,6 @@ alloc_rxq_mbufs(struct avf_rx_queue *rxq)
 static inline void
 release_rxq_mbufs(struct avf_rx_queue *rxq)
 {
-	struct rte_mbuf *mbuf;
 	uint16_t i;
 
 	if (!rxq->sw_ring)
@@ -310,9 +309,8 @@ avf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	struct avf_rx_queue *rxq;
 	const struct rte_memzone *mz;
 	uint32_t ring_size;
-	uint16_t len, i;
+	uint16_t len;
 	uint16_t rx_free_thresh;
-	uint16_t base, bsf, tc_mapping;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -428,13 +426,10 @@ avf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		       const struct rte_eth_txconf *tx_conf)
 {
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct avf_adapter *ad =
-		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_tx_queue *txq;
 	const struct rte_memzone *mz;
 	uint32_t ring_size;
 	uint16_t tx_rs_thresh, tx_free_thresh;
-	uint16_t i, base, bsf, tc_mapping;
 	uint64_t offloads;
 
 	PMD_INIT_FUNC_TRACE();
@@ -515,8 +510,11 @@ avf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->ops = &def_txq_ops;
 
 #ifdef RTE_LIBRTE_AVF_INC_VECTOR
-	if (check_tx_vec_allow(txq) == FALSE)
+	if (check_tx_vec_allow(txq) == FALSE) {
+		struct avf_adapter *ad =
+			AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 		ad->tx_vec_allowed = false;
+	}
 #endif
 
 	return 0;
@@ -1268,7 +1266,6 @@ static inline uint16_t
 rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 {
 	struct avf_rx_queue *rxq = (struct avf_rx_queue *)rx_queue;
-	struct rte_eth_dev *dev;
 	uint16_t nb_rx = 0;
 
 	if (!nb_pkts)
@@ -1584,10 +1581,6 @@ avf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		if (nb_ctx) {
 			/* Setup TX context descriptor if required */
-			volatile struct avf_tx_context_desc *ctx_txd =
-				(volatile struct avf_tx_context_desc *)
-					&txr[tx_id];
-			uint16_t cd_l2tag2 = 0;
 			uint64_t cd_type_cmd_tso_mss =
 				AVF_TX_DESC_DTYPE_CONTEXT;
 
drivers/net/avf/avf_vchnl.c +0 -2
index fa71014e1..fd90cc2c3 100644
@@ -69,7 +69,6 @@ avf_execute_vf_cmd(struct avf_adapter *adapter, struct avf_cmd_info *args)
 {
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(adapter);
 	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(adapter);
-	struct avf_arq_event_info event_info;
 	enum avf_status_code ret;
 	int err = 0;
 	int i = 0;
@@ -600,7 +599,6 @@ avf_config_irq_map(struct avf_adapter *adapter)
 	struct virtchnl_irq_map_info *map_info;
 	struct virtchnl_vector_map *vecmap;
 	struct avf_cmd_info args;
-	uint32_t vector_id;
 	int len, i, err;
 
 	len = sizeof(struct virtchnl_irq_map_info) +
Signature · 1 line
2.17.1
#8 lore raw

PATCH v2 2/2 net/avf: fix missing compiler error flags

The AVF driver was missing $(WERROR_FLAGS) in it's cflags, which means that a number of compilation errors were getting missed. This patch adds in the flag and fixes most of the errors, just disabling the strict-aliasing ones.

Fixes 22b123a36d07 ("net/avf: initialize PMD")
Fixes 69dd4c3d0898 ("net/avf: enable queue and device")
Fixes a2b29a7733ef ("net/avf: enable basic Rx Tx")
Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")
---
 drivers/net/avf/Makefile           | 2 +-
 drivers/net/avf/avf_ethdev.c       | 2 +-
 drivers/net/avf/avf_rxtx.h         | 2 +-
 drivers/net/avf/avf_rxtx_vec_sse.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/avf/Makefile +1 -1
index 3f815bbc4..0a142c104 100644
@@ -8,7 +8,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 #
 LIB = librte_pmd_avf.a
 
-CFLAGS += -O3
+CFLAGS += -O3 $(WERROR_FLAGS) -Wno-strict-aliasing
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
 LDLIBS += -lrte_bus_pci
drivers/net/avf/avf_ethdev.c +1 -1
index 6b6ff7d55..549498477 100644
@@ -559,7 +559,7 @@ avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 }
 
 static const uint32_t *
-avf_dev_supported_ptypes_get(struct rte_eth_dev *dev)
+avf_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 {
 	static const uint32_t ptypes[] = {
 		RTE_PTYPE_L2_ETHER,
drivers/net/avf/avf_rxtx.h +1 -1
index 297d0776d..c4120f8a4 100644
@@ -227,7 +227,7 @@ static inline
 void avf_dump_tx_descriptor(const struct avf_tx_queue *txq,
 			    const void *desc, uint16_t tx_id)
 {
-	char *name;
+	const char *name;
 	const struct avf_tx_desc *tx_desc = desc;
 	enum avf_tx_desc_dtype_value type;
 
drivers/net/avf/avf_rxtx_vec_sse.c +1 -1
index 8275100f3..343a6aac3 100644
@@ -621,7 +621,7 @@ avf_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 	return nb_pkts;
 }
 
-void __attribute__((cold))
+static void __attribute__((cold))
 avf_rx_queue_release_mbufs_sse(struct avf_rx_queue *rxq)
 {
 	_avf_rx_queue_release_mbufs_vec(rxq);
Signature · 1 line
2.17.1
Reviewed-by on v2 2/2
#9 lore raw

Re: [PATCH v2 2/2] net/avf: fix missing compiler error flags

Quoted 5 lines · Bruce Richardson

The AVF driver was missing $(WERROR_FLAGS) in it's cflags, which means that a number of compilation errors were getting missed. This patch adds in the flag and fixes most of the errors, just disabling the strict-aliasing ones.

Quoted 8 lines
Fixes 22b123a36d07 ("net/avf: initialize PMD")
Fixes 69dd4c3d0898 ("net/avf: enable queue and device")
Fixes a2b29a7733ef ("net/avf: enable basic Rx Tx")
Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")
#10 lore raw

Re: [PATCH v2 1/2] net/avf: fix unused variables and label

In reply to Bruce Richardson
Quoted 14 lines · Bruce Richardson

Compiling with all warnings turned on causes errors about unused variables and an unused label. Remove these to allow building without having to disable those warnings.

Fixes 69dd4c3d0898 ("net/avf: enable queue and device")
Fixes 3fd7a3719c66 ("net/avf: enable ops for MTU setting")
Fixes d6bde6b5eae9 ("net/avf: enable Rx interrupt")
Fixes 22b123a36d07 ("net/avf: initialize PMD")
Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")
Fixes a2b29a7733ef ("net/avf: enable basic Rx Tx")>

<...>

drivers/net/avf/avf_rxtx.c static inline uint16_t · line 1271

Quoted 5 lines
drivers/net/avf/avf_rxtx.c +0 -1
@@ -1268,7 +1266,6 @@ static inline uint16_t
 rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 {
 	struct avf_rx_queue *rxq = (struct avf_rx_queue *)rx_queue;
-	struct rte_eth_dev *dev;
Fixes 1060591eada5 ("net/avf: enable bulk allocate Rx")

drivers/net/avf/avf_rxtx.c avf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) · line 1589

Quoted 10 lines
drivers/net/avf/avf_rxtx.c +0 -3
 	uint16_t nb_rx = 0;
 
 	if (!nb_pkts)
@@ -1584,10 +1581,6 @@ avf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		if (nb_ctx) {
 			/* Setup TX context descriptor if required */
-			volatile struct avf_tx_context_desc *ctx_txd =
-				(volatile struct avf_tx_context_desc *)
-					&txr[tx_id];

ctx_txd seems used in below macro controlled by DEBUG_DUMP_DESC define AVF_DUMP_TX_DESC(txq, ctx_txd, tx_id);

#11 lore raw

Re: [PATCH v2 1/2] net/avf: fix unused variables and label

Quoted 18 lines · Ferruh Yigit
Quoted 14 lines · Bruce Richardson

Compiling with all warnings turned on causes errors about unused variables and an unused label. Remove these to allow building without having to disable those warnings.

Fixes 69dd4c3d0898 ("net/avf: enable queue and device")
Fixes 3fd7a3719c66 ("net/avf: enable ops for MTU setting")
Fixes d6bde6b5eae9 ("net/avf: enable Rx interrupt")
Fixes 22b123a36d07 ("net/avf: initialize PMD")
Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")
Fixes a2b29a7733ef ("net/avf: enable basic Rx Tx")>

<...>

Quoted 8 lines

drivers/net/avf/avf_rxtx.c static inline uint16_t · line 1271

Quoted 5 lines
drivers/net/avf/avf_rxtx.c +0 -1
@@ -1268,7 +1266,6 @@ static inline uint16_t
 rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 {
 	struct avf_rx_queue *rxq = (struct avf_rx_queue *)rx_queue;
-	struct rte_eth_dev *dev;
Fixes 1060591eada5 ("net/avf: enable bulk allocate Rx")

There's always one more! :-(

Quoted 5 lines
Quoted 5 lines
drivers/net/avf/avf_rxtx.c +0 -0
 	uint16_t nb_rx = 0;
 
 	if (!nb_pkts)
@@ -1584,10 +1581,6 @@ avf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
Quoted 8 lines

drivers/net/avf/avf_rxtx.c avf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) · line 1589

Quoted 5 lines
drivers/net/avf/avf_rxtx.c +0 -3
 		if (nb_ctx) {
 			/* Setup TX context descriptor if required */
-			volatile struct avf_tx_context_desc *ctx_txd =
-				(volatile struct avf_tx_context_desc *)
-					&txr[tx_id];

ctx_txd seems used in below macro controlled by DEBUG_DUMP_DESC define AVF_DUMP_TX_DESC(txq, ctx_txd, tx_id);

Yes, looking now it is. The function that is called from that macro takes a void *, so I don't think the temporary variable is needed at all. I'll do a V3, changing ctx_txd to &txr[tx_id] in that instance.

However, compiling with the DUMP_DESC flag turned on raises a whole set of other compiler warnings in the code - even with 18.08 release. Therefore that option should either be fixed and made a proper debug option in the build config, or else dropped.

/Bruce

#12 lore raw

PATCH v3 1/2 net/avf: fix unused variables and label

In reply to Bruce Richardson

Compiling with all warnings turned on causes errors about unused variables and an unused label. Remove these to allow building without having to disable those warnings.

Fixes 69dd4c3d0898 ("net/avf: enable queue and device")
Fixes 3fd7a3719c66 ("net/avf: enable ops for MTU setting")
Fixes d6bde6b5eae9 ("net/avf: enable Rx interrupt")
Fixes 22b123a36d07 ("net/avf: initialize PMD")
Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")
Fixes a2b29a7733ef ("net/avf: enable basic Rx Tx")
Fixes 1060591eada5 ("net/avf: enable bulk allocate Rx")
---
 drivers/net/avf/avf_ethdev.c | 15 +--------------
 drivers/net/avf/avf_rxtx.c   | 19 ++++++-------------
 drivers/net/avf/avf_vchnl.c  |  2 --
 3 files changed, 7 insertions(+), 29 deletions(-)
drivers/net/avf/avf_ethdev.c +1 -14
index a7d69828c..6b6ff7d55 100644
@@ -154,7 +154,6 @@ static int
 avf_init_rss(struct avf_adapter *adapter)
 {
 	struct avf_info *vf =  AVF_DEV_PRIVATE_TO_VF(adapter);
-	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_eth_rss_conf *rss_conf;
 	uint8_t i, j, nb_q;
 	int ret;
@@ -259,11 +258,8 @@ avf_init_rxq(struct rte_eth_dev *dev, struct avf_rx_queue *rxq)
 static int
 avf_init_queues(struct rte_eth_dev *dev)
 {
-	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct avf_rx_queue **rxq =
 		(struct avf_rx_queue **)dev->data->rx_queues;
-	struct avf_tx_queue **txq =
-		(struct avf_tx_queue **)dev->data->tx_queues;
 	int i, ret = AVF_SUCCESS;
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
@@ -415,7 +411,6 @@ avf_dev_start(struct rte_eth_dev *dev)
 		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
 
 	PMD_INIT_FUNC_TRACE();
@@ -476,9 +471,7 @@ avf_dev_stop(struct rte_eth_dev *dev)
 	struct avf_adapter *adapter =
 		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
-	int ret, i;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -503,8 +496,6 @@ avf_dev_stop(struct rte_eth_dev *dev)
 static void
 avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
-	struct avf_adapter *adapter =
-		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
 	memset(dev_info, 0, sizeof(*dev_info));
@@ -914,7 +905,6 @@ avf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 static int
 avf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
-	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	uint32_t frame_size = mtu + AVF_ETH_OVERHEAD;
 	int ret = 0;
 
@@ -1044,8 +1034,6 @@ avf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 static int
 avf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
 {
-	struct avf_adapter *adapter =
-		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint16_t msix_intr;
@@ -1088,7 +1076,7 @@ avf_check_vf_reset_done(struct avf_hw *hw)
 static int
 avf_init_vf(struct rte_eth_dev *dev)
 {
-	int i, err, bufsz;
+	int err, bufsz;
 	struct avf_adapter *adapter =
 		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1197,7 +1185,6 @@ avf_dev_interrupt_handler(void *param)
 
 	avf_handle_virtchnl_msg(dev);
 
-done:
 	avf_enable_irq0(hw);
 }
 
drivers/net/avf/avf_rxtx.c +6 -13
index e03a136fc..6b3b0191c 100644
@@ -247,7 +247,6 @@ alloc_rxq_mbufs(struct avf_rx_queue *rxq)
 static inline void
 release_rxq_mbufs(struct avf_rx_queue *rxq)
 {
-	struct rte_mbuf *mbuf;
 	uint16_t i;
 
 	if (!rxq->sw_ring)
@@ -310,9 +309,8 @@ avf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	struct avf_rx_queue *rxq;
 	const struct rte_memzone *mz;
 	uint32_t ring_size;
-	uint16_t len, i;
+	uint16_t len;
 	uint16_t rx_free_thresh;
-	uint16_t base, bsf, tc_mapping;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -428,13 +426,10 @@ avf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		       const struct rte_eth_txconf *tx_conf)
 {
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct avf_adapter *ad =
-		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_tx_queue *txq;
 	const struct rte_memzone *mz;
 	uint32_t ring_size;
 	uint16_t tx_rs_thresh, tx_free_thresh;
-	uint16_t i, base, bsf, tc_mapping;
 	uint64_t offloads;
 
 	PMD_INIT_FUNC_TRACE();
@@ -515,8 +510,11 @@ avf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->ops = &def_txq_ops;
 
 #ifdef RTE_LIBRTE_AVF_INC_VECTOR
-	if (check_tx_vec_allow(txq) == FALSE)
+	if (check_tx_vec_allow(txq) == FALSE) {
+		struct avf_adapter *ad =
+			AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 		ad->tx_vec_allowed = false;
+	}
 #endif
 
 	return 0;
@@ -1268,7 +1266,6 @@ static inline uint16_t
 rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 {
 	struct avf_rx_queue *rxq = (struct avf_rx_queue *)rx_queue;
-	struct rte_eth_dev *dev;
 	uint16_t nb_rx = 0;
 
 	if (!nb_pkts)
@@ -1584,10 +1581,6 @@ avf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		if (nb_ctx) {
 			/* Setup TX context descriptor if required */
-			volatile struct avf_tx_context_desc *ctx_txd =
-				(volatile struct avf_tx_context_desc *)
-					&txr[tx_id];
-			uint16_t cd_l2tag2 = 0;
 			uint64_t cd_type_cmd_tso_mss =
 				AVF_TX_DESC_DTYPE_CONTEXT;
 
@@ -1603,7 +1596,7 @@ avf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 				cd_type_cmd_tso_mss |=
 					avf_set_tso_ctx(tx_pkt, tx_offload);
 
-			AVF_DUMP_TX_DESC(txq, ctx_txd, tx_id);
+			AVF_DUMP_TX_DESC(txq, &txr[tx_id], tx_id);
 			txe->last_id = tx_last;
 			tx_id = txe->next_id;
 			txe = txn;
drivers/net/avf/avf_vchnl.c +0 -2
index fa71014e1..fd90cc2c3 100644
@@ -69,7 +69,6 @@ avf_execute_vf_cmd(struct avf_adapter *adapter, struct avf_cmd_info *args)
 {
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(adapter);
 	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(adapter);
-	struct avf_arq_event_info event_info;
 	enum avf_status_code ret;
 	int err = 0;
 	int i = 0;
@@ -600,7 +599,6 @@ avf_config_irq_map(struct avf_adapter *adapter)
 	struct virtchnl_irq_map_info *map_info;
 	struct virtchnl_vector_map *vecmap;
 	struct avf_cmd_info args;
-	uint32_t vector_id;
 	int len, i, err;
 
 	len = sizeof(struct virtchnl_irq_map_info) +
Signature · 1 line
2.17.1
#13 lore raw

PATCH v3 2/2 net/avf: fix missing compiler error flags

The AVF driver was missing $(WERROR_FLAGS) in it's cflags, which means that a number of compilation errors were getting missed. This patch adds in the flag and fixes most of the errors, just disabling the strict-aliasing ones.

Fixes 22b123a36d07 ("net/avf: initialize PMD")
Fixes 69dd4c3d0898 ("net/avf: enable queue and device")
Fixes a2b29a7733ef ("net/avf: enable basic Rx Tx")
Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")
---
 drivers/net/avf/Makefile           | 2 +-
 drivers/net/avf/avf_ethdev.c       | 2 +-
 drivers/net/avf/avf_rxtx.h         | 2 +-
 drivers/net/avf/avf_rxtx_vec_sse.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/avf/Makefile +1 -1
index 3f815bbc4..0a142c104 100644
@@ -8,7 +8,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 #
 LIB = librte_pmd_avf.a
 
-CFLAGS += -O3
+CFLAGS += -O3 $(WERROR_FLAGS) -Wno-strict-aliasing
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
 LDLIBS += -lrte_bus_pci
drivers/net/avf/avf_ethdev.c +1 -1
index 6b6ff7d55..549498477 100644
@@ -559,7 +559,7 @@ avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 }
 
 static const uint32_t *
-avf_dev_supported_ptypes_get(struct rte_eth_dev *dev)
+avf_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 {
 	static const uint32_t ptypes[] = {
 		RTE_PTYPE_L2_ETHER,
drivers/net/avf/avf_rxtx.h +1 -1
index 297d0776d..c4120f8a4 100644
@@ -227,7 +227,7 @@ static inline
 void avf_dump_tx_descriptor(const struct avf_tx_queue *txq,
 			    const void *desc, uint16_t tx_id)
 {
-	char *name;
+	const char *name;
 	const struct avf_tx_desc *tx_desc = desc;
 	enum avf_tx_desc_dtype_value type;
 
drivers/net/avf/avf_rxtx_vec_sse.c +1 -1
index 8275100f3..343a6aac3 100644
@@ -621,7 +621,7 @@ avf_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 	return nb_pkts;
 }
 
-void __attribute__((cold))
+static void __attribute__((cold))
 avf_rx_queue_release_mbufs_sse(struct avf_rx_queue *rxq)
 {
 	_avf_rx_queue_release_mbufs_vec(rxq);
Signature · 1 line
2.17.1
#14 lore raw

v4 cover AVF build improvements

In reply to Bruce Richardson

This set adds a number of build improvements for AVF driver. It adds support for building with meson, and adds in the $(WERROR) flags for the make build. To fix both these cases, a number of fixes for compiler warnings are also made.

V4: Including meson build patch into set. Added in missing reviewed and
acked lines from V3.

V3: Added missing fixed line and fixed error due to a removed var

V2: Added in $WERROR flag to make, and expanded set to 2 patches

V1: Original single patch, just removed unused variables/label for meson
build.

Bruce Richardson (2):
net/avf: fix unused variables and label
net/avf: fix missing compiler error flags

Luca Boccassi (1):
build: add Meson files for avf PMD

 drivers/net/avf/Makefile           |  2 +-
 drivers/net/avf/avf_ethdev.c       | 17 ++---------------
 drivers/net/avf/avf_rxtx.c         | 19 ++++++-------------
 drivers/net/avf/avf_rxtx.h         |  2 +-
 drivers/net/avf/avf_rxtx_vec_sse.c |  2 +-
 drivers/net/avf/avf_vchnl.c        |  2 --
 drivers/net/avf/base/meson.build   | 20 ++++++++++++++++++++
 drivers/net/avf/meson.build        | 18 ++++++++++++++++++
 drivers/net/meson.build            |  1 +
 9 files changed, 50 insertions(+), 33 deletions(-)
 create mode 100644 drivers/net/avf/base/meson.build
 create mode 100644 drivers/net/avf/meson.build
Signature · 1 line
2.17.1
#15 lore raw

PATCH v4 1/3 net/avf: fix unused variables and label

Compiling with all warnings turned on causes errors about unused variables and an unused label. Remove these to allow building without having to disable those warnings.

Fixes 69dd4c3d0898 ("net/avf: enable queue and device")
Fixes 3fd7a3719c66 ("net/avf: enable ops for MTU setting")
Fixes d6bde6b5eae9 ("net/avf: enable Rx interrupt")
Fixes 22b123a36d07 ("net/avf: initialize PMD")
Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")
Fixes a2b29a7733ef ("net/avf: enable basic Rx Tx")
Fixes 1060591eada5 ("net/avf: enable bulk allocate Rx")
---
 drivers/net/avf/avf_ethdev.c | 15 +--------------
 drivers/net/avf/avf_rxtx.c   | 19 ++++++-------------
 drivers/net/avf/avf_vchnl.c  |  2 --
 3 files changed, 7 insertions(+), 29 deletions(-)
drivers/net/avf/avf_ethdev.c +1 -14
index a7d69828c..6b6ff7d55 100644
@@ -154,7 +154,6 @@ static int
 avf_init_rss(struct avf_adapter *adapter)
 {
 	struct avf_info *vf =  AVF_DEV_PRIVATE_TO_VF(adapter);
-	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(adapter);
 	struct rte_eth_rss_conf *rss_conf;
 	uint8_t i, j, nb_q;
 	int ret;
@@ -259,11 +258,8 @@ avf_init_rxq(struct rte_eth_dev *dev, struct avf_rx_queue *rxq)
 static int
 avf_init_queues(struct rte_eth_dev *dev)
 {
-	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct avf_rx_queue **rxq =
 		(struct avf_rx_queue **)dev->data->rx_queues;
-	struct avf_tx_queue **txq =
-		(struct avf_tx_queue **)dev->data->tx_queues;
 	int i, ret = AVF_SUCCESS;
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
@@ -415,7 +411,6 @@ avf_dev_start(struct rte_eth_dev *dev)
 		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
 
 	PMD_INIT_FUNC_TRACE();
@@ -476,9 +471,7 @@ avf_dev_stop(struct rte_eth_dev *dev)
 	struct avf_adapter *adapter =
 		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = dev->intr_handle;
-	int ret, i;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -503,8 +496,6 @@ avf_dev_stop(struct rte_eth_dev *dev)
 static void
 avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
-	struct avf_adapter *adapter =
-		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
 	memset(dev_info, 0, sizeof(*dev_info));
@@ -914,7 +905,6 @@ avf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 static int
 avf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
-	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	uint32_t frame_size = mtu + AVF_ETH_OVERHEAD;
 	int ret = 0;
 
@@ -1044,8 +1034,6 @@ avf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 static int
 avf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
 {
-	struct avf_adapter *adapter =
-		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint16_t msix_intr;
@@ -1088,7 +1076,7 @@ avf_check_vf_reset_done(struct avf_hw *hw)
 static int
 avf_init_vf(struct rte_eth_dev *dev)
 {
-	int i, err, bufsz;
+	int err, bufsz;
 	struct avf_adapter *adapter =
 		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1197,7 +1185,6 @@ avf_dev_interrupt_handler(void *param)
 
 	avf_handle_virtchnl_msg(dev);
 
-done:
 	avf_enable_irq0(hw);
 }
 
drivers/net/avf/avf_rxtx.c +6 -13
index e03a136fc..6b3b0191c 100644
@@ -247,7 +247,6 @@ alloc_rxq_mbufs(struct avf_rx_queue *rxq)
 static inline void
 release_rxq_mbufs(struct avf_rx_queue *rxq)
 {
-	struct rte_mbuf *mbuf;
 	uint16_t i;
 
 	if (!rxq->sw_ring)
@@ -310,9 +309,8 @@ avf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	struct avf_rx_queue *rxq;
 	const struct rte_memzone *mz;
 	uint32_t ring_size;
-	uint16_t len, i;
+	uint16_t len;
 	uint16_t rx_free_thresh;
-	uint16_t base, bsf, tc_mapping;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -428,13 +426,10 @@ avf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		       const struct rte_eth_txconf *tx_conf)
 {
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct avf_adapter *ad =
-		AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct avf_tx_queue *txq;
 	const struct rte_memzone *mz;
 	uint32_t ring_size;
 	uint16_t tx_rs_thresh, tx_free_thresh;
-	uint16_t i, base, bsf, tc_mapping;
 	uint64_t offloads;
 
 	PMD_INIT_FUNC_TRACE();
@@ -515,8 +510,11 @@ avf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->ops = &def_txq_ops;
 
 #ifdef RTE_LIBRTE_AVF_INC_VECTOR
-	if (check_tx_vec_allow(txq) == FALSE)
+	if (check_tx_vec_allow(txq) == FALSE) {
+		struct avf_adapter *ad =
+			AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 		ad->tx_vec_allowed = false;
+	}
 #endif
 
 	return 0;
@@ -1268,7 +1266,6 @@ static inline uint16_t
 rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 {
 	struct avf_rx_queue *rxq = (struct avf_rx_queue *)rx_queue;
-	struct rte_eth_dev *dev;
 	uint16_t nb_rx = 0;
 
 	if (!nb_pkts)
@@ -1584,10 +1581,6 @@ avf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		if (nb_ctx) {
 			/* Setup TX context descriptor if required */
-			volatile struct avf_tx_context_desc *ctx_txd =
-				(volatile struct avf_tx_context_desc *)
-					&txr[tx_id];
-			uint16_t cd_l2tag2 = 0;
 			uint64_t cd_type_cmd_tso_mss =
 				AVF_TX_DESC_DTYPE_CONTEXT;
 
@@ -1603,7 +1596,7 @@ avf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 				cd_type_cmd_tso_mss |=
 					avf_set_tso_ctx(tx_pkt, tx_offload);
 
-			AVF_DUMP_TX_DESC(txq, ctx_txd, tx_id);
+			AVF_DUMP_TX_DESC(txq, &txr[tx_id], tx_id);
 			txe->last_id = tx_last;
 			tx_id = txe->next_id;
 			txe = txn;
drivers/net/avf/avf_vchnl.c +0 -2
index fa71014e1..fd90cc2c3 100644
@@ -69,7 +69,6 @@ avf_execute_vf_cmd(struct avf_adapter *adapter, struct avf_cmd_info *args)
 {
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(adapter);
 	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(adapter);
-	struct avf_arq_event_info event_info;
 	enum avf_status_code ret;
 	int err = 0;
 	int i = 0;
@@ -600,7 +599,6 @@ avf_config_irq_map(struct avf_adapter *adapter)
 	struct virtchnl_irq_map_info *map_info;
 	struct virtchnl_vector_map *vecmap;
 	struct avf_cmd_info args;
-	uint32_t vector_id;
 	int len, i, err;
 
 	len = sizeof(struct virtchnl_irq_map_info) +
Signature · 1 line
2.17.1
#16 lore raw

PATCH v4 2/3 net/avf: fix missing compiler error flags

In reply to Bruce Richardson

The AVF driver was missing $(WERROR_FLAGS) in it's cflags, which means that a number of compilation errors were getting missed. This patch adds in the flag and fixes most of the errors, just disabling the strict-aliasing ones.

Fixes 22b123a36d07 ("net/avf: initialize PMD")
Fixes 69dd4c3d0898 ("net/avf: enable queue and device")
Fixes a2b29a7733ef ("net/avf: enable basic Rx Tx")
Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")
---
 drivers/net/avf/Makefile           | 2 +-
 drivers/net/avf/avf_ethdev.c       | 2 +-
 drivers/net/avf/avf_rxtx.h         | 2 +-
 drivers/net/avf/avf_rxtx_vec_sse.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/avf/Makefile +1 -1
index 3f815bbc4..0a142c104 100644
@@ -8,7 +8,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 #
 LIB = librte_pmd_avf.a
 
-CFLAGS += -O3
+CFLAGS += -O3 $(WERROR_FLAGS) -Wno-strict-aliasing
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
 LDLIBS += -lrte_bus_pci
drivers/net/avf/avf_ethdev.c +1 -1
index 6b6ff7d55..549498477 100644
@@ -559,7 +559,7 @@ avf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 }
 
 static const uint32_t *
-avf_dev_supported_ptypes_get(struct rte_eth_dev *dev)
+avf_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 {
 	static const uint32_t ptypes[] = {
 		RTE_PTYPE_L2_ETHER,
drivers/net/avf/avf_rxtx.h +1 -1
index 297d0776d..c4120f8a4 100644
@@ -227,7 +227,7 @@ static inline
 void avf_dump_tx_descriptor(const struct avf_tx_queue *txq,
 			    const void *desc, uint16_t tx_id)
 {
-	char *name;
+	const char *name;
 	const struct avf_tx_desc *tx_desc = desc;
 	enum avf_tx_desc_dtype_value type;
 
drivers/net/avf/avf_rxtx_vec_sse.c +1 -1
index 8275100f3..343a6aac3 100644
@@ -621,7 +621,7 @@ avf_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 	return nb_pkts;
 }
 
-void __attribute__((cold))
+static void __attribute__((cold))
 avf_rx_queue_release_mbufs_sse(struct avf_rx_queue *rxq)
 {
 	_avf_rx_queue_release_mbufs_vec(rxq);
Signature · 1 line
2.17.1
#17 lore raw

PATCH v4 3/3 build: add meson files for AVF PMD

In reply to Bruce Richardson

From: Luca Boccassi <[email protected]>

---
 drivers/net/avf/base/meson.build | 20 ++++++++++++++++++++
 drivers/net/avf/meson.build      | 18 ++++++++++++++++++
 drivers/net/meson.build          |  1 +
 3 files changed, 39 insertions(+)
 create mode 100644 drivers/net/avf/base/meson.build
 create mode 100644 drivers/net/avf/meson.build
drivers/net/avf/base/meson.build new file +20 -0
new file mode 100644
index 000000000..90fd6b445
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Luca Boccassi <[email protected]>
+
+sources = [
+	'avf_adminq.c',
+	'avf_common.c',
+]
+
+error_cflags = ['-Wno-pointer-to-int-cast']
+c_args = cflags
+foreach flag: error_cflags
+	if cc.has_argument(flag)
+		c_args += flag
+	endif
+endforeach
+
+base_lib = static_library('avf_base', sources,
+	dependencies: static_rte_eal,
+	c_args: c_args)
+base_objs = base_lib.extract_all_objects()
drivers/net/avf/meson.build new file +18 -0
new file mode 100644
index 000000000..9a05ebbf4
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Luca Boccassi <[email protected]>
+
+cflags += ['-Wno-strict-aliasing']
+
+subdir('base')
+objs = [base_objs]
+
+sources = files(
+	'avf_ethdev.c',
+	'avf_rxtx.c',
+	'avf_vchnl.c',
+)
+
+if arch_subdir == 'x86'
+	dpdk_conf.set('RTE_LIBRTE_AVF_INC_VECTOR', 1)
+	sources += files('avf_rxtx_vec_sse.c')
+endif
drivers/net/meson.build +1 -0
index 9c28ed4da..bb0da9152 100644
@@ -3,6 +3,7 @@
 
 drivers = ['af_packet',
 	'ark',
+	'avf',
 	'avp',
 	'axgbe', 'bonding',
 	'bnx2x',
Signature · 1 line
2.17.1
Applied
#18 lore raw

Re: [PATCH v4 0/3] AVF build improvements

In reply to Bruce Richardson
Quoted 43 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Wednesday, September 19, 2018 6:04 PM
To: Wu, Jingjing <[email protected]>; Lu, Wenzhuo <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>; Yigit, Ferruh <[email protected]>; Richardson, Bruce <[email protected]>
Subject: [PATCH v4 0/3] AVF build improvements

This set adds a number of build improvements for AVF driver. It adds support for building with meson, and adds in the $(WERROR) flags for the make build. To fix both these cases, a number of fixes for compiler warnings are also made.

V4: Including meson build patch into set. Added in missing reviewed and
acked lines from V3.

V3: Added missing fixed line and fixed error due to a removed var

V2: Added in $WERROR flag to make, and expanded set to 2 patches

V1: Original single patch, just removed unused variables/label for meson
build.

Bruce Richardson (2):
net/avf: fix unused variables and label
net/avf: fix missing compiler error flags

Luca Boccassi (1):
build: add Meson files for avf PMD

 drivers/net/avf/Makefile           |  2 +-
 drivers/net/avf/avf_ethdev.c       | 17 ++---------------
 drivers/net/avf/avf_rxtx.c         | 19 ++++++-------------
 drivers/net/avf/avf_rxtx.h         |  2 +-
 drivers/net/avf/avf_rxtx_vec_sse.c |  2 +-
 drivers/net/avf/avf_vchnl.c        |  2 --
 drivers/net/avf/base/meson.build   | 20 ++++++++++++++++++++
 drivers/net/avf/meson.build        | 18 ++++++++++++++++++
 drivers/net/meson.build            |  1 +
 9 files changed, 50 insertions(+), 33 deletions(-)  create mode 100644
Quoted 5 lines

drivers/net/avf/base/meson.build create mode 100644 drivers/net/avf/meson.build

--
2.17.1

Applied to dpdk-next-net-intel.

Thanks
Qi