DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tomasz Kulasek <tomaszx.kulasek@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 3/3] PMD Ring - Fix for MAC per device management
Date: Mon, 19 Jan 2015 12:56:41 +0100	[thread overview]
Message-ID: <1421668601-156-4-git-send-email-tomaszx.kulasek@intel.com> (raw)
In-Reply-To: <1421668601-156-1-git-send-email-tomaszx.kulasek@intel.com>

Initialization procedure fix to allow per device MAC configuration.

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
---
 lib/librte_pmd_ring/rte_eth_ring.c |   30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c
index 91e1964..b6047cc 100644
--- a/lib/librte_pmd_ring/rte_eth_ring.c
+++ b/lib/librte_pmd_ring/rte_eth_ring.c
@@ -44,6 +44,8 @@
 #define ETH_RING_ACTION_CREATE		"CREATE"
 #define ETH_RING_ACTION_ATTACH		"ATTACH"
 
+static const char *ring_ethdev_driver_name = "Ring PMD";
+
 static const char *valid_arguments[] = {
 	ETH_RING_NUMA_NODE_ACTION_ARG,
 	NULL
@@ -62,10 +64,11 @@ struct pmd_internals {
 
 	struct ring_queue rx_ring_queues[RTE_PMD_RING_MAX_RX_RINGS];
 	struct ring_queue tx_ring_queues[RTE_PMD_RING_MAX_TX_RINGS];
+
+	struct ether_addr address;
 };
 
 
-static struct ether_addr eth_addr = { .addr_bytes = {0} };
 static const char *drivername = "Rings PMD";
 static struct rte_eth_link pmd_link = {
 		.link_speed = 10000,
@@ -261,6 +264,9 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 	struct rte_pci_device *pci_dev = NULL;
 	struct pmd_internals *internals = NULL;
 	struct rte_eth_dev *eth_dev = NULL;
+	struct eth_driver *eth_drv = NULL;
+	struct rte_pci_id *id_table = NULL;
+
 	unsigned i;
 
 	/* do some parameter checking */
@@ -283,6 +289,10 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 	if (pci_dev == NULL)
 		goto error;
 
+	id_table = rte_zmalloc_socket(name, sizeof(*id_table), 0, numa_node);
+	if (id_table == NULL)
+		goto error;
+
 	internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
 	if (internals == NULL)
 		goto error;
@@ -292,6 +302,10 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 	if (eth_dev == NULL)
 		goto error;
 
+	eth_drv = rte_zmalloc_socket(name, sizeof(*eth_drv), 0, numa_node);
+	if (eth_drv == NULL)
+		goto error;
+
 	/* now put it all together
 	 * - store queue data in internals,
 	 * - store numa_node info in pci_driver
@@ -310,18 +324,24 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 		internals->tx_ring_queues[i].rng = tx_queues[i];
 	}
 
+	eth_drv->pci_drv.name = ring_ethdev_driver_name;
+	eth_drv->pci_drv.id_table = id_table;
+
 	pci_dev->numa_node = numa_node;
+	pci_dev->driver = &eth_drv->pci_drv;
 
 	data->dev_private = internals;
 	data->port_id = eth_dev->data->port_id;
 	data->nb_rx_queues = (uint16_t)nb_rx_queues;
 	data->nb_tx_queues = (uint16_t)nb_tx_queues;
 	data->dev_link = pmd_link;
-	data->mac_addrs = &eth_addr;
+	data->mac_addrs = &internals->address;
 
-	eth_dev ->data = data;
-	eth_dev ->dev_ops = &ops;
-	eth_dev ->pci_dev = pci_dev;
+	eth_dev->data = data;
+	eth_dev->driver = eth_drv;
+	eth_dev->dev_ops = &ops;
+	eth_dev->pci_dev = pci_dev;
+	TAILQ_INIT(&(eth_dev->callbacks));
 
 	/* finally assign rx and tx ops */
 	eth_dev->rx_pkt_burst = eth_ring_rx;
-- 
1.7.9.5

  parent reply	other threads:[~2015-01-19 12:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-12  9:14 [dpdk-dev] [PATCH 0/3] bond mode 4: add unit tests Michal Jastrzebski
2014-12-12  9:14 ` [dpdk-dev] [PATCH 1/3] bond change warning Michal Jastrzebski
2015-02-18 18:06   ` Thomas Monjalon
2014-12-12  9:14 ` [dpdk-dev] [PATCH 2/3] PMD ring MAC management, fix initialization, link up/down Michal Jastrzebski
2015-01-15 10:53   ` Thomas Monjalon
2015-01-19 11:56   ` [dpdk-dev] [PATCH v2 0/3] " Tomasz Kulasek
2015-01-19 11:56     ` [dpdk-dev] [PATCH v2 1/3] PMD Ring - Add link up/down functions Tomasz Kulasek
2015-01-19 11:56     ` [dpdk-dev] [PATCH v2 2/3] PMD Ring - Add MAC addr add/remove functions Tomasz Kulasek
2015-01-19 11:56     ` Tomasz Kulasek [this message]
2015-01-28 11:56     ` [dpdk-dev] [PATCH v2 0/3] PMD ring MAC management, fix initialization, link up/down Doherty, Declan
2015-02-18 17:33       ` Thomas Monjalon
2014-12-12  9:14 ` [dpdk-dev] [PATCH 3/3] unit tests add mode 4 unit test Michal Jastrzebski
2015-01-15 10:55   ` Thomas Monjalon
2015-01-19 12:43   ` [dpdk-dev] [PATCH v2 0/2] " Tomasz Kulasek
2015-01-19 12:43     ` [dpdk-dev] [PATCH v2 1/2] Unit tests - test.h rework Tomasz Kulasek
2015-01-19 12:43     ` [dpdk-dev] [PATCH v2 2/2] Unit tests for mode 4 Tomasz Kulasek
2015-01-29  8:51     ` [dpdk-dev] [PATCH v3 0/3] " Tomasz Kulasek
2015-01-29  8:51       ` [dpdk-dev] [PATCH v3 1/3] test: test.h rework Tomasz Kulasek
2015-01-29  8:51       ` [dpdk-dev] [PATCH v3 2/3] test: Unit tests for mode 4 Tomasz Kulasek
2015-02-12 11:49         ` Declan Doherty
2015-01-29  8:51       ` [dpdk-dev] [PATCH v3] mk: Link test app against librte_pmd_ring when needed Tomasz Kulasek
2015-02-12 11:50         ` Declan Doherty
2015-02-13 10:38       ` [dpdk-dev] [PATCH v4 0/4] Unit tests for mode 4 Tomasz Kulasek
2015-02-13 10:38         ` [dpdk-dev] [PATCH v4 1/4] test: test.h rework Tomasz Kulasek
2015-02-13 10:38         ` [dpdk-dev] [PATCH v4 2/4] test: Unit tests for mode 4 Tomasz Kulasek
2015-02-13 10:38         ` [dpdk-dev] [PATCH v4 3/4] mk: Link test app against librte_pmd_ring when needed Tomasz Kulasek
2015-02-13 10:38         ` [dpdk-dev] [PATCH v4 4/4] pmd_bond: Set routines required by test app global Tomasz Kulasek
2015-02-13 11:08         ` [dpdk-dev] [PATCH v4 0/4] Unit tests for mode 4 Declan Doherty
2015-02-18 18:00           ` Thomas Monjalon
2014-12-12 15:27 ` [dpdk-dev] [PATCH 0/3] bond mode 4: add unit tests Doherty, Declan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421668601-156-4-git-send-email-tomaszx.kulasek@intel.com \
    --to=tomaszx.kulasek@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).