DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: remove useless parameter in callback process
@ 2017-11-28 22:09 Thomas Monjalon
  2017-12-22  3:08 ` Ferruh Yigit
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2017-11-28 22:09 UTC (permalink / raw)
  To: dev; +Cc: bernard.iremonger

The pointer to the user parameter of the callback registration is
automatically pass to the callback function.
There is no point to allow changing this user parameter by a caller.
That's why this parameter is always set to NULL by PMDs and set only
in ethdev layer before calling the callback function.

The NULL parameter in the internal callback processing function
is now removed. It makes clear that the callback parameter is user
managed and opaque from a DPDK point of view.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 doc/guides/prog_guide/poll_mode_drv.rst | 4 ++--
 drivers/net/bnxt/rte_pmd_bnxt.c         | 2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c  | 6 +++---
 drivers/net/dpaa2/dpaa2_ethdev.c        | 2 +-
 drivers/net/e1000/em_ethdev.c           | 2 +-
 drivers/net/e1000/igb_ethdev.c          | 4 ++--
 drivers/net/enic/enic_main.c            | 2 +-
 drivers/net/failsafe/failsafe_ether.c   | 2 +-
 drivers/net/fm10k/fm10k_ethdev.c        | 8 ++++----
 drivers/net/i40e/i40e_ethdev.c          | 2 +-
 drivers/net/i40e/i40e_ethdev_vf.c       | 2 +-
 drivers/net/i40e/i40e_pf.c              | 3 +--
 drivers/net/ixgbe/ixgbe_ethdev.c        | 6 +++---
 drivers/net/ixgbe/ixgbe_pf.c            | 4 ++--
 drivers/net/mlx4/mlx4_intr.c            | 4 ++--
 drivers/net/mlx5/mlx5_ethdev.c          | 9 +++------
 drivers/net/nfp/nfp_net.c               | 2 +-
 drivers/net/sfc/sfc_intr.c              | 4 ++--
 drivers/net/thunderx/nicvf_ethdev.c     | 2 +-
 drivers/net/vhost/rte_eth_vhost.c       | 9 +++------
 drivers/net/virtio/virtio_ethdev.c      | 2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c    | 2 +-
 lib/librte_ether/rte_ethdev.c           | 4 +---
 lib/librte_ether/rte_ethdev.h           | 4 +---
 test/test/virtual_pmd.c                 | 2 +-
 25 files changed, 41 insertions(+), 52 deletions(-)

diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst
index 6a0c9f992..d1d4b1cb7 100644
--- a/doc/guides/prog_guide/poll_mode_drv.rst
+++ b/doc/guides/prog_guide/poll_mode_drv.rst
@@ -581,8 +581,8 @@ thread safety all these operations should be called from the same thread.
 For example when PF is reset, the PF sends a message to notify VFs of
 this event and also trigger an interrupt to VFs. Then in the interrupt
 service routine the VFs detects this notification message and calls
-_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL,
-NULL). This means that a PF reset triggers an RTE_ETH_EVENT_INTR_RESET
+_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL).
+This means that a PF reset triggers an RTE_ETH_EVENT_INTR_RESET
 event within VFs. The function _rte_eth_dev_callback_process() will
 call the registered callback function. The callback function can trigger
 the application to handle all operations the VF reset requires including
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index a31340742..e86e670dc 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -57,7 +57,7 @@ int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg)
 	ret_param.msg = msg;
 
 	_rte_eth_dev_callback_process(bp->eth_dev, RTE_ETH_EVENT_VF_MBOX,
-				      NULL, &ret_param);
+				      &ret_param);
 
 	/* Default to approve */
 	if (ret_param.retval == RTE_PMD_BNXT_MB_EVENT_PROCEED)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index fe2328954..68952c4c0 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2476,7 +2476,7 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
 		return;
 
 	_rte_eth_dev_callback_process((struct rte_eth_dev *)arg,
-			RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
+			RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 int
@@ -2584,7 +2584,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,
 			else
 				_rte_eth_dev_callback_process(bonded_eth_dev,
 						RTE_ETH_EVENT_INTR_LSC,
-						NULL, NULL);
+						NULL);
 
 		} else {
 			if (internals->link_down_delay_ms > 0)
@@ -2594,7 +2594,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,
 			else
 				_rte_eth_dev_callback_process(bonded_eth_dev,
 						RTE_ETH_EVENT_INTR_LSC,
-						NULL, NULL);
+						NULL);
 		}
 	}
 	return 0;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 202f84f0a..b302bbb7b 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -655,7 +655,7 @@ dpaa2_interrupt_handler(void *param)
 		dpaa2_dev_link_update(dev, 0);
 		/* calling all the apps registered for link status event */
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 	}
 out:
 	ret = dpni_clear_irq_status(dpni, CMD_PRI_LOW, priv->token,
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index a0c3b4dc5..d9fafca8c 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1678,7 +1678,7 @@ eth_em_interrupt_handler(void *param)
 
 	eth_em_interrupt_get_status(dev);
 	eth_em_interrupt_action(dev, dev->intr_handle);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index fdc139f35..ad4c0865a 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2916,7 +2916,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev,
 		E1000_WRITE_REG(hw, E1000_RCTL, rctl);
 		E1000_WRITE_FLUSH(hw);
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 	}
 
 	return 0;
@@ -2976,7 +2976,7 @@ void igbvf_mbx_process(struct rte_eth_dev *dev)
 	/* PF reset VF event */
 	if (in_msg == E1000_PF_CONTROL_MSG)
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
-					      NULL, NULL);
+					      NULL);
 }
 
 static int
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 8af0ccd3c..a9509f068 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -434,7 +434,7 @@ enic_intr_handler(void *arg)
 	vnic_intr_return_all_credits(&enic->intr);
 
 	enic_link_update(enic);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	enic_log_q_error(enic);
 }
 
diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c
index 21392e5a7..8a4cacf4a 100644
--- a/drivers/net/failsafe/failsafe_ether.c
+++ b/drivers/net/failsafe/failsafe_ether.c
@@ -480,7 +480,7 @@ failsafe_eth_lsc_event_callback(uint16_t port_id __rte_unused,
 	if (ret)
 		return _rte_eth_dev_callback_process(dev,
 						     RTE_ETH_EVENT_INTR_LSC,
-						     NULL, NULL);
+						     NULL);
 	else
 		return 0;
 }
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 2d05a4669..3cd30b854 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2625,7 +2625,7 @@ fm10k_dev_interrupt_handler_pf(void *param)
 			dev_info->sm_down = 0;
 			_rte_eth_dev_callback_process(dev,
 					RTE_ETH_EVENT_INTR_LSC,
-					NULL, NULL);
+					NULL);
 		}
 	}
 
@@ -2638,7 +2638,7 @@ fm10k_dev_interrupt_handler_pf(void *param)
 		PMD_INIT_LOG(INFO, "INT: Switch is down");
 		dev_info->sm_down = 1;
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-				NULL, NULL);
+				NULL);
 	}
 
 	/* Handle SRAM error */
@@ -2706,7 +2706,7 @@ fm10k_dev_interrupt_handler_vf(void *param)
 		/* Setting reset flag */
 		dev_info->sm_down = 1;
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-				NULL, NULL);
+				NULL);
 	}
 
 	if (dev_info->sm_down == 1 &&
@@ -2735,7 +2735,7 @@ fm10k_dev_interrupt_handler_vf(void *param)
 
 		dev_info->sm_down = 0;
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-				NULL, NULL);
+				NULL);
 	}
 
 	/* Re-enable interrupt from device side */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 811cc9ffe..0fe6eeacc 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5996,7 +5996,7 @@ i40e_dev_handle_aq_msg(struct rte_eth_dev *dev)
 			ret = i40e_dev_link_update(dev, 0);
 			if (!ret)
 				_rte_eth_dev_callback_process(dev,
-					RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
+					RTE_ETH_EVENT_INTR_LSC, NULL);
 			break;
 		default:
 			PMD_DRV_LOG(DEBUG, "Request %u is not supported yet",
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 91b5bb033..74473d267 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1308,7 +1308,7 @@ i40evf_handle_pf_event(struct rte_eth_dev *dev, uint8_t *msg,
 	case VIRTCHNL_EVENT_RESET_IMPENDING:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event");
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
-					      NULL, NULL);
+					      NULL);
 		break;
 	case VIRTCHNL_EVENT_LINK_CHANGE:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event");
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 94bb0cfd1..322396368 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -1185,8 +1185,7 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 	 * do nothing and send not_supported to VF. As PF must send a response
 	 * to VF and ACK/NACK is not defined.
 	 */
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX,
-				      NULL, &ret_param);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &ret_param);
 	if (ret_param.retval != RTE_PMD_I40E_MB_EVENT_PROCEED) {
 		PMD_DRV_LOG(WARNING, "VF to PF message(%d) is not permitted!",
 			    opcode);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index ff19a564a..6dbda9c7d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4383,12 +4383,12 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
 		intr->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE;
 		ixgbe_dev_link_status_print(dev);
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 	}
 
 	if (intr->flags & IXGBE_FLAG_MACSEC) {
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_MACSEC,
-					      NULL, NULL);
+					      NULL);
 		intr->flags &= ~IXGBE_FLAG_MACSEC;
 	}
 
@@ -8171,7 +8171,7 @@ static void ixgbevf_mbx_process(struct rte_eth_dev *dev)
 	/* PF reset VF event */
 	if (in_msg == IXGBE_PF_CONTROL_MSG)
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
-					      NULL, NULL);
+					      NULL);
 }
 
 static int
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 676e92c7b..e18ec8660 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -768,7 +768,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 
 		/* notify application about VF reset */
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX,
-					      NULL, &ret_param);
+					      &ret_param);
 		return ret;
 	}
 
@@ -780,7 +780,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 	 * if ret_param.retval > 1, do nothing and send NAK to VF
 	 */
 	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX,
-				      NULL, &ret_param);
+				      &ret_param);
 
 	retval = ret_param.retval;
 
diff --git a/drivers/net/mlx4/mlx4_intr.c b/drivers/net/mlx4/mlx4_intr.c
index 50d197698..9becee4a8 100644
--- a/drivers/net/mlx4/mlx4_intr.c
+++ b/drivers/net/mlx4/mlx4_intr.c
@@ -154,7 +154,7 @@ mlx4_link_status_alarm(struct priv *priv)
 	if (intr_conf->lsc && !mlx4_link_status_check(priv))
 		_rte_eth_dev_callback_process(priv->dev,
 					      RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 }
 
 /**
@@ -236,7 +236,7 @@ mlx4_interrupt_handler(struct priv *priv)
 	for (i = 0; i != RTE_DIM(caught); ++i)
 		if (caught[i])
 			_rte_eth_dev_callback_process(priv->dev, type[i],
-						      NULL, NULL);
+						      NULL);
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index a3cef6891..62474ab1c 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1230,8 +1230,7 @@ mlx5_dev_link_status_handler(void *arg)
 	ret = priv_link_status_update(priv);
 	priv_unlock(priv);
 	if (!ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL,
-					      NULL);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
@@ -1253,11 +1252,9 @@ mlx5_dev_interrupt_handler(void *cb_arg)
 	events = priv_dev_status_handler(priv);
 	priv_unlock(priv);
 	if (events & (1 << RTE_ETH_EVENT_INTR_LSC))
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL,
-					      NULL);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	if (events & (1 << RTE_ETH_EVENT_INTR_RMV))
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RMV, NULL,
-					      NULL);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RMV, NULL);
 }
 
 /**
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 0501156ba..99b6aa65e 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1450,7 +1450,7 @@ nfp_net_dev_interrupt_delayed_handler(void *param)
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	nfp_net_link_update(dev, 0);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	nfp_net_dev_link_status_print(dev);
 
diff --git a/drivers/net/sfc/sfc_intr.c b/drivers/net/sfc/sfc_intr.c
index ee59cb1c0..aa324c4b6 100644
--- a/drivers/net/sfc/sfc_intr.c
+++ b/drivers/net/sfc/sfc_intr.c
@@ -112,7 +112,7 @@ sfc_intr_line_handler(void *cb_arg)
 			 "UP" : "DOWN");
 		_rte_eth_dev_callback_process(sa->eth_dev,
 					      RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 	}
 }
 
@@ -154,7 +154,7 @@ sfc_intr_message_handler(void *cb_arg)
 		sfc_info(sa, "link status change event");
 		_rte_eth_dev_callback_process(sa->eth_dev,
 					      RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 	}
 }
 
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index d65d3cee7..5cead831b 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -113,7 +113,7 @@ nicvf_interrupt(void *arg)
 		if (dev->data->dev_conf.intr_conf.lsc)
 			nicvf_set_eth_link_status(nic, &dev->data->dev_link);
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 	}
 
 	rte_eal_alarm_set(NICVF_INTR_POLL_INTERVAL_MS * 1000,
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 2536ee4a2..014428580 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -609,8 +609,7 @@ new_device(int vid)
 
 	RTE_LOG(INFO, PMD, "New connection established\n");
 
-	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC,
-				      NULL, NULL);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	return 0;
 }
@@ -664,8 +663,7 @@ destroy_device(int vid)
 
 	RTE_LOG(INFO, PMD, "Connection closed\n");
 
-	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC,
-				      NULL, NULL);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int
@@ -694,8 +692,7 @@ vring_state_changed(int vid, uint16_t vring, int enable)
 	RTE_LOG(INFO, PMD, "vring%u is %s\n",
 			vring, enable ? "enabled" : "disabled");
 
-	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE,
-				      NULL, NULL);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE, NULL);
 
 	return 0;
 }
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index e0328f61d..4290d59a5 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1266,7 +1266,7 @@ virtio_interrupt_handler(void *param)
 		if (virtio_dev_link_update(dev, 0) == 0)
 			_rte_eth_dev_callback_process(dev,
 						      RTE_ETH_EVENT_INTR_LSC,
-						      NULL, NULL);
+						      NULL);
 	}
 
 }
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 82d59ca8c..54b688f2f 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -1332,7 +1332,7 @@ vmxnet3_process_events(struct rte_eth_dev *dev)
 		if (vmxnet3_dev_link_update(dev, 0) == 0)
 			_rte_eth_dev_callback_process(dev,
 						      RTE_ETH_EVENT_INTR_LSC,
-						      NULL, NULL);
+						      NULL);
 	}
 
 	/* Check if there is an error on xmit/recv queues */
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 318af2869..c196c3692 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2905,7 +2905,7 @@ rte_eth_dev_callback_unregister(uint16_t port_id,
 
 int
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-	enum rte_eth_event_type event, void *cb_arg, void *ret_param)
+	enum rte_eth_event_type event, void *ret_param)
 {
 	struct rte_eth_dev_callback *cb_lst;
 	struct rte_eth_dev_callback dev_cb;
@@ -2917,8 +2917,6 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
 			continue;
 		dev_cb = *cb_lst;
 		cb_lst->active = 1;
-		if (cb_arg != NULL)
-			dev_cb.cb_arg = cb_arg;
 		if (ret_param != NULL)
 			dev_cb.ret_param = ret_param;
 
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 341c2d624..15309aa7c 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -3585,8 +3585,6 @@ int rte_eth_dev_callback_unregister(uint16_t port_id,
  *  Pointer to struct rte_eth_dev.
  * @param event
  *  Eth device interrupt event type.
- * @param cb_arg
- *  callback parameter.
  * @param ret_param
  *  To pass data back to user application.
  *  This allows the user application to decide if a particular function
@@ -3596,7 +3594,7 @@ int rte_eth_dev_callback_unregister(uint16_t port_id,
  *  int
  */
 int _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-		enum rte_eth_event_type event, void *cb_arg, void *ret_param);
+		enum rte_eth_event_type event, void *ret_param);
 
 /**
  * When there is no rx packet coming in Rx Queue for a long time, we can
diff --git a/test/test/virtual_pmd.c b/test/test/virtual_pmd.c
index b57a9493b..f55288537 100644
--- a/test/test/virtual_pmd.c
+++ b/test/test/virtual_pmd.c
@@ -489,7 +489,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint16_t port_id,
 	vrtl_eth_dev->data->dev_link.link_status = link_status;
 
 	_rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC,
-				      NULL, NULL);
+				      NULL);
 }
 
 int
-- 
2.15.0

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

* Re: [dpdk-dev] [PATCH] ethdev: remove useless parameter in callback process
  2017-11-28 22:09 [dpdk-dev] [PATCH] ethdev: remove useless parameter in callback process Thomas Monjalon
@ 2017-12-22  3:08 ` Ferruh Yigit
  2017-12-28 21:54   ` Thomas Monjalon
  2017-12-28 22:10   ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
  0 siblings, 2 replies; 6+ messages in thread
From: Ferruh Yigit @ 2017-12-22  3:08 UTC (permalink / raw)
  To: Thomas Monjalon, dev; +Cc: bernard.iremonger

On 11/28/2017 2:09 PM, Thomas Monjalon wrote:
> The pointer to the user parameter of the callback registration is
> automatically pass to the callback function.
> There is no point to allow changing this user parameter by a caller.
> That's why this parameter is always set to NULL by PMDs and set only
> in ethdev layer before calling the callback function.

It can be helpful to mention a little from history:

user cb_arg overwrite introduced by [1], to enable driver pass a pointer to user
callback function and carry some information back from app to driver.

Later to prevent usage of cb_arg as both input and output, an explicit output
(ret_param) added [2] to _rte_eth_dev_callback_process() but previous cb_arg
overwriting kept without any user.

[1]: c1ceaf3ad056 ("ethdev: add an argument to internal callback function")

[2]: d6af1a13d7a1 ("ethdev: add return values to callback process API")

> 
> The NULL parameter in the internal callback processing function
> is now removed. It makes clear that the callback parameter is user
> managed and opaque from a DPDK point of view.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

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

* Re: [dpdk-dev] [PATCH] ethdev: remove useless parameter in callback process
  2017-12-22  3:08 ` Ferruh Yigit
@ 2017-12-28 21:54   ` Thomas Monjalon
  2017-12-28 21:56     ` Thomas Monjalon
  2017-12-28 22:10   ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2017-12-28 21:54 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit, bernard.iremonger

22/12/2017 04:08, Ferruh Yigit:
> On 11/28/2017 2:09 PM, Thomas Monjalon wrote:
> > The pointer to the user parameter of the callback registration is
> > automatically pass to the callback function.
> > There is no point to allow changing this user parameter by a caller.
> > That's why this parameter is always set to NULL by PMDs and set only
> > in ethdev layer before calling the callback function.
> 
> It can be helpful to mention a little from history:
> 
> user cb_arg overwrite introduced by [1], to enable driver pass a pointer to user
> callback function and carry some information back from app to driver.
> 
> Later to prevent usage of cb_arg as both input and output, an explicit output
> (ret_param) added [2] to _rte_eth_dev_callback_process() but previous cb_arg
> overwriting kept without any user.
> 
> [1]: c1ceaf3ad056 ("ethdev: add an argument to internal callback function")
> 
> [2]: d6af1a13d7a1 ("ethdev: add return values to callback process API")
> 
> > 
> > The NULL parameter in the internal callback processing function
> > is now removed. It makes clear that the callback parameter is user
> > managed and opaque from a DPDK point of view.
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied

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

* Re: [dpdk-dev] [PATCH] ethdev: remove useless parameter in callback process
  2017-12-28 21:54   ` Thomas Monjalon
@ 2017-12-28 21:56     ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2017-12-28 21:56 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: bernard.iremonger

28/12/2017 22:54, Thomas Monjalon:
> 22/12/2017 04:08, Ferruh Yigit:
> > On 11/28/2017 2:09 PM, Thomas Monjalon wrote:
> > > The pointer to the user parameter of the callback registration is
> > > automatically pass to the callback function.
> > > There is no point to allow changing this user parameter by a caller.
> > > That's why this parameter is always set to NULL by PMDs and set only
> > > in ethdev layer before calling the callback function.
> > 
> > It can be helpful to mention a little from history:
> > 
> > user cb_arg overwrite introduced by [1], to enable driver pass a pointer to user
> > callback function and carry some information back from app to driver.
> > 
> > Later to prevent usage of cb_arg as both input and output, an explicit output
> > (ret_param) added [2] to _rte_eth_dev_callback_process() but previous cb_arg
> > overwriting kept without any user.
> > 
> > [1]: c1ceaf3ad056 ("ethdev: add an argument to internal callback function")
> > 
> > [2]: d6af1a13d7a1 ("ethdev: add return values to callback process API")
> > 
> > > 
> > > The NULL parameter in the internal callback processing function
> > > is now removed. It makes clear that the callback parameter is user
> > > managed and opaque from a DPDK point of view.
> > > 
> > > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > 
> > Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> Applied

Sorry, not applied (should be applied on next-net).

I will send a v2 with a more detailed explanation.

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

* [dpdk-dev] [PATCH v2] ethdev: remove useless parameter in callback process
  2017-12-22  3:08 ` Ferruh Yigit
  2017-12-28 21:54   ` Thomas Monjalon
@ 2017-12-28 22:10   ` Thomas Monjalon
  2017-12-29 13:29     ` Thomas Monjalon
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2017-12-28 22:10 UTC (permalink / raw)
  To: dev; +Cc: bernard.iremonger, ferruh.yigit

The pointer to the user parameter of the callback registration is
automatically pass to the callback function.
There is no point to allow changing this user parameter by a caller.
That's why this parameter is always set to NULL by PMDs and set only
in ethdev layer before calling the callback function.

The history is that the user parameter was initially used
by the callback implementation to pass some information
between the application and the driver:
	c1ceaf3ad056 ("ethdev: add an argument to internal callback function")
Then a new parameter has been added to leave the user parameter
to its standard usage of context given at registration:
	d6af1a13d7a1 ("ethdev: add return values to callback process API")

The NULL parameter in the internal callback processing function
is now removed. It makes clear that the callback parameter is user
managed and opaque from a DPDK point of view.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2: add history explanation
---
 doc/guides/prog_guide/poll_mode_drv.rst | 4 ++--
 drivers/net/bnxt/rte_pmd_bnxt.c         | 2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c  | 6 +++---
 drivers/net/dpaa2/dpaa2_ethdev.c        | 2 +-
 drivers/net/e1000/em_ethdev.c           | 2 +-
 drivers/net/e1000/igb_ethdev.c          | 4 ++--
 drivers/net/enic/enic_main.c            | 2 +-
 drivers/net/failsafe/failsafe_ether.c   | 2 +-
 drivers/net/fm10k/fm10k_ethdev.c        | 8 ++++----
 drivers/net/i40e/i40e_ethdev.c          | 2 +-
 drivers/net/i40e/i40e_ethdev_vf.c       | 2 +-
 drivers/net/i40e/i40e_pf.c              | 3 +--
 drivers/net/ixgbe/ixgbe_ethdev.c        | 6 +++---
 drivers/net/ixgbe/ixgbe_pf.c            | 4 ++--
 drivers/net/mlx4/mlx4_intr.c            | 4 ++--
 drivers/net/mlx5/mlx5_ethdev.c          | 9 +++------
 drivers/net/nfp/nfp_net.c               | 2 +-
 drivers/net/sfc/sfc_intr.c              | 4 ++--
 drivers/net/thunderx/nicvf_ethdev.c     | 2 +-
 drivers/net/vhost/rte_eth_vhost.c       | 9 +++------
 drivers/net/virtio/virtio_ethdev.c      | 2 +-
 drivers/net/vmxnet3/vmxnet3_ethdev.c    | 2 +-
 lib/librte_ether/rte_ethdev.c           | 4 +---
 lib/librte_ether/rte_ethdev.h           | 4 +---
 test/test/virtual_pmd.c                 | 2 +-
 25 files changed, 41 insertions(+), 52 deletions(-)

diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst
index 6a0c9f992..d1d4b1cb7 100644
--- a/doc/guides/prog_guide/poll_mode_drv.rst
+++ b/doc/guides/prog_guide/poll_mode_drv.rst
@@ -581,8 +581,8 @@ thread safety all these operations should be called from the same thread.
 For example when PF is reset, the PF sends a message to notify VFs of
 this event and also trigger an interrupt to VFs. Then in the interrupt
 service routine the VFs detects this notification message and calls
-_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL,
-NULL). This means that a PF reset triggers an RTE_ETH_EVENT_INTR_RESET
+_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL).
+This means that a PF reset triggers an RTE_ETH_EVENT_INTR_RESET
 event within VFs. The function _rte_eth_dev_callback_process() will
 call the registered callback function. The callback function can trigger
 the application to handle all operations the VF reset requires including
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index a31340742..e86e670dc 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -57,7 +57,7 @@ int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg)
 	ret_param.msg = msg;
 
 	_rte_eth_dev_callback_process(bp->eth_dev, RTE_ETH_EVENT_VF_MBOX,
-				      NULL, &ret_param);
+				      &ret_param);
 
 	/* Default to approve */
 	if (ret_param.retval == RTE_PMD_BNXT_MB_EVENT_PROCEED)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index fe2328954..68952c4c0 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2476,7 +2476,7 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
 		return;
 
 	_rte_eth_dev_callback_process((struct rte_eth_dev *)arg,
-			RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
+			RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 int
@@ -2584,7 +2584,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,
 			else
 				_rte_eth_dev_callback_process(bonded_eth_dev,
 						RTE_ETH_EVENT_INTR_LSC,
-						NULL, NULL);
+						NULL);
 
 		} else {
 			if (internals->link_down_delay_ms > 0)
@@ -2594,7 +2594,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,
 			else
 				_rte_eth_dev_callback_process(bonded_eth_dev,
 						RTE_ETH_EVENT_INTR_LSC,
-						NULL, NULL);
+						NULL);
 		}
 	}
 	return 0;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 202f84f0a..b302bbb7b 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -655,7 +655,7 @@ dpaa2_interrupt_handler(void *param)
 		dpaa2_dev_link_update(dev, 0);
 		/* calling all the apps registered for link status event */
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 	}
 out:
 	ret = dpni_clear_irq_status(dpni, CMD_PRI_LOW, priv->token,
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index a0c3b4dc5..d9fafca8c 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1678,7 +1678,7 @@ eth_em_interrupt_handler(void *param)
 
 	eth_em_interrupt_get_status(dev);
 	eth_em_interrupt_action(dev, dev->intr_handle);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index fdc139f35..ad4c0865a 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2916,7 +2916,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev,
 		E1000_WRITE_REG(hw, E1000_RCTL, rctl);
 		E1000_WRITE_FLUSH(hw);
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 	}
 
 	return 0;
@@ -2976,7 +2976,7 @@ void igbvf_mbx_process(struct rte_eth_dev *dev)
 	/* PF reset VF event */
 	if (in_msg == E1000_PF_CONTROL_MSG)
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
-					      NULL, NULL);
+					      NULL);
 }
 
 static int
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 8af0ccd3c..a9509f068 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -434,7 +434,7 @@ enic_intr_handler(void *arg)
 	vnic_intr_return_all_credits(&enic->intr);
 
 	enic_link_update(enic);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	enic_log_q_error(enic);
 }
 
diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c
index 21392e5a7..8a4cacf4a 100644
--- a/drivers/net/failsafe/failsafe_ether.c
+++ b/drivers/net/failsafe/failsafe_ether.c
@@ -480,7 +480,7 @@ failsafe_eth_lsc_event_callback(uint16_t port_id __rte_unused,
 	if (ret)
 		return _rte_eth_dev_callback_process(dev,
 						     RTE_ETH_EVENT_INTR_LSC,
-						     NULL, NULL);
+						     NULL);
 	else
 		return 0;
 }
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 2d05a4669..3cd30b854 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2625,7 +2625,7 @@ fm10k_dev_interrupt_handler_pf(void *param)
 			dev_info->sm_down = 0;
 			_rte_eth_dev_callback_process(dev,
 					RTE_ETH_EVENT_INTR_LSC,
-					NULL, NULL);
+					NULL);
 		}
 	}
 
@@ -2638,7 +2638,7 @@ fm10k_dev_interrupt_handler_pf(void *param)
 		PMD_INIT_LOG(INFO, "INT: Switch is down");
 		dev_info->sm_down = 1;
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-				NULL, NULL);
+				NULL);
 	}
 
 	/* Handle SRAM error */
@@ -2706,7 +2706,7 @@ fm10k_dev_interrupt_handler_vf(void *param)
 		/* Setting reset flag */
 		dev_info->sm_down = 1;
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-				NULL, NULL);
+				NULL);
 	}
 
 	if (dev_info->sm_down == 1 &&
@@ -2735,7 +2735,7 @@ fm10k_dev_interrupt_handler_vf(void *param)
 
 		dev_info->sm_down = 0;
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-				NULL, NULL);
+				NULL);
 	}
 
 	/* Re-enable interrupt from device side */
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 811cc9ffe..0fe6eeacc 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5996,7 +5996,7 @@ i40e_dev_handle_aq_msg(struct rte_eth_dev *dev)
 			ret = i40e_dev_link_update(dev, 0);
 			if (!ret)
 				_rte_eth_dev_callback_process(dev,
-					RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
+					RTE_ETH_EVENT_INTR_LSC, NULL);
 			break;
 		default:
 			PMD_DRV_LOG(DEBUG, "Request %u is not supported yet",
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 91b5bb033..74473d267 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1308,7 +1308,7 @@ i40evf_handle_pf_event(struct rte_eth_dev *dev, uint8_t *msg,
 	case VIRTCHNL_EVENT_RESET_IMPENDING:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event");
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
-					      NULL, NULL);
+					      NULL);
 		break;
 	case VIRTCHNL_EVENT_LINK_CHANGE:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event");
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 94bb0cfd1..322396368 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -1185,8 +1185,7 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
 	 * do nothing and send not_supported to VF. As PF must send a response
 	 * to VF and ACK/NACK is not defined.
 	 */
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX,
-				      NULL, &ret_param);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &ret_param);
 	if (ret_param.retval != RTE_PMD_I40E_MB_EVENT_PROCEED) {
 		PMD_DRV_LOG(WARNING, "VF to PF message(%d) is not permitted!",
 			    opcode);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index ff19a564a..6dbda9c7d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4383,12 +4383,12 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
 		intr->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE;
 		ixgbe_dev_link_status_print(dev);
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 	}
 
 	if (intr->flags & IXGBE_FLAG_MACSEC) {
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_MACSEC,
-					      NULL, NULL);
+					      NULL);
 		intr->flags &= ~IXGBE_FLAG_MACSEC;
 	}
 
@@ -8171,7 +8171,7 @@ static void ixgbevf_mbx_process(struct rte_eth_dev *dev)
 	/* PF reset VF event */
 	if (in_msg == IXGBE_PF_CONTROL_MSG)
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
-					      NULL, NULL);
+					      NULL);
 }
 
 static int
diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 676e92c7b..e18ec8660 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -768,7 +768,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 
 		/* notify application about VF reset */
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX,
-					      NULL, &ret_param);
+					      &ret_param);
 		return ret;
 	}
 
@@ -780,7 +780,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 	 * if ret_param.retval > 1, do nothing and send NAK to VF
 	 */
 	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX,
-				      NULL, &ret_param);
+				      &ret_param);
 
 	retval = ret_param.retval;
 
diff --git a/drivers/net/mlx4/mlx4_intr.c b/drivers/net/mlx4/mlx4_intr.c
index 50d197698..9becee4a8 100644
--- a/drivers/net/mlx4/mlx4_intr.c
+++ b/drivers/net/mlx4/mlx4_intr.c
@@ -154,7 +154,7 @@ mlx4_link_status_alarm(struct priv *priv)
 	if (intr_conf->lsc && !mlx4_link_status_check(priv))
 		_rte_eth_dev_callback_process(priv->dev,
 					      RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 }
 
 /**
@@ -236,7 +236,7 @@ mlx4_interrupt_handler(struct priv *priv)
 	for (i = 0; i != RTE_DIM(caught); ++i)
 		if (caught[i])
 			_rte_eth_dev_callback_process(priv->dev, type[i],
-						      NULL, NULL);
+						      NULL);
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index a3cef6891..62474ab1c 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1230,8 +1230,7 @@ mlx5_dev_link_status_handler(void *arg)
 	ret = priv_link_status_update(priv);
 	priv_unlock(priv);
 	if (!ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL,
-					      NULL);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
@@ -1253,11 +1252,9 @@ mlx5_dev_interrupt_handler(void *cb_arg)
 	events = priv_dev_status_handler(priv);
 	priv_unlock(priv);
 	if (events & (1 << RTE_ETH_EVENT_INTR_LSC))
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL,
-					      NULL);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	if (events & (1 << RTE_ETH_EVENT_INTR_RMV))
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RMV, NULL,
-					      NULL);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RMV, NULL);
 }
 
 /**
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 0501156ba..99b6aa65e 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1450,7 +1450,7 @@ nfp_net_dev_interrupt_delayed_handler(void *param)
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	nfp_net_link_update(dev, 0);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	nfp_net_dev_link_status_print(dev);
 
diff --git a/drivers/net/sfc/sfc_intr.c b/drivers/net/sfc/sfc_intr.c
index ee59cb1c0..aa324c4b6 100644
--- a/drivers/net/sfc/sfc_intr.c
+++ b/drivers/net/sfc/sfc_intr.c
@@ -112,7 +112,7 @@ sfc_intr_line_handler(void *cb_arg)
 			 "UP" : "DOWN");
 		_rte_eth_dev_callback_process(sa->eth_dev,
 					      RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 	}
 }
 
@@ -154,7 +154,7 @@ sfc_intr_message_handler(void *cb_arg)
 		sfc_info(sa, "link status change event");
 		_rte_eth_dev_callback_process(sa->eth_dev,
 					      RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 	}
 }
 
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index d65d3cee7..5cead831b 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -113,7 +113,7 @@ nicvf_interrupt(void *arg)
 		if (dev->data->dev_conf.intr_conf.lsc)
 			nicvf_set_eth_link_status(nic, &dev->data->dev_link);
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
-					      NULL, NULL);
+					      NULL);
 	}
 
 	rte_eal_alarm_set(NICVF_INTR_POLL_INTERVAL_MS * 1000,
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 2536ee4a2..014428580 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -609,8 +609,7 @@ new_device(int vid)
 
 	RTE_LOG(INFO, PMD, "New connection established\n");
 
-	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC,
-				      NULL, NULL);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	return 0;
 }
@@ -664,8 +663,7 @@ destroy_device(int vid)
 
 	RTE_LOG(INFO, PMD, "Connection closed\n");
 
-	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC,
-				      NULL, NULL);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int
@@ -694,8 +692,7 @@ vring_state_changed(int vid, uint16_t vring, int enable)
 	RTE_LOG(INFO, PMD, "vring%u is %s\n",
 			vring, enable ? "enabled" : "disabled");
 
-	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE,
-				      NULL, NULL);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE, NULL);
 
 	return 0;
 }
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index e0328f61d..4290d59a5 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1266,7 +1266,7 @@ virtio_interrupt_handler(void *param)
 		if (virtio_dev_link_update(dev, 0) == 0)
 			_rte_eth_dev_callback_process(dev,
 						      RTE_ETH_EVENT_INTR_LSC,
-						      NULL, NULL);
+						      NULL);
 	}
 
 }
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 82d59ca8c..54b688f2f 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -1332,7 +1332,7 @@ vmxnet3_process_events(struct rte_eth_dev *dev)
 		if (vmxnet3_dev_link_update(dev, 0) == 0)
 			_rte_eth_dev_callback_process(dev,
 						      RTE_ETH_EVENT_INTR_LSC,
-						      NULL, NULL);
+						      NULL);
 	}
 
 	/* Check if there is an error on xmit/recv queues */
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 318af2869..c196c3692 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2905,7 +2905,7 @@ rte_eth_dev_callback_unregister(uint16_t port_id,
 
 int
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-	enum rte_eth_event_type event, void *cb_arg, void *ret_param)
+	enum rte_eth_event_type event, void *ret_param)
 {
 	struct rte_eth_dev_callback *cb_lst;
 	struct rte_eth_dev_callback dev_cb;
@@ -2917,8 +2917,6 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
 			continue;
 		dev_cb = *cb_lst;
 		cb_lst->active = 1;
-		if (cb_arg != NULL)
-			dev_cb.cb_arg = cb_arg;
 		if (ret_param != NULL)
 			dev_cb.ret_param = ret_param;
 
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 341c2d624..15309aa7c 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -3585,8 +3585,6 @@ int rte_eth_dev_callback_unregister(uint16_t port_id,
  *  Pointer to struct rte_eth_dev.
  * @param event
  *  Eth device interrupt event type.
- * @param cb_arg
- *  callback parameter.
  * @param ret_param
  *  To pass data back to user application.
  *  This allows the user application to decide if a particular function
@@ -3596,7 +3594,7 @@ int rte_eth_dev_callback_unregister(uint16_t port_id,
  *  int
  */
 int _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-		enum rte_eth_event_type event, void *cb_arg, void *ret_param);
+		enum rte_eth_event_type event, void *ret_param);
 
 /**
  * When there is no rx packet coming in Rx Queue for a long time, we can
diff --git a/test/test/virtual_pmd.c b/test/test/virtual_pmd.c
index b57a9493b..f55288537 100644
--- a/test/test/virtual_pmd.c
+++ b/test/test/virtual_pmd.c
@@ -489,7 +489,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint16_t port_id,
 	vrtl_eth_dev->data->dev_link.link_status = link_status;
 
 	_rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC,
-				      NULL, NULL);
+				      NULL);
 }
 
 int
-- 
2.15.1

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

* Re: [dpdk-dev] [PATCH v2] ethdev: remove useless parameter in callback process
  2017-12-28 22:10   ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
@ 2017-12-29 13:29     ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2017-12-29 13:29 UTC (permalink / raw)
  To: dev; +Cc: bernard.iremonger, ferruh.yigit

28/12/2017 23:10, Thomas Monjalon:
> The pointer to the user parameter of the callback registration is
> automatically pass to the callback function.
> There is no point to allow changing this user parameter by a caller.
> That's why this parameter is always set to NULL by PMDs and set only
> in ethdev layer before calling the callback function.
> 
> The history is that the user parameter was initially used
> by the callback implementation to pass some information
> between the application and the driver:
> 	c1ceaf3ad056 ("ethdev: add an argument to internal callback function")
> Then a new parameter has been added to leave the user parameter
> to its standard usage of context given at registration:
> 	d6af1a13d7a1 ("ethdev: add return values to callback process API")
> 
> The NULL parameter in the internal callback processing function
> is now removed. It makes clear that the callback parameter is user
> managed and opaque from a DPDK point of view.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> v2: add history explanation

This patch is now part of the patchset v3 for new ethdev notifications.

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

end of thread, other threads:[~2017-12-29 13:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28 22:09 [dpdk-dev] [PATCH] ethdev: remove useless parameter in callback process Thomas Monjalon
2017-12-22  3:08 ` Ferruh Yigit
2017-12-28 21:54   ` Thomas Monjalon
2017-12-28 21:56     ` Thomas Monjalon
2017-12-28 22:10   ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2017-12-29 13:29     ` 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).