DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/5] vmxnet3: fix all multicast vs promiscious
@ 2014-06-13  1:36 Stephen Hemminger
  2014-06-13  1:38 ` [dpdk-dev] [PATCH 4/5] vmxnet3: add per-queue stats Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephen Hemminger @ 2014-06-13  1:36 UTC (permalink / raw)
  To: dev

The driver was incorrectly enabling/disabling promiscious mode
when it should have be setting/clearing all multicast mode.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c	2014-06-10 15:30:24.000097039 -0700
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c	2014-06-10 15:30:23.996097012 -0700
@@ -708,7 +708,7 @@ static void
 vmxnet3_dev_allmulticast_enable(struct rte_eth_dev *dev)
 {
 	struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 1);
+	vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_ALL_MULTI, 1);
 }
 
 /* Allmulticast supported only if Vmxnet3_DriverShared is initialized in adapter */
@@ -716,7 +716,7 @@ static void
 vmxnet3_dev_allmulticast_disable(struct rte_eth_dev *dev)
 {
 	struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 0);
+	vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_ALL_MULTI, 0);
 }
 
 #if PROCESS_SYS_EVENTS == 1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH 4/5] vmxnet3: add per-queue stats
  2014-06-13  1:36 [dpdk-dev] [PATCH 1/5] vmxnet3: fix all multicast vs promiscious Stephen Hemminger
@ 2014-06-13  1:38 ` Stephen Hemminger
  2014-06-13  1:39 ` [dpdk-dev] [PATCH 5/5] vmxnet3: remove useless adapter wrapper Stephen Hemminger
  2014-07-22 14:53 ` [dpdk-dev] [PATCH 1/5] vmxnet3: fix all multicast vs promiscious Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2014-06-13  1:38 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

Update per-queue statistics and add missing multicast into statistics.
Also, no need to zero statistics since they are already cleared
in rte_stats_get.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

---
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c |   60 +++++++++++++++++---------------
 1 file changed, 32 insertions(+), 28 deletions(-)

--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c	2014-06-12 18:12:14.987836818 -0700
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c	2014-06-12 18:13:35.020257298 -0700
@@ -598,39 +598,43 @@ vmxnet3_dev_stats_get(struct rte_eth_dev
 
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
 
-	stats->opackets = 0;
-	stats->obytes = 0;
-	stats->oerrors = 0;
-	stats->ipackets = 0;
-	stats->ibytes = 0;
-	stats->rx_nombuf = 0;
-	stats->ierrors = 0;
-	stats->imcasts  = 0;
-	stats->fdirmatch = 0;
-	stats->fdirmiss = 0;
-
+	RTE_BUILD_BUG_ON(RTE_ETHDEV_QUEUE_STAT_CNTRS < VMXNET3_MAX_TX_QUEUES);
 	for (i = 0; i < hw->num_tx_queues; i++) {
-		stats->opackets += hw->tqd_start[i].stats.ucastPktsTxOK +
-				hw->tqd_start[i].stats.mcastPktsTxOK +
-				hw->tqd_start[i].stats.bcastPktsTxOK;
-		stats->obytes   += hw->tqd_start[i].stats.ucastBytesTxOK +
-				hw->tqd_start[i].stats.mcastBytesTxOK +
-				hw->tqd_start[i].stats.bcastBytesTxOK;
-		stats->oerrors  += hw->tqd_start[i].stats.pktsTxError +
-				hw->tqd_start[i].stats.pktsTxDiscard;
+		struct UPT1_TxStats *txStats = &hw->tqd_start[i].stats;
+
+		stats->q_opackets[i] = txStats->ucastPktsTxOK +
+			txStats->mcastPktsTxOK +
+			txStats->bcastPktsTxOK;
+		stats->q_obytes[i] = txStats->ucastBytesTxOK +
+			txStats->mcastBytesTxOK +
+			txStats->bcastBytesTxOK;
+
+		stats->opackets += stats->q_opackets[i];
+		stats->obytes += stats->q_obytes[i];
+		stats->oerrors += txStats->pktsTxError +
+			txStats->pktsTxDiscard;
 	}
 
+	RTE_BUILD_BUG_ON(RTE_ETHDEV_QUEUE_STAT_CNTRS < VMXNET3_MAX_RX_QUEUES);
 	for (i = 0; i < hw->num_rx_queues; i++) {
-		stats->ipackets  += hw->rqd_start[i].stats.ucastPktsRxOK +
-				hw->rqd_start[i].stats.mcastPktsRxOK +
-				hw->rqd_start[i].stats.bcastPktsRxOK;
-		stats->ibytes    += hw->rqd_start[i].stats.ucastBytesRxOK +
-				hw->rqd_start[i].stats.mcastBytesRxOK +
-				hw->rqd_start[i].stats.bcastBytesRxOK;
-		stats->rx_nombuf += hw->rqd_start[i].stats.pktsRxOutOfBuf;
-		stats->ierrors   += hw->rqd_start[i].stats.pktsRxError;
-	}
+		struct UPT1_RxStats *rxStats = &hw->rqd_start[i].stats;
 
+		stats->q_ipackets[i] = rxStats->ucastPktsRxOK +
+			rxStats->mcastPktsRxOK +
+			rxStats->bcastPktsRxOK;
+
+		stats->q_ibytes[i] = rxStats->ucastBytesRxOK +
+			rxStats->mcastBytesRxOK +
+			rxStats->bcastBytesRxOK;
+
+		stats->ipackets += stats->q_ipackets[i];
+		stats->ibytes += stats->q_ibytes[i];
+
+		stats->q_errors[i] = rxStats->pktsRxError;
+		stats->ierrors += rxStats->pktsRxError;
+		stats->imcasts += rxStats->mcastPktsRxOK;
+		stats->rx_nombuf += rxStats->pktsRxOutOfBuf;
+	}
 }
 
 static void

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH 5/5] vmxnet3: remove useless adapter wrapper
  2014-06-13  1:36 [dpdk-dev] [PATCH 1/5] vmxnet3: fix all multicast vs promiscious Stephen Hemminger
  2014-06-13  1:38 ` [dpdk-dev] [PATCH 4/5] vmxnet3: add per-queue stats Stephen Hemminger
@ 2014-06-13  1:39 ` Stephen Hemminger
  2014-07-22 14:53 ` [dpdk-dev] [PATCH 1/5] vmxnet3: fix all multicast vs promiscious Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2014-06-13  1:39 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

The adapter struct is just a wrapper around the vmxnet3_hw
structure. Eliminate the wrapper and get rid of the macro
used to access and needlessly cast the private data.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

---
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c |   30 +++++++++++++-----------------
 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h |   10 ----------
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c   |   16 +++++++---------
 3 files changed, 20 insertions(+), 36 deletions(-)

--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c	2014-06-12 18:13:57.408375309 -0700
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c	2014-06-12 18:14:38.736593592 -0700
@@ -186,8 +186,7 @@ eth_vmxnet3_dev_init(__attribute__((unus
 		     struct rte_eth_dev *eth_dev)
 {
 	struct rte_pci_device *pci_dev;
-	struct vmxnet3_hw *hw =
-		VMXNET3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct vmxnet3_hw *hw = eth_dev->data->dev_private;
 	uint32_t mac_hi, mac_lo, ver;
 
 	PMD_INIT_FUNC_TRACE();
@@ -271,7 +270,7 @@ static struct eth_driver rte_vmxnet3_pmd
 		.drv_flags = RTE_PCI_DRV_NEED_IGB_UIO,
 	},
 	.eth_dev_init = eth_vmxnet3_dev_init,
-	.dev_private_size = sizeof(struct vmxnet3_adapter),
+	.dev_private_size = sizeof(struct vmxnet3_hw),
 };
 
 /*
@@ -292,8 +291,7 @@ static int
 vmxnet3_dev_configure(struct rte_eth_dev *dev)
 {
 	const struct rte_memzone *mz;
-	struct vmxnet3_hw *hw =
-		VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 	size_t size;
 
 	PMD_INIT_FUNC_TRACE();
@@ -368,7 +366,7 @@ static int
 vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
 {
 	struct rte_eth_conf port_conf = dev->data->dev_conf;
-	struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 	Vmxnet3_DriverShared *shared = hw->shared;
 	Vmxnet3_DSDevRead *devRead = &shared->devRead;
 	uint32_t *mac_ptr;
@@ -487,7 +485,7 @@ static int
 vmxnet3_dev_start(struct rte_eth_dev *dev)
 {
 	int status, ret;
-	struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -544,8 +542,7 @@ static void
 vmxnet3_dev_stop(struct rte_eth_dev *dev)
 {
 	struct rte_eth_link link;
-	struct vmxnet3_hw *hw =
-		VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -580,8 +577,7 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev
 static void
 vmxnet3_dev_close(struct rte_eth_dev *dev)
 {
-	struct vmxnet3_hw *hw =
-		VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -594,7 +590,7 @@ static void
 vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
 	unsigned int i;
-	struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
 
@@ -651,7 +647,7 @@ vmxnet3_dev_info_get(__attribute__((unus
 static int
 vmxnet3_dev_link_update(struct rte_eth_dev *dev, __attribute__((unused)) int wait_to_complete)
 {
-	struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 	struct rte_eth_link link;
 	uint32_t ret;
 
@@ -694,7 +690,7 @@ vmxnet3_dev_set_rxmode(struct vmxnet3_hw
 static void
 vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
-	struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 
 	vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 1);
 }
@@ -703,7 +699,7 @@ vmxnet3_dev_promiscuous_enable(struct rt
 static void
 vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
-	struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 
 	vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 0);
 }
@@ -712,7 +708,7 @@ vmxnet3_dev_promiscuous_disable(struct r
 static void
 vmxnet3_dev_allmulticast_enable(struct rte_eth_dev *dev)
 {
-	struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 
 	vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_ALL_MULTI, 1);
 }
@@ -721,7 +717,7 @@ vmxnet3_dev_allmulticast_enable(struct r
 static void
 vmxnet3_dev_allmulticast_disable(struct rte_eth_dev *dev)
 {
-	struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 
 	vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_ALL_MULTI, 0);
 }
--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h	2014-06-12 18:13:57.408375309 -0700
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h	2014-06-12 18:13:57.404375287 -0700
@@ -117,16 +117,6 @@ struct vmxnet3_hw {
 	vmxnet3_mf_table_t   *mf_table;
 };
 
-/*
- * Structure to store private data for each driver instance (for each port).
- */
-struct vmxnet3_adapter {
-	struct vmxnet3_hw              hw;
-};
-
-#define VMXNET3_DEV_PRIVATE_TO_HW(adapter)\
-	(&((struct vmxnet3_adapter *)adapter)->hw)
-
 #define VMXNET3_GET_ADDR_LO(reg)   ((uint32_t)(reg))
 #define VMXNET3_GET_ADDR_HI(reg)   ((uint32_t)(((uint64_t)(reg)) >> 32))
 
--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c	2014-06-12 18:13:57.408375309 -0700
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c	2014-06-12 18:13:57.404375287 -0700
@@ -628,15 +628,14 @@ vmxnet3_dev_tx_queue_setup(struct rte_et
 			   unsigned int socket_id,
 			   __attribute__((unused)) const struct rte_eth_txconf *tx_conf)
 {
+	struct vmxnet3_hw     *hw = dev->data->dev_private;
 	const struct rte_memzone *mz;
 	struct vmxnet3_tx_queue *txq;
-	struct vmxnet3_hw     *hw;
 	struct vmxnet3_cmd_ring *ring;
 	struct vmxnet3_comp_ring *comp_ring;
 	int size;
 
 	PMD_INIT_FUNC_TRACE();
-	hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	if ((tx_conf->txq_flags & ETH_TXQ_FLAGS_NOMULTSEGS) !=
 	    ETH_TXQ_FLAGS_NOMULTSEGS) {
@@ -731,7 +730,7 @@ vmxnet3_dev_rx_queue_setup(struct rte_et
 {
 	const struct rte_memzone *mz;
 	struct vmxnet3_rx_queue *rxq;
-	struct vmxnet3_hw     *hw;
+	struct vmxnet3_hw     *hw = dev->data->dev_private;
 	struct vmxnet3_cmd_ring *ring0, *ring1, *ring;
 	struct vmxnet3_comp_ring *comp_ring;
 	int size;
@@ -741,7 +740,6 @@ vmxnet3_dev_rx_queue_setup(struct rte_et
 	struct rte_pktmbuf_pool_private *mbp_priv;
 
 	PMD_INIT_FUNC_TRACE();
-	hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	mbp_priv = (struct rte_pktmbuf_pool_private *)
 		rte_mempool_get_priv(mp);
@@ -849,12 +847,12 @@ vmxnet3_dev_rx_queue_setup(struct rte_et
 int
 vmxnet3_dev_rxtx_init(struct rte_eth_dev *dev)
 {
-	struct vmxnet3_hw *hw;
+	struct vmxnet3_hw *hw = dev->data->dev_private;
+
 	int i, ret;
 	uint8_t j;
 
 	PMD_INIT_FUNC_TRACE();
-	hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	for (i = 0; i < hw->num_rx_queues; i++) {
 		vmxnet3_rx_queue_t *rxq = dev->data->rx_queues[i];
@@ -898,13 +896,13 @@ static uint8_t rss_intel_key[40] = {
 int
 vmxnet3_rss_configure(struct rte_eth_dev *dev)
 {
-	struct vmxnet3_hw *hw;
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 	struct VMXNET3_RSSConf *dev_rss_conf;
 	struct rte_eth_rss_conf *port_rss_conf;
 	uint8_t i, j;
 
 	PMD_INIT_FUNC_TRACE();
-	hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
 	dev_rss_conf = hw->rss_conf;
 	port_rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf;
 
@@ -951,7 +949,7 @@ int
 vmxnet3_vlan_configure(struct rte_eth_dev *dev)
 {
 	uint8_t i;
-	struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct vmxnet3_hw *hw = dev->data->dev_private;
 	uint32_t *vf_table = hw->shared->devRead.rxFilterConf.vfTable;
 
 	PMD_INIT_FUNC_TRACE();

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH 1/5] vmxnet3: fix all multicast vs promiscious
  2014-06-13  1:36 [dpdk-dev] [PATCH 1/5] vmxnet3: fix all multicast vs promiscious Stephen Hemminger
  2014-06-13  1:38 ` [dpdk-dev] [PATCH 4/5] vmxnet3: add per-queue stats Stephen Hemminger
  2014-06-13  1:39 ` [dpdk-dev] [PATCH 5/5] vmxnet3: remove useless adapter wrapper Stephen Hemminger
@ 2014-07-22 14:53 ` Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2014-07-22 14:53 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Serie acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Applied for version 1.7.1.

Stephen, do you plan to merge the Brocade's version of vmxnet3?

Thanks
-- 
Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-22 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-13  1:36 [dpdk-dev] [PATCH 1/5] vmxnet3: fix all multicast vs promiscious Stephen Hemminger
2014-06-13  1:38 ` [dpdk-dev] [PATCH 4/5] vmxnet3: add per-queue stats Stephen Hemminger
2014-06-13  1:39 ` [dpdk-dev] [PATCH 5/5] vmxnet3: remove useless adapter wrapper Stephen Hemminger
2014-07-22 14:53 ` [dpdk-dev] [PATCH 1/5] vmxnet3: fix all multicast vs promiscious Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).