diff mbox

[dpdk-dev,v2,1/4] ethdev: rename callbacks field to intr_cbs

Message ID 1423841989-9090-2-git-send-email-john.mcnamara@intel.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Mcnamara, John Feb. 13, 2015, 3:39 p.m. UTC
From: Richardson, Bruce <bruce.richardson@intel.com>

The callbacks member of the rte_eth_dev structure has been renamed
to intr_cbs to make it clear that it refers to callbacks from NIC
interrupts. This then allows us to add other types of callbacks to
the structure without ambiguity.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/virtual_pmd.c                 |    2 +-
 lib/librte_ether/rte_ethdev.c          |   12 ++++++------
 lib/librte_ether/rte_ethdev.h          |    2 +-
 lib/librte_pmd_bond/rte_eth_bond_api.c |    2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

Comments

Thomas Monjalon Feb. 13, 2015, 4:06 p.m. UTC | #1
2015-02-13 15:39, John McNamara:
> From: Richardson, Bruce <bruce.richardson@intel.com>
> 
> The callbacks member of the rte_eth_dev structure has been renamed
> to intr_cbs to make it clear that it refers to callbacks from NIC
> interrupts. This then allows us to add other types of callbacks to
> the structure without ambiguity.

Yes, good.
Actually this callback is used only for link status interrupt, right?
In the patchset for interrupt mode, new callbacks are used, right?
Should we name this callback more precisely?
Thomas Monjalon Feb. 13, 2015, 4:52 p.m. UTC | #2
2015-02-13 17:06, Thomas Monjalon:
> 2015-02-13 15:39, John McNamara:
> > From: Richardson, Bruce <bruce.richardson@intel.com>
> > 
> > The callbacks member of the rte_eth_dev structure has been renamed
> > to intr_cbs to make it clear that it refers to callbacks from NIC
> > interrupts. This then allows us to add other types of callbacks to
> > the structure without ambiguity.
> 
> Yes, good.
> Actually this callback is used only for link status interrupt, right?
> In the patchset for interrupt mode, new callbacks are used, right?
> Should we name this callback more precisely?

More naming considerations:
- The link status interrupt callback could be named link_intr_cb.
- The Rx callback could be named post_rx_burst_cb
- The Tx callback could be named pre_tx_burst_cb
diff mbox

Patch

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 9fac95d..ec2474f 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -576,7 +576,7 @@  virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
 	eth_dev->data->nb_rx_queues = (uint16_t)1;
 	eth_dev->data->nb_tx_queues = (uint16_t)1;
 
-	TAILQ_INIT(&(eth_dev->callbacks));
+	TAILQ_INIT(&(eth_dev->intr_cbs));
 
 	eth_dev->data->dev_link.link_status = 0;
 	eth_dev->data->dev_link.link_speed = ETH_LINK_SPEED_10000;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index ea3a1fb..e4b3315 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -265,7 +265,7 @@  rte_eth_dev_init(struct rte_pci_driver *pci_drv,
 	eth_dev->data->rx_mbuf_alloc_failed = 0;
 
 	/* init user callbacks */
-	TAILQ_INIT(&(eth_dev->callbacks));
+	TAILQ_INIT(&(eth_dev->intr_cbs));
 
 	/*
 	 * Set the default MTU.
@@ -2738,7 +2738,7 @@  rte_eth_dev_callback_register(uint8_t port_id,
 	dev = &rte_eth_devices[port_id];
 	rte_spinlock_lock(&rte_eth_dev_cb_lock);
 
-	TAILQ_FOREACH(user_cb, &(dev->callbacks), next) {
+	TAILQ_FOREACH(user_cb, &(dev->intr_cbs), next) {
 		if (user_cb->cb_fn == cb_fn &&
 			user_cb->cb_arg == cb_arg &&
 			user_cb->event == event) {
@@ -2752,7 +2752,7 @@  rte_eth_dev_callback_register(uint8_t port_id,
 		user_cb->cb_fn = cb_fn;
 		user_cb->cb_arg = cb_arg;
 		user_cb->event = event;
-		TAILQ_INSERT_TAIL(&(dev->callbacks), user_cb, next);
+		TAILQ_INSERT_TAIL(&(dev->intr_cbs), user_cb, next);
 	}
 
 	rte_spinlock_unlock(&rte_eth_dev_cb_lock);
@@ -2779,7 +2779,7 @@  rte_eth_dev_callback_unregister(uint8_t port_id,
 	rte_spinlock_lock(&rte_eth_dev_cb_lock);
 
 	ret = 0;
-	for (cb = TAILQ_FIRST(&dev->callbacks); cb != NULL; cb = next) {
+	for (cb = TAILQ_FIRST(&dev->intr_cbs); cb != NULL; cb = next) {
 
 		next = TAILQ_NEXT(cb, next);
 
@@ -2793,7 +2793,7 @@  rte_eth_dev_callback_unregister(uint8_t port_id,
 		 * then remove it.
 		 */
 		if (cb->active == 0) {
-			TAILQ_REMOVE(&(dev->callbacks), cb, next);
+			TAILQ_REMOVE(&(dev->intr_cbs), cb, next);
 			rte_free(cb);
 		} else {
 			ret = -EAGAIN;
@@ -2812,7 +2812,7 @@  _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
 	struct rte_eth_dev_callback dev_cb;
 
 	rte_spinlock_lock(&rte_eth_dev_cb_lock);
-	TAILQ_FOREACH(cb_lst, &(dev->callbacks), next) {
+	TAILQ_FOREACH(cb_lst, &(dev->intr_cbs), next) {
 		if (cb_lst->cb_fn == NULL || cb_lst->event != event)
 			continue;
 		dev_cb = *cb_lst;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 1200c1c..9c67488 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1538,7 +1538,7 @@  struct rte_eth_dev {
 	const struct eth_driver *driver;/**< Driver for this device */
 	struct eth_dev_ops *dev_ops;    /**< Functions exported by PMD */
 	struct rte_pci_device *pci_dev; /**< PCI info. supplied by probing */
-	struct rte_eth_dev_cb_list callbacks; /**< User application callbacks */
+	struct rte_eth_dev_cb_list intr_cbs; /**< User application callbacks on interrupt*/
 };
 
 struct rte_eth_dev_sriov {
diff --git a/lib/librte_pmd_bond/rte_eth_bond_api.c b/lib/librte_pmd_bond/rte_eth_bond_api.c
index 4ab3267..4a66609 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_api.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_api.c
@@ -251,7 +251,7 @@  rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
 	eth_dev->data->nb_rx_queues = (uint16_t)1;
 	eth_dev->data->nb_tx_queues = (uint16_t)1;
 
-	TAILQ_INIT(&(eth_dev->callbacks));
+	TAILQ_INIT(&(eth_dev->intr_cbs));
 
 	eth_dev->data->dev_link.link_status = 0;