Skip to contentSkip to conversation

add callbacks for VF management

PATCH Superseded Bernard Iremonger 4 participants 64 messages Sep 30, 2016 – Oct 14, 2016

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

v3 cover add callbacks for VF management

This patchset contains new callback functions requested by AT&T for use with the Virtual Function Daemon (VFD).

Two new callback functions have been added.
Changes have been made to the ixgbe_rcv_msg_from_vf function to use the callback functions.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16296/
[dpdk-dev,v6,1/2] net/ixgbe: add API's for VF management

These patches were part of the RFC PATCH v2 of the above patchset, but were dropped from the v3 patchset.

Changes in v3:
rebase to latest master
submitted as a seperate patchset.
Moved the response enums from the ethdev to the ixgbe PMD.

Bernard Iremonger (2):
librte_ether: add internal callback functions net/ixgbe: add callback to user app on VF to PF mbox msg

 drivers/net/ixgbe/ixgbe_pf.c           | 42 ++++++++++++++++++++++++----
 drivers/net/ixgbe/rte_pmd_ixgbe.h      | 11 ++++++++
 lib/librte_ether/rte_ethdev.c          | 17 ++++++++++++
 lib/librte_ether/rte_ethdev.h          | 51 ++++++++++++++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  7 +++++
 5 files changed, 122 insertions(+), 6 deletions(-)
Signature · 1 line
2.9.0
#1 lore raw

PATCH v3 1/2 librte_ether: add internal callback functions

add _rte_eth_dev_callback_process_vf function. add _rte_eth_dev_callback_process_generic function

Adding a callback to the user application on VF to PF mailbox message, allows passing information to the application controlling the PF when a VF mailbox event message is received, such as VF reset.

---
 lib/librte_ether/rte_ethdev.c          | 17 ++++++++++++
 lib/librte_ether/rte_ethdev.h          | 51 ++++++++++++++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  7 +++++
 3 files changed, 75 insertions(+)
lib/librte_ether/rte_ethdev.c +17 -0
index 382c959..6d93fcf 100644
@@ -2689,6 +2689,20 @@ void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
 	enum rte_eth_event_type event)
 {
+	return _rte_eth_dev_callback_process_generic(dev, event, NULL);
+}
+
+void
+_rte_eth_dev_callback_process_vf(struct rte_eth_dev *dev,
+	enum rte_eth_event_type event, void *param)
+{
+	return _rte_eth_dev_callback_process_generic(dev, event, param);
+}
+
+void
+_rte_eth_dev_callback_process_generic(struct rte_eth_dev *dev,
+	enum rte_eth_event_type event, void *param)
+{
 	struct rte_eth_dev_callback *cb_lst;
 	struct rte_eth_dev_callback dev_cb;
 
@@ -2698,6 +2712,9 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
 			continue;
 		dev_cb = *cb_lst;
 		cb_lst->active = 1;
+		if (param != NULL)
+			dev_cb.cb_arg = (void *) param;
+
 		rte_spinlock_unlock(&rte_eth_dev_cb_lock);
 		dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
 						dev_cb.cb_arg);
lib/librte_ether/rte_ethdev.h +51 -0

66 lines not on this page · raw message

lib/librte_ether/rte_ether_version.map +7 -0
index 45ddf44..cb7ef15 100644
@@ -139,3 +139,10 @@ DPDK_16.07 {
 	rte_eth_dev_get_port_by_name;
 	rte_eth_xstats_get_names;
 } DPDK_16.04;
+
+DPDK_16.11 {
+	global:
+
+	_rte_eth_dev_callback_process_generic;
+	_rte_eth_dev_callback_process_vf;
+} DPDK_16.07;
Signature · 1 line
2.9.0
#2 lore raw

Re: [PATCH v3 1/2] librte_ether: add internal callback functions

I know callbacks are needed, in fact even more are necessary. That is why I don't like this design. It expands the API for each event. I think something like the Linux kernel netlink callback mechanism that passes an event and device handle.

#3 lore raw

Re: [PATCH v3 1/2] librte_ether: add internal callback functions

Hi Stephen,

From: Stephen Hemminger [mailto:[email protected]]
Sent: Sunday, October 2, 2016 10:13 AM
To: Iremonger, Bernard <[email protected]>
Cc: [email protected]; Lu, Wenzhuo <[email protected]>; [email protected]; [email protected]; Shah, Rahul R <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 1/2] librte_ether: add internal callback functions

I know callbacks are needed, in fact even more are necessary. That is why I don't like this design. It expands the API for each event. I think something like the Linux kernel netlink callback mechanism that passes an event and device handle.

The current rte_eth_dev_callback_register() function takes a parameter void *cb_arg. This allows the passing of a parameter to the callback. For the events RTE_ETH_EVENT_QUEUE_STATE, RTE_ETH_EVENT_INTR_RESET the callback parameter is not used. In some cases for the RTE_ETH_EVENT_INTR_LSC the call back parameter is used.

This patch adds a new event RTE_ETH_VF_MBOX and a parameter for this event struct rte_eth_mb_event_param{}. This parameter is only used with the RTE_ETH_VF_MBOX event and does not affect the other events.

The struct rte_eth_mb_event_param{} should probably not be in rte_eth_dev.h, I will send a v4.

Regards,

Bernard.

#4 lore raw

PATCH v3 2/2 net/ixgbe: add callback to user app on VF to PF mbox msg

In reply to Bernard Iremonger

call _rte_eth_dev_callback_process_vf from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform the function.
If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue, if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

---
 drivers/net/ixgbe/ixgbe_pf.c      | 42 +++++++++++++++++++++++++++++++++------
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 11 ++++++++++
 2 files changed, 47 insertions(+), 6 deletions(-)
drivers/net/ixgbe/ixgbe_pf.c +36 -6
index 56393ff..3c5bf38 100644
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,7 @@
 
 #include "base/ixgbe_common.h"
 #include "ixgbe_ethdev.h"
+#include "rte_pmd_ixgbe.h"
 
 #define IXGBE_MAX_VFTA     (128)
 #define IXGBE_VF_MSG_SIZE_DEFAULT 1
@@ -660,6 +661,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ixgbe_vf_info *vfinfo =
 		*IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+	struct rte_eth_mb_event_param cb_param;
 
 	retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
 	if (retval) {
@@ -674,27 +676,54 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 	/* flush the ack before we write any messages back */
 	IXGBE_WRITE_FLUSH(hw);
 
+	/**
+	 * initialise structure to send to user application
+	 * will return response from user in retval field
+	 */
+	cb_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
+	cb_param.vfid = vf;
+	cb_param.msg_type = msgbuf[0] & 0xFFFF;
+	cb_param.userdata = (void *)msgbuf;
+
 	/* perform VF reset */
 	if (msgbuf[0] == IXGBE_VF_RESET) {
 		int ret = ixgbe_vf_reset(dev, vf, msgbuf);
 
 		vfinfo[vf].clear_to_send = true;
+
+		/* notify application about VF reset */
+		_rte_eth_dev_callback_process_vf(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
 		return ret;
 	}
 
+	/**
+	 * ask user application if we allowed to perform those functions
+	 * if we get cb_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED then business
+	 * as usual,
+	 * if 0, do nothing and send ACK to VF
+	 * if cb_param.retval > 1, do nothing and send NAK to VF
+	 */
+	_rte_eth_dev_callback_process_vf(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
+
+	retval = cb_param.retval;
+
 	/* check & process VF to PF mailbox message */
 	switch ((msgbuf[0] & 0xFFFF)) {
 	case IXGBE_VF_SET_MAC_ADDR:
-		retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_SET_MULTICAST:
-		retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_SET_LPE:
-		retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_SET_VLAN:
-		retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_API_NEGOTIATE:
 		retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
@@ -704,7 +733,8 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 		msg_size = IXGBE_VF_GET_QUEUE_MSG_SIZE;
 		break;
 	case IXGBE_VF_UPDATE_XCAST_MODE:
-		retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
 		break;
 	default:
 		PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);
drivers/net/ixgbe/rte_pmd_ixgbe.h +11 -0
index 33b5b2d..212cc5d 100644
@@ -181,4 +181,15 @@ int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on);
  */
 int
 rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
+
+/**
+ * Response sent back to ixgbe driver from user app after callback
+ */
+enum rte_pmd_ixgbe_mb_event_rsp {
+	RTE_PMD_IXGBE_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+	RTE_PMD_IXGBE_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+	RTE_PMD_IXGBE_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+	RTE_PMD_IXGBE_MB_EVENT_MAX       /**< max value of this enum */
+};
+
 #endif /* _PMD_IXGBE_H_ */
Signature · 1 line
2.9.0
#5 lore raw

v4 cover add callbacks for VF management

In reply to Bernard Iremonger

This patchset contains new callback functions intended for VF management.

Two new callback functions have been added.
Changes have been made to the ixgbe_rcv_msg_from_vf function to use the callback functions.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16296/
[dpdk-dev,v6,1/2] net/ixgbe: add API's for VF management

These patches were part of the RFC PATCH v2 of the above patchset, but were dropped from the v3 patchset.

Changes in v4:
Rebased to latest master.
Moved the callback parameter structure from the ethdev to the ixgbe PMD.

Changes in v3:
Rebased to latest master.
Submitted as a seperate patchset.
Moved the response enums from the ethdev to the ixgbe PMD.

Changes in v2:
Rebased to latest master.

Bernard Iremonger (2):
librte_ether: add internal callback functions net/ixgbe: add callback to user app on VF to PF mbox msg

 drivers/net/ixgbe/ixgbe_pf.c           | 42 +++++++++++++++++++++++++++-----
 drivers/net/ixgbe/rte_pmd_ixgbe.h      | 17 +++++++++++++
 lib/librte_ether/rte_ethdev.c          | 17 +++++++++++++
 lib/librte_ether/rte_ethdev.h          | 44 ++++++++++++++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  2 ++
 5 files changed, 116 insertions(+), 6 deletions(-)
Signature · 1 line
2.9.0
#6 lore raw

v5 cover modify callback for VF management

This patchset modifies the callback function for VF management.

A third parameter has been added to the _rte_eth_dev_callback_process function. All references to this function have been updated. Changes have been made to the ixgbe_rcv_msg_from_vf function to use the new callback parameter.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16296/
[dpdk-dev,v6,1/2] net/ixgbe: add API's for VF management

These patches were part of the RFC PATCH v2 of the above patchset, but were dropped from the v3 patchset.

Changes in v5:
Rebased to latest master.
Added parameter to the _rte_eth_dev_callback_process function Removed two new callback functions which were added previously. Updated all calls to the _rte_eth_dev_callback_process function.

Changes in v4:
Rebased to latest master.
Moved the callback parameter structure from the ethdev to the ixgbe PMD.

Changes in v3:
Rebased to latest master.
Submitted as a seperate patchset.
Moved the response enums from the ethdev to the ixgbe PMD.

Changes in v2:
Rebased to latest master.

Bernard Iremonger (13):
librte_ether: modify internal callback function net/ixgbe: add callback to user app on VF to PF mbox msg app/test: add parameter to callback process function net/bonding: add parameter to callback process function net/e1000: add parameter to callback process function net/i40e: update call to callback process function net/mlx4: add parameter to callback process function net/mlx5: add parameter to callback process function net/nfp: add parameter to callback process function net/thunderx: add parameter to callback process function net/vhost: add parameter to callback process function net/virtio: add parameter to callback process function net/enic: add parameter to callback process function

 app/test/virtual_pmd.c                 |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 ++---
 drivers/net/e1000/em_ethdev.c          |  2 +-
 drivers/net/e1000/igb_ethdev.c         |  4 ++--
 drivers/net/enic/enic_main.c           |  2 +-
 drivers/net/i40e/i40e_ethdev.c         |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c      |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c           | 42 +++++++++++++++++++++++++++++-----
 drivers/net/ixgbe/rte_pmd_ixgbe.h      | 17 ++++++++++++++
 drivers/net/mlx4/mlx4.c                |  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c         |  4 ++--
 drivers/net/nfp/nfp_net.c              |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c    |  2 +-
 drivers/net/vhost/rte_eth_vhost.c      |  6 ++---
 drivers/net/virtio/virtio_ethdev.c     |  2 +-
 lib/librte_ether/rte_ethdev.c          |  5 +++-
 lib/librte_ether/rte_ethdev.h          |  7 +++++-
 18 files changed, 86 insertions(+), 31 deletions(-)
Signature · 1 line
2.9.0
#7 lore raw

v6 cover modify callback for VF management

This patchset modifies the callback function for VF management.

A third parameter has been added to the _rte_eth_dev_callback_process function. All references to this function have been updated. Changes have been made to the ixgbe_rcv_msg_from_vf function to use the new callback parameter.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16296/
[dpdk-dev,v6,1/2] net/ixgbe: add API's for VF management

These patches were part of the RFC PATCH v2 of the above patchset, but were dropped from the v3 patchset.

Changes in v5:
Rebased to latest master.
Squashed patches down to two patches.
Renamed parameter to _rte_eth_dev_callback_process function. Updated API descriptions.

Changes in v5:
Rebased to latest master.
Added parameter to the _rte_eth_dev_callback_process function Removed two new callback functions which were added previously. Updated all calls to the _rte_eth_dev_callback_process function.

Changes in v4:
Rebased to latest master.
Moved the callback parameter structure from the ethdev to the ixgbe PMD.

Changes in v3:
Rebased to latest master.
Submitted as a seperate patchset.
Moved the response enums from the ethdev to the ixgbe PMD.

Changes in v2:
Rebased to latest master.

Bernard Iremonger (2):
librte_ether: modify internal callback function net/ixgbe: add callback to user app on VF to PF mbox msg

 app/test/virtual_pmd.c                 |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 ++---
 drivers/net/e1000/em_ethdev.c          |  2 +-
 drivers/net/e1000/igb_ethdev.c         |  4 ++--
 drivers/net/enic/enic_main.c           |  2 +-
 drivers/net/i40e/i40e_ethdev.c         |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c      |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c           | 42 +++++++++++++++++++++++++++++-----
 drivers/net/ixgbe/rte_pmd_ixgbe.h      | 17 ++++++++++++++
 drivers/net/mlx4/mlx4.c                |  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c         |  4 ++--
 drivers/net/nfp/nfp_net.c              |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c    |  2 +-
 drivers/net/vhost/rte_eth_vhost.c      |  6 ++---
 drivers/net/virtio/virtio_ethdev.c     |  2 +-
 lib/librte_ether/rte_ethdev.c          |  5 +++-
 lib/librte_ether/rte_ethdev.h          | 12 +++++++++-
 18 files changed, 91 insertions(+), 31 deletions(-)
Signature · 1 line
2.9.0
#8 lore raw

v7 cover modify callback for VF management

This patchset modifies the callback function for VF management.

A third parameter has been added to the _rte_eth_dev_callback_process function. All references to this function have been updated. Changes have been made to the ixgbe_rcv_msg_from_vf function to use the new callback parameter.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16430/
[dpdk-dev,v7,1/2] net/ixgbe: add API's for VF management

These patches were part of the RFC PATCH v2 of the above patchset, but were dropped from the v3 patchset.

Changes in v7:
Rebased to latest master.
Move references to _rte_eth_dev_callback_process in ixgbe patch to librte_ether patch.
Revised description of callback parameter.

Changes in v6:
Rebased to latest master.
Squashed patches down to two patches.
Renamed parameter to _rte_eth_dev_callback_process function. Updated API descriptions.

Changes in v5:
Rebased to latest master.
Added parameter to the _rte_eth_dev_callback_process function Removed two new callback functions which were added previously. Updated all calls to the _rte_eth_dev_callback_process function.

Changes in v4:
Rebased to latest master.
Moved the callback parameter structure from the ethdev to the ixgbe PMD.

Changes in v3:
Rebased to latest master.
Submitted as a seperate patchset.
Moved the response enums from the ethdev to the ixgbe PMD.

Changes in v2:
Rebased to latest master.

Bernard Iremonger (2):
librte_ether: modify internal callback function net/ixgbe: add callback to user app on VF to PF mbox msg

 app/test/virtual_pmd.c                 |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 ++---
 drivers/net/e1000/em_ethdev.c          |  2 +-
 drivers/net/e1000/igb_ethdev.c         |  4 ++--
 drivers/net/enic/enic_main.c           |  2 +-
 drivers/net/i40e/i40e_ethdev.c         |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c      |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c           | 42 +++++++++++++++++++++++++++++-----
 drivers/net/ixgbe/rte_pmd_ixgbe.h      | 20 ++++++++++++++++
 drivers/net/mlx4/mlx4.c                |  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c         |  4 ++--
 drivers/net/nfp/nfp_net.c              |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c    |  2 +-
 drivers/net/vhost/rte_eth_vhost.c      |  6 ++---
 drivers/net/virtio/virtio_ethdev.c     |  2 +-
 lib/librte_ether/rte_ethdev.c          |  5 +++-
 lib/librte_ether/rte_ethdev.h          | 12 +++++++++-
 18 files changed, 94 insertions(+), 31 deletions(-)
Signature · 1 line
2.9.0
#9 lore raw

Re: [PATCH v7 0/2] modify callback for VF management

2016-10-07 17:46, Bernard Iremonger:

Quoted 10 lines

This patchset modifies the callback function for VF management.

A third parameter has been added to the _rte_eth_dev_callback_process function. All references to this function have been updated. Changes have been made to the ixgbe_rcv_msg_from_vf function to use the new callback parameter.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16430/
[dpdk-dev,v7,1/2] net/ixgbe: add API's for VF management

OK, this is probably a temporary solution.
I am OK to let it enter in DPDK 16.11 and starts some discussions. That's why I'll try to sum up the situation for this patchset and the other one (API for VF management).

The VF features are not yet enough standardized.
So the functions to manage them from the PF will be in some specific headers (drivers/net/ixgbe/rte_pmd_ixgbe.h in this case). They could be promoted in the generic ethdev API if it appears to be generic enough.
There can be also some application callbacks called from the drivers with a specific signature:
- a "generic" event type for VF
- a specific parameter defined in the driver
Obviously, we cannot have different meanings of this event depending on the driver in use. So we must have something more robust when implementing such feature in a second driver.

As there is no obvious solution, the pragmatic approach is to accept this first specific implementation while waiting for a better idea.

#10 lore raw

v8 cover modify callback for VF management

In reply to Bernard Iremonger

This patchset modifies the callback function for VF management.

A third parameter has been added to the _rte_eth_dev_callback_process function. All references to this function have been updated. Changes have been made to the ixgbe_rcv_msg_from_vf function to use the new callback parameter.

This patchset depends on the following patch.
http://dpdk.org/dev/patchwork/patch/16430/
[dpdk-dev,v7,1/2] net/ixgbe: add API's for VF management

These patches were part of the RFC PATCH v2 of the above patchset, but were dropped from the v3 patchset.

Changes in v8:
Rebased to latest master.
Improve description of struct rte_pmd_ixgbe_mb_event_param, rename member user_data to msg.

Changes in v7:
Rebased to latest master.
Move references to _rte_eth_dev_callback_process in ixgbe patch to librte_ether patch.
Revised description of callback parameter.

Changes in v6:
Rebased to latest master.
Squashed patches down to two patches.
Renamed parameter to _rte_eth_dev_callback_process function. Updated API descriptions.

Changes in v5:
Rebased to latest master.
Added parameter to the _rte_eth_dev_callback_process function Removed two new callback functions which were added previously. Updated all calls to the _rte_eth_dev_callback_process function.

Changes in v4:
Rebased to latest master.
Moved the callback parameter structure from the ethdev to the ixgbe PMD.

Changes in v3:
Rebased to latest master.
Submitted as a seperate patchset.
Moved the response enums from the ethdev to the ixgbe PMD.

Changes in v2:
Rebased to latest master.

Bernard Iremonger (2):
librte_ether: modify internal callback function net/ixgbe: add callback to user app on VF to PF mbox msg

 app/test/virtual_pmd.c                 |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 ++---
 drivers/net/e1000/em_ethdev.c          |  2 +-
 drivers/net/e1000/igb_ethdev.c         |  4 ++--
 drivers/net/enic/enic_main.c           |  2 +-
 drivers/net/i40e/i40e_ethdev.c         |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c      |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c           | 42 +++++++++++++++++++++++++++++-----
 drivers/net/ixgbe/rte_pmd_ixgbe.h      | 20 ++++++++++++++++
 drivers/net/mlx4/mlx4.c                |  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c         |  4 ++--
 drivers/net/nfp/nfp_net.c              |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c    |  2 +-
 drivers/net/vhost/rte_eth_vhost.c      |  6 ++---
 drivers/net/virtio/virtio_ethdev.c     |  2 +-
 lib/librte_ether/rte_ethdev.c          |  5 +++-
 lib/librte_ether/rte_ethdev.h          | 12 +++++++++-
 18 files changed, 94 insertions(+), 31 deletions(-)
Signature · 1 line
2.9.0
#11 lore raw

Re: [PATCH v8 0/2] modify callback for VF management

2016-10-10 15:34, Bernard Iremonger:

Quoted 6 lines

This patchset modifies the callback function for VF management.

A third parameter has been added to the _rte_eth_dev_callback_process function. All references to this function have been updated. Changes have been made to the ixgbe_rcv_msg_from_vf function to use the new callback parameter.

Applied, thanks

#12 lore raw

PATCH v8 1/2 librte_ether: modify internal callback function

In reply to Bernard Iremonger

add cb_arg parameter to the _rte_eth_dev_callback_process function.

Adding a parameter to this function allows passing information to the application when an eth device event occurs such as a VF to PF message.
This allows the application to decide if a particular function is permitted.

drivers/net: add parameter to callback process function

add parameter to call of _rte_eth_dev_callback_process function in the following PMD's:

net/bonding
net/e1000
net/i40e
net/enic
net/ixgbe
net/mlx4
net/mlx5
net/nfp
net/thunderx
net/vhost
net/virtio

app/test: add parameter to callback process function add parameter to call of _rte_eth_dev_callback_process function

---
 app/test/virtual_pmd.c                 |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 +++---
 drivers/net/e1000/em_ethdev.c          |  2 +-
 drivers/net/e1000/igb_ethdev.c         |  4 ++--
 drivers/net/enic/enic_main.c           |  2 +-
 drivers/net/i40e/i40e_ethdev.c         |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c      |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++--
 drivers/net/mlx4/mlx4.c                |  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c         |  4 ++--
 drivers/net/nfp/nfp_net.c              |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c    |  2 +-
 drivers/net/vhost/rte_eth_vhost.c      |  6 +++---
 drivers/net/virtio/virtio_ethdev.c     |  2 +-
 lib/librte_ether/rte_ethdev.c          |  5 ++++-
 lib/librte_ether/rte_ethdev.h          | 12 +++++++++++-
 16 files changed, 38 insertions(+), 25 deletions(-)
app/test/virtual_pmd.c +1 -1
index 4831113..65b44c6 100644
@@ -485,7 +485,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint8_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);
+	_rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 int
drivers/net/bonding/rte_eth_bond_pmd.c +3 -3
index fb4050c..8d510e3 100644
@@ -1958,7 +1958,7 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
 		return;
 
 	_rte_eth_dev_callback_process((struct rte_eth_dev *)arg,
-			RTE_ETH_EVENT_INTR_LSC);
+			RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 void
@@ -2079,7 +2079,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
 						(void *)bonded_eth_dev);
 			else
 				_rte_eth_dev_callback_process(bonded_eth_dev,
-						RTE_ETH_EVENT_INTR_LSC);
+						RTE_ETH_EVENT_INTR_LSC, NULL);
 
 		} else {
 			if (internals->link_down_delay_ms > 0)
@@ -2088,7 +2088,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
 						(void *)bonded_eth_dev);
 			else
 				_rte_eth_dev_callback_process(bonded_eth_dev,
-						RTE_ETH_EVENT_INTR_LSC);
+						RTE_ETH_EVENT_INTR_LSC, NULL);
 		}
 	}
 }
drivers/net/e1000/em_ethdev.c +1 -1
index f767e1c..e13e858 100644
@@ -1599,7 +1599,7 @@ eth_em_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
 
 	eth_em_interrupt_get_status(dev);
 	eth_em_interrupt_action(dev);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int
drivers/net/e1000/igb_ethdev.c +2 -2
index 5a1a83e..d9ab2df 100644
@@ -2683,7 +2683,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev)
 		E1000_WRITE_REG(hw, E1000_TCTL, tctl);
 		E1000_WRITE_REG(hw, E1000_RCTL, rctl);
 		E1000_WRITE_FLUSH(hw);
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	return 0;
@@ -2743,7 +2743,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);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 }
 
 static int
drivers/net/enic/enic_main.c +1 -1
index 15a05b4..fb72491 100644
@@ -436,7 +436,7 @@ enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
 	vnic_intr_return_all_credits(&enic->intr);
 
 	enic_link_update(enic);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	enic_log_q_error(enic);
 }
 
drivers/net/i40e/i40e_ethdev.c +2 -2
index d0640b9..0dd396a 100644
@@ -5514,7 +5514,7 @@ i40e_dev_interrupt_delayed_handler(void *param)
 
 	/* handle the link up interrupt in an alarm callback */
 	i40e_dev_link_update(dev, 0);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	i40e_pf_enable_irq0(hw);
 	rte_intr_enable(&(dev->pci_dev->intr_handle));
@@ -5598,7 +5598,7 @@ i40e_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
 			return;
 		else
 			_rte_eth_dev_callback_process(dev,
-				RTE_ETH_EVENT_INTR_LSC);
+				RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 done:
drivers/net/i40e/i40e_ethdev_vf.c +1 -1
index 34eb274..bd89cd9 100644
@@ -1341,7 +1341,7 @@ i40evf_handle_pf_event(__rte_unused struct rte_eth_dev *dev,
 	switch (pf_msg->event) {
 	case I40E_VIRTCHNL_EVENT_RESET_IMPENDING:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event\n");
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 		break;
 	case I40E_VIRTCHNL_EVENT_LINK_CHANGE:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event\n");
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index 35281f9..b00aef3 100644
@@ -3559,7 +3559,7 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
 		ixgbe_dev_link_update(dev, 0);
 		intr->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE;
 		ixgbe_dev_link_status_print(dev);
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr);
@@ -7537,7 +7537,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);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 }
 
 static int
drivers/net/mlx4/mlx4.c +2 -2
index 1553b2e..3e57cca 100644
@@ -5448,7 +5448,7 @@ mlx4_dev_link_status_handler(void *arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
@@ -5471,7 +5471,7 @@ mlx4_dev_interrupt_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
drivers/net/mlx5/mlx5_ethdev.c +2 -2
index bf4232a..c76e754 100644
@@ -1069,7 +1069,7 @@ mlx5_dev_link_status_handler(void *arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
@@ -1092,7 +1092,7 @@ mlx5_dev_interrupt_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
drivers/net/nfp/nfp_net.c +1 -1
index d526f34..a2b9056 100644
@@ -1219,7 +1219,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);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	nfp_net_dev_link_status_print(dev);
 
drivers/net/thunderx/nicvf_ethdev.c +1 -1
index b758c9f..c61e171 100644
@@ -108,7 +108,7 @@ nicvf_interrupt(void *arg)
 			nicvf_set_eth_link_status(nic,
 					&nic->eth_dev->data->dev_link);
 		_rte_eth_dev_callback_process(nic->eth_dev,
-				RTE_ETH_EVENT_INTR_LSC);
+				RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	rte_eal_alarm_set(NICVF_INTR_POLL_INTERVAL_MS * 1000,
drivers/net/vhost/rte_eth_vhost.c +3 -3
index c1d09a0..18a0c10 100644
@@ -559,7 +559,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);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	return 0;
 }
@@ -626,7 +626,7 @@ destroy_device(int vid)
 
 	RTE_LOG(INFO, PMD, "Connection closed\n");
 
-	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int
@@ -655,7 +655,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);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE, NULL);
 
 	return 0;
 }
drivers/net/virtio/virtio_ethdev.c +1 -1
index b4dfc0a..2f0065a 100644
@@ -1103,7 +1103,7 @@ virtio_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
 	if (isr & VIRTIO_PCI_ISR_CONFIG) {
 		if (virtio_dev_link_update(dev, 0) == 0)
 			_rte_eth_dev_callback_process(dev,
-						      RTE_ETH_EVENT_INTR_LSC);
+						      RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 }
lib/librte_ether/rte_ethdev.c +4 -1
index 88fa382..0d9d9c1 100644
@@ -2508,7 +2508,7 @@ rte_eth_dev_callback_unregister(uint8_t port_id,
 
 void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-	enum rte_eth_event_type event)
+	enum rte_eth_event_type event, void *cb_arg)
 {
 	struct rte_eth_dev_callback *cb_lst;
 	struct rte_eth_dev_callback dev_cb;
@@ -2519,6 +2519,9 @@ _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 = (void *) cb_arg;
+
 		rte_spinlock_unlock(&rte_eth_dev_cb_lock);
 		dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
 						dev_cb.cb_arg);
lib/librte_ether/rte_ethdev.h +11 -1
index 0a32ebb..351f972 100644
@@ -3030,6 +3030,7 @@ enum rte_eth_event_type {
 				/**< queue state event (enabled/disabled) */
 	RTE_ETH_EVENT_INTR_RESET,
 			/**< reset interrupt event, sent to VF on PF reset */
+	RTE_ETH_EVENT_VF_MBOX,  /**< message from the VF received by PF */
 	RTE_ETH_EVENT_MAX       /**< max value of this enum */
 };
 
@@ -3051,6 +3052,11 @@ typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \
  * @param cb_arg
  *  Pointer to the parameters for the registered callback.
  *
+ *  The user data is overwritten in the case of RTE_ETH_EVENT_VF_MBOX.
+ *	This even occurs when a message from the VF is received by the PF.
+ *	The user data is overwritten with struct rte_pmd_ixgbe_mb_event_param.
+ *	This struct is defined in rte_pmd_ixgbe.h.
+ *
  * @return
  *  - On success, zero.
  *  - On failure, a negative value.
@@ -3089,12 +3095,16 @@ int rte_eth_dev_callback_unregister(uint8_t port_id,
  *  Pointer to struct rte_eth_dev.
  * @param event
  *  Eth device interrupt event type.
+ * @param cb_arg
+ *  Update callback parameter to pass data back to user application.
+ *  This allows the user application to decide if a particular function
+ *  is permitted or not.
  *
  * @return
  *  void
  */
 void _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-				enum rte_eth_event_type event);
+				enum rte_eth_event_type event, void *cb_arg);
 
 /**
  * When there is no rx packet coming in Rx Queue for a long time, we can
Signature · 1 line
2.9.0
#13 lore raw

PATCH v8 2/2 net/ixgbe: add callback to user app on VF to PF mbox msg

In reply to Bernard Iremonger

call _rte_eth_dev_callback_process from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform the function.

If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue, if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

---
 drivers/net/ixgbe/ixgbe_pf.c      | 42 +++++++++++++++++++++++++++++++++------
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 20 +++++++++++++++++++
 2 files changed, 56 insertions(+), 6 deletions(-)
drivers/net/ixgbe/ixgbe_pf.c +36 -6
index 56393ff..26395e4 100644
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,7 @@
 
 #include "base/ixgbe_common.h"
 #include "ixgbe_ethdev.h"
+#include "rte_pmd_ixgbe.h"
 
 #define IXGBE_MAX_VFTA     (128)
 #define IXGBE_VF_MSG_SIZE_DEFAULT 1
@@ -660,6 +661,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ixgbe_vf_info *vfinfo =
 		*IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+	struct rte_pmd_ixgbe_mb_event_param cb_param;
 
 	retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
 	if (retval) {
@@ -674,27 +676,54 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 	/* flush the ack before we write any messages back */
 	IXGBE_WRITE_FLUSH(hw);
 
+	/**
+	 * initialise structure to send to user application
+	 * will return response from user in retval field
+	 */
+	cb_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
+	cb_param.vfid = vf;
+	cb_param.msg_type = msgbuf[0] & 0xFFFF;
+	cb_param.msg = (void *)msgbuf;
+
 	/* perform VF reset */
 	if (msgbuf[0] == IXGBE_VF_RESET) {
 		int ret = ixgbe_vf_reset(dev, vf, msgbuf);
 
 		vfinfo[vf].clear_to_send = true;
+
+		/* notify application about VF reset */
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
 		return ret;
 	}
 
+	/**
+	 * ask user application if we allowed to perform those functions
+	 * if we get cb_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED
+	 * then business as usual,
+	 * if 0, do nothing and send ACK to VF
+	 * if cb_param.retval > 1, do nothing and send NAK to VF
+	 */
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
+
+	retval = cb_param.retval;
+
 	/* check & process VF to PF mailbox message */
 	switch ((msgbuf[0] & 0xFFFF)) {
 	case IXGBE_VF_SET_MAC_ADDR:
-		retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_SET_MULTICAST:
-		retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_SET_LPE:
-		retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_SET_VLAN:
-		retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_API_NEGOTIATE:
 		retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
@@ -704,7 +733,8 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 		msg_size = IXGBE_VF_GET_QUEUE_MSG_SIZE;
 		break;
 	case IXGBE_VF_UPDATE_XCAST_MODE:
-		retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
 		break;
 	default:
 		PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);
drivers/net/ixgbe/rte_pmd_ixgbe.h +20 -0
index 2689668..74b64ad 100644
@@ -179,4 +179,24 @@ int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on);
  */
 int
 rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
+
+/**
+ * Response sent back to ixgbe driver from user app after callback
+ */
+enum rte_pmd_ixgbe_mb_event_rsp {
+	RTE_PMD_IXGBE_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+	RTE_PMD_IXGBE_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+	RTE_PMD_IXGBE_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+	RTE_PMD_IXGBE_MB_EVENT_MAX       /**< max value of this enum */
+};
+
+/**
+ * Data sent to the user application when the callback is executed.
+ */
+struct rte_pmd_ixgbe_mb_event_param {
+	uint16_t vfid;     /**< Virtual Function number */
+	uint16_t msg_type; /**< VF to PF message type, defined in ixgbe_mbx.h */
+	uint16_t retval;   /**< return value */
+	void *msg;         /**< pointer to message */
+};
 #endif /* _PMD_IXGBE_H_ */
Signature · 1 line
2.9.0
#14 lore raw

v8 cover add API's for VF management

In reply to Bernard Iremonger

This patchset contains new DPDK API's for use
with the Virtual Function Daemon (VFD).

The need to configure and manage VF's on a NIC has grown to the point where a DPDK based tool, VFD, has been developed to do this.

This patch set adds API extensions to DPDK for VF configuration.

Eight new API's have been added for the Intel 82559 NIC.

Changes have been made to testpmd to facilitate testing of the new API's. The testpmd documentation has been updated to document the testpmd changes.

Changes in v8:
rebase to latest master branch.
add new API's to testpmd help command.
modify testpmd Makefile to build with and without ixgbe PMD, in shared library mode and default mode.

Changes in v7:
rebase to latest master branch.
minor changes to ixgbe PMD following internal review.

Changes in v6:
rebase to latest master branch.
fix ixgbe makefile.
move set_vf_vlan_stripq function from ethdev to ixgbe PMD. revise testpmd command for set_vf_vlan_stripq.

Changes in v5:
rebase to latest master branch.
remove new API's from eth_dev_ops structure.
add public API's to ixgbe PMD.
revise testpmd commands for new API's

Changes in v4:
The rte_eth_dev_vf_ping API has been dropped as it is a work around for a bug. The rte_eth_dev_set_vf_vlan_strip API has been renamed to rte_eth_dev_set_vf_vlan_stripq.

Changes in v3:
rebase to latest master branch.
drop patches for callback functions
revise VF id checks in new librte_ether functions
revise testpmd commands for new API's

Changes in V2:
rebase to latest master branch.
fix compile error with clang.

Bernard Iremonger (2):
net/ixgbe: add API's for VF management
app/test_pmd: add tests for new API's

 app/test-pmd/Makefile                       |  11 +
 app/test-pmd/cmdline.c                      | 699 +++++++++++++++++++++++++++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  62 ++-
 drivers/net/ixgbe/Makefile                  |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c            | 240 ++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe.h           | 182 ++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  13 +
 7 files changed, 1206 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/ixgbe/rte_pmd_ixgbe.h
Signature · 1 line
2.9.0
#15 lore raw

v9 cover add API's for VF management

This patchset contains new DPDK API's for use
with the Virtual Function Daemon (VFD).

The need to configure and manage VF's on a NIC has grown to the point where a DPDK based tool, VFD, has been developed to do this.

This patch set adds API extensions to DPDK for VF configuration.

Eight new API's have been added for the Intel 82559 NIC.

Changes have been made to testpmd to facilitate testing of the new API's. The testpmd documentation has been updated to document the testpmd changes.

Changes in v8:
rebase to latest master branch.
fix testpmd Makefile.

Changes in v8:
rebase to latest master branch.
add new API's to testpmd help command.
modify testpmd Makefile to build with and without ixgbe PMD, in shared library mode and default mode.

Changes in v7:
rebase to latest master branch.
minor changes to ixgbe PMD following internal review.

Changes in v6:
rebase to latest master branch.
fix ixgbe makefile.
move set_vf_vlan_stripq function from ethdev to ixgbe PMD. revise testpmd command for set_vf_vlan_stripq.

Changes in v5:
rebase to latest master branch.
remove new API's from eth_dev_ops structure.
add public API's to ixgbe PMD.
revise testpmd commands for new API's

Changes in v4:
The rte_eth_dev_vf_ping API has been dropped as it is a work around for a bug. The rte_eth_dev_set_vf_vlan_strip API has been renamed to rte_eth_dev_set_vf_vlan_stripq.

Changes in v3:
rebase to latest master branch.
drop patches for callback functions
revise VF id checks in new librte_ether functions
revise testpmd commands for new API's

Changes in V2:
rebase to latest master branch.
fix compile error with clang.
Bernard Iremonger (2):
net/ixgbe: add API's for VF management
app/test_pmd: add tests for new API's

 app/test-pmd/Makefile                       |   2 +
 app/test-pmd/cmdline.c                      | 699 +++++++++++++++++++++++++++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  62 ++-
 drivers/net/ixgbe/Makefile                  |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c            | 240 ++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe.h           | 182 ++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  13 +
 7 files changed, 1197 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/ixgbe/rte_pmd_ixgbe.h
Signature · 1 line
2.9.0
#16 lore raw

Re: [PATCH v9 0/2] add API's for VF management

Quoted 6 lines · Bernard Iremonger

This patchset contains new DPDK API's for use
with the Virtual Function Daemon (VFD).

The need to configure and manage VF's on a NIC has grown to the point where a DPDK based tool, VFD, has been developed to do this.

Quoted 7 lines

This patch set adds API extensions to DPDK for VF configuration.

Eight new API's have been added for the Intel 82559 NIC.

Changes have been made to testpmd to facilitate testing of the new API's. The testpmd documentation has been updated to document the testpmd changes.

Patchset applied to dpdk-next-net/rel_16_11

/Bruce

#17 lore raw

PATCH v9 1/2 net/ixgbe: add API's for VF management

In reply to Bernard Iremonger

Add API's to configure and manage VF's on an Intel 82559 NIC.

add rte_pmd_ixgbe_set_vf_vlan_anti_spoof function. add rte_pmd_ixgbe_set_vf_mac_anti_spoof function. add rte_pmd_ixgbe_set_vf_stripq function.

add rte_pmd_ixgbe_set_vf_vlan_insert function.
add rte_pmd_ixgbe_set_tx_loopback function.
add rte_pmd_ixgbe_set_all_queues_drop function.
add rte_pmd_ixgbe_set_vf_split_drop_en function.
add rte_pmd_ixgbe_set_vf_mac_addr function.

---
 drivers/net/ixgbe/Makefile                  |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c            | 240 ++++++++++++++++++++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe.h           | 182 +++++++++++++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  13 ++
 4 files changed, 438 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ixgbe/rte_pmd_ixgbe.h
drivers/net/ixgbe/Makefile +3 -1
index a6c71f3..94ddc7b 100644
@@ -1,6 +1,6 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -119,6 +119,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bypass.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_82599_bypass.c
 endif
 
+# install this header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)-include := rte_pmd_ixgbe.h
 
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal lib/librte_ether
drivers/net/ixgbe/ixgbe_ethdev.c +240 -0

258 lines not on this page · raw message

drivers/net/ixgbe/rte_pmd_ixgbe.h new file +182 -0

182 lines not on this page · raw message

drivers/net/ixgbe/rte_pmd_ixgbe_version.map +13 -0
index ef35398..92434f3 100644
@@ -2,3 +2,16 @@ DPDK_2.0 {
 
 	local: *;
 };
+
+DPDK_16.11 {
+	global:
+
+	rte_pmd_ixgbe_set_all_queues_drop_en;
+	rte_pmd_ixgbe_set_tx_loopback;
+	rte_pmd_ixgbe_set_vf_mac_addr;
+	rte_pmd_ixgbe_set_vf_mac_anti_spoof;
+	rte_pmd_ixgbe_set_vf_split_drop_en;
+	rte_pmd_ixgbe_set_vf_vlan_anti_spoof;
+	rte_pmd_ixgbe_set_vf_vlan_insert;
+	rte_pmd_ixgbe_set_vf_vlan_stripq;
+} DPDK_2.0;
Signature · 1 line
2.9.0
#18 lore raw

PATCH v9 2/2 app/test_pmd: add tests for new API's

In reply to Bernard Iremonger

add test for set vf vlan anti spoof add test for set vf mac anti spoof add test for set vf vlan stripq
add test for set vf vlan insert
add test for set tx loopback
add test for set all queues drop enable bit add test for set vf split drop enable bit add test for set vf mac address
add new API's to testpmd help command.

add new API's to the testpmd guide

modify Makefile, add library rte_pmd_ixgbe to _LDLIBS-y.

---
 app/test-pmd/Makefile                       |   2 +
 app/test-pmd/cmdline.c                      | 699 +++++++++++++++++++++++++++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  62 ++-
 3 files changed, 759 insertions(+), 4 deletions(-)
app/test-pmd/Makefile +2 -0
index 2a0b5a5..891b85a 100644
@@ -58,6 +58,8 @@ SRCS-y += csumonly.c
 SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
+_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
+
 CFLAGS_cmdline.o := -D_GNU_SOURCE
 
 # this application needs libraries first
app/test-pmd/cmdline.c +698 -1

735 lines not on this page · raw message

doc/guides/testpmd_app_ug/testpmd_funcs.rst +59 -3

89 lines not on this page · raw message

Signature · 1 line
2.9.0
#19 lore raw

PATCH v8 1/2 net/ixgbe: add API's for VF management

In reply to Bernard Iremonger

Add API's to configure and manage VF's on an Intel 82559 NIC.

add rte_pmd_ixgbe_set_vf_vlan_anti_spoof function. add rte_pmd_ixgbe_set_vf_mac_anti_spoof function. add rte_pmd_ixgbe_set_vf_stripq function.

add rte_pmd_ixgbe_set_vf_vlan_insert function.
add rte_pmd_ixgbe_set_tx_loopback function.
add rte_pmd_ixgbe_set_all_queues_drop function.
add rte_pmd_ixgbe_set_vf_split_drop_en function.
add rte_pmd_ixgbe_set_vf_mac_addr function.

---
 drivers/net/ixgbe/Makefile                  |   4 +-
 drivers/net/ixgbe/ixgbe_ethdev.c            | 240 ++++++++++++++++++++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe.h           | 182 +++++++++++++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe_version.map |  13 ++
 4 files changed, 438 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ixgbe/rte_pmd_ixgbe.h
drivers/net/ixgbe/Makefile +3 -1
index a6c71f3..94ddc7b 100644
@@ -1,6 +1,6 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -119,6 +119,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bypass.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_82599_bypass.c
 endif
 
+# install this header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)-include := rte_pmd_ixgbe.h
 
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal lib/librte_ether
drivers/net/ixgbe/ixgbe_ethdev.c +240 -0

258 lines not on this page · raw message

drivers/net/ixgbe/rte_pmd_ixgbe.h new file +182 -0

182 lines not on this page · raw message

drivers/net/ixgbe/rte_pmd_ixgbe_version.map +13 -0
index ef35398..92434f3 100644
@@ -2,3 +2,16 @@ DPDK_2.0 {
 
 	local: *;
 };
+
+DPDK_16.11 {
+	global:
+
+	rte_pmd_ixgbe_set_all_queues_drop_en;
+	rte_pmd_ixgbe_set_tx_loopback;
+	rte_pmd_ixgbe_set_vf_mac_addr;
+	rte_pmd_ixgbe_set_vf_mac_anti_spoof;
+	rte_pmd_ixgbe_set_vf_split_drop_en;
+	rte_pmd_ixgbe_set_vf_vlan_anti_spoof;
+	rte_pmd_ixgbe_set_vf_vlan_insert;
+	rte_pmd_ixgbe_set_vf_vlan_stripq;
+} DPDK_2.0;
Signature · 1 line
2.9.0
#20 lore raw

PATCH v8 2/2 app/test_pmd: add tests for new API's

In reply to Bernard Iremonger

add test for set vf vlan anti spoof add test for set vf mac anti spoof add test for set vf vlan stripq
add test for set vf vlan insert
add test for set tx loopback
add test for set all queues drop enable bit add test for set vf split drop enable bit add test for set vf mac address
add new API's to testpmd help command.

add new API's to the testpmd guide

modify Makefile, add library rte_pmd_ixgbe to LDLIBS.

---
 app/test-pmd/Makefile                       |  11 +
 app/test-pmd/cmdline.c                      | 699 +++++++++++++++++++++++++++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  62 ++-
 3 files changed, 768 insertions(+), 4 deletions(-)
app/test-pmd/Makefile +11 -0
index 2a0b5a5..472a016 100644
@@ -58,6 +58,17 @@ SRCS-y += csumonly.c
 SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
+endif
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+endif
+
+
 CFLAGS_cmdline.o := -D_GNU_SOURCE
 
 # this application needs libraries first
app/test-pmd/cmdline.c +698 -1

735 lines not on this page · raw message

doc/guides/testpmd_app_ug/testpmd_funcs.rst +59 -3

89 lines not on this page · raw message

Signature · 1 line
2.9.0
#21 lore raw

Re: [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 16:03, Bernard Iremonger:

Quoted 5 lines
app/test-pmd/Makefile +0 -0
@@ -58,6 +58,17 @@ SRCS-y += csumonly.c
 SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c

app/test-pmd/Makefile SRCS-y += csumonly.c · line 69

Quoted 10 lines
app/test-pmd/Makefile +9 -0
 
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
+endif
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+endif

Sorry if I miss something, but I thought it was enough to do:
LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

#22 lore raw

Re: [PATCH v8 2/2] app/test_pmd: add tests for new API's

Hi Thomas,

<snip>

Quoted 9 lines

Subject: Re: [dpdk-dev] [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 16:03, Bernard Iremonger:

Quoted 5 lines
app/test-pmd/Makefile +0 -0
@@ -58,6 +58,17 @@ SRCS-y += csumonly.c  SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
Quoted 11 lines

app/test-pmd/Makefile SRCS-y += csumonly.c · line 69

Quoted 8 lines
app/test-pmd/Makefile +8 -0
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe endif
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+endif

Sorry if I miss something, but I thought it was enough to do:
LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

No unfortunately not, the above line does not work for all scenarios .

There are 4 scenarios as follows:

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with CONFIG_RTE_BUILD_SHARED_LIB=n

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with CONFIG_RTE_BUILD_SHARED_LIB=y

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with CONFIG_RTE_BUILD_SHARED_LIB=y

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with CONFIG_RTE_BUILD_SHARED_LIB=n

I have been doing quite a bit of building today to get it to work in all 4 scenarios.

Regards,

Bernard.

#23 lore raw

Re: [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 15:27, Iremonger, Bernard:

Quoted 31 lines

Hi Thomas,

<snip>

Quoted 9 lines

Subject: Re: [dpdk-dev] [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 16:03, Bernard Iremonger:

Quoted 5 lines
app/test-pmd/Makefile +0 -0
@@ -58,6 +58,17 @@ SRCS-y += csumonly.c  SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
Quoted 11 lines

app/test-pmd/Makefile SRCS-y += csumonly.c · line 69

Quoted 8 lines
app/test-pmd/Makefile +8 -0
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe endif
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+endif

Sorry if I miss something, but I thought it was enough to do:
LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

No unfortunately not, the above line does not work for all scenarios .

There are 4 scenarios as follows:

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 7 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with CONFIG_RTE_BUILD_SHARED_LIB=y

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with CONFIG_RTE_BUILD_SHARED_LIB=y

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with CONFIG_RTE_BUILD_SHARED_LIB=n

I have been doing quite a bit of building today to get it to work in all 4 scenarios.

I have a doubt about the tests because LDLIBS-y does not exist. There is _LDLIBS-y and LDLIBS.
But in the static case, you wrote:

	LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe endif

Please could you check?

#24 lore raw

Re: [PATCH v8 2/2] app/test_pmd: add tests for new API's

Hi Thomas,

<snip>

Quoted 46 lines

Subject: Re: [dpdk-dev] [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 15:27, Iremonger, Bernard:

Quoted 7 lines

Hi Thomas,

<snip>

Quoted 3 lines

Subject: Re: [dpdk-dev] [PATCH v8 2/2] app/test_pmd: add tests for new API's

Quoted 8 lines
Quoted 8 lines

2016-10-12 16:03, Bernard Iremonger:

app/test-pmd/Makefile SRCS-y += csumonly.c SRCS-y += icmpecho.c · line 61

Quoted 7 lines
app/test-pmd/Makefile +2 -0
@@ -58,6 +58,17 @@ SRCS-y += csumonly.c  SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

endif

Quoted 10 lines
Quoted 9 lines

app/test-pmd/Makefile SRCS-y += csumonly.c · line 69

Quoted 6 lines
app/test-pmd/Makefile +6 -0
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+endif

Sorry if I miss something, but I thought it was enough to do:
LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

Quoted 5 lines

No unfortunately not, the above line does not work for all scenarios .

There are 4 scenarios as follows:

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with

CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with

CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with

CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with

CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 1 line
Quoted 8 lines
Quoted 1 line

I have been doing quite a bit of building today to get it to work in all 4

scenarios.

I have a doubt about the tests because LDLIBS-y does not exist. There is _LDLIBS-y and LDLIBS.
But in the static case, you wrote:

	LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

endif Please could you check?

LDLIBS-y exists in some of the scenarios but not all.
Do you want me to check the four scenarios with just the line below.

LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

Regards,

Bernard.

#25 lore raw

Re: [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 15:48, Iremonger, Bernard:

Quoted 53 lines

Hi Thomas,

<snip>

Quoted 49 lines

Subject: Re: [dpdk-dev] [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 15:27, Iremonger, Bernard:

Quoted 7 lines

Hi Thomas,

<snip>

Quoted 3 lines

Subject: Re: [dpdk-dev] [PATCH v8 2/2] app/test_pmd: add tests for new API's

Quoted 8 lines
Quoted 8 lines

2016-10-12 16:03, Bernard Iremonger:

app/test-pmd/Makefile SRCS-y += csumonly.c SRCS-y += icmpecho.c · line 61

Quoted 7 lines
app/test-pmd/Makefile +2 -0
@@ -58,6 +58,17 @@ SRCS-y += csumonly.c  SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

endif

Quoted 10 lines
Quoted 9 lines

app/test-pmd/Makefile SRCS-y += csumonly.c · line 69

Quoted 6 lines
app/test-pmd/Makefile +6 -0
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+endif

Sorry if I miss something, but I thought it was enough to do:
LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

Quoted 5 lines

No unfortunately not, the above line does not work for all scenarios .

There are 4 scenarios as follows:

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with

CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with

CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with

CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with

CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 2 lines

I have been doing quite a bit of building today to get it to work in all 4

scenarios.

Quoted 7 lines
Quoted 5 lines

I have a doubt about the tests because LDLIBS-y does not exist. There is _LDLIBS-y and LDLIBS.
But in the static case, you wrote:

	LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

endif Please could you check?

LDLIBS-y exists in some of the scenarios but not all.

I think I'm something obvious.
Please could you point the line where LDLIBS-y is used?

Quoted 3 lines

Do you want me to check the four scenarios with just the line below.

LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

Let's check the theory first :)

#26 lore raw

Re: [PATCH v8 2/2] app/test_pmd: add tests for new API's

Hi Thomas,

<snip>

Quoted 46 lines
Quoted 38 lines
Quoted 38 lines
Quoted 11 lines
Quoted 11 lines

Subject: Re: [dpdk-dev] [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 16:03, Bernard Iremonger:

app/test-pmd/Makefile SRCS-y += csumonly.c SRCS-y += icmpecho.c · line 61

Quoted 7 lines
app/test-pmd/Makefile +2 -0
@@ -58,6 +58,17 @@ SRCS-y += csumonly.c  SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

endif

Quoted 10 lines
Quoted 9 lines

app/test-pmd/Makefile SRCS-y += csumonly.c · line 69

Quoted 6 lines
app/test-pmd/Makefile +6 -0
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+endif

Sorry if I miss something, but I thought it was enough to do:
LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

Quoted 5 lines

No unfortunately not, the above line does not work for all scenarios .

There are 4 scenarios as follows:

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with

CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with

CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with

CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with

CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

I have been doing quite a bit of building today to get it to work in all 4

scenarios.

I have a doubt about the tests because LDLIBS-y does not exist. There is _LDLIBS-y and LDLIBS.
But in the static case, you wrote:

	LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe
Quoted 7 lines

endif

Quoted 3 lines
Quoted 1 line

Please could you check?

LDLIBS-y exists in some of the scenarios but not all.

I think I'm something obvious.
Please could you point the line where LDLIBS-y is used?

Line 62 of latest Makefile; LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

LDLIBS-y does not exist when CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 5 lines
Quoted 3 lines

Do you want me to check the four scenarios with just the line below.

LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

Let's check the theory first :)

Ok

Regards,

Bernard.

#27 lore raw

Re: [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 16:21, Iremonger, Bernard:

Quoted 52 lines

Hi Thomas,

<snip>

Quoted 49 lines
Quoted 38 lines
Quoted 38 lines
Quoted 11 lines
Quoted 11 lines

Subject: Re: [dpdk-dev] [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 16:03, Bernard Iremonger:

app/test-pmd/Makefile SRCS-y += csumonly.c SRCS-y += icmpecho.c · line 61

Quoted 7 lines
app/test-pmd/Makefile +2 -0
@@ -58,6 +58,17 @@ SRCS-y += csumonly.c  SRCS-y += icmpecho.c
 SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
 
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

endif

Quoted 10 lines
Quoted 9 lines

app/test-pmd/Makefile SRCS-y += csumonly.c SRCS-y += icmpecho.c · line 67

Quoted 6 lines
app/test-pmd/Makefile +6 -0
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe
+endif
+endif

Sorry if I miss something, but I thought it was enough to do:
LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

Quoted 5 lines

No unfortunately not, the above line does not work for all scenarios .

There are 4 scenarios as follows:

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with

CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with

CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with

CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with

CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

I have been doing quite a bit of building today to get it to work in all 4

scenarios.

I have a doubt about the tests because LDLIBS-y does not exist. There is _LDLIBS-y and LDLIBS.
But in the static case, you wrote:

	LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

endif

Quoted 2 lines
Quoted 1 line

Please could you check?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

LDLIBS-y exists in some of the scenarios but not all.

I think I'm something obvious.
Please could you point the line where LDLIBS-y is used?

Line 62 of latest Makefile; LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

No, I mean where do you find LDLIBS- (without underscore) before your patch? git grep '\<LDLIBS-' returns nothing.

#28 lore raw

Re: [PATCH v8 2/2] app/test_pmd: add tests for new API's

Hi Thomas,

<snip>

Quoted 55 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Subject: Re: [dpdk-dev] [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 16:03, Bernard Iremonger:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

app/test-pmd/Makefile

Quoted 8 lines
app/test-pmd/Makefile +0 -0
@@ -58,6 +58,17 @@ SRCS-y += csumonly.c  SRCS-y +=

icmpecho.c
SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c

app/test-pmd/Makefile +2 -0
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -

lrte_pmd_ixgbe

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

endif

Quoted 9 lines
Quoted 7 lines

app/test-pmd/Makefile

Quoted 4 lines
app/test-pmd/Makefile +4 -0
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe endif endif

Sorry if I miss something, but I thought it was enough to do:
LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

No unfortunately not, the above line does not work for all scenarios

.

Quoted 31 lines
Quoted 30 lines
Quoted 15 lines
Quoted 15 lines
Quoted 4 lines

There are 4 scenarios as follows:

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with

CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with

CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with

CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with

CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

I have been doing quite a bit of building today to get it to work in all 4

scenarios.

I have a doubt about the tests because LDLIBS-y does not exist. There is _LDLIBS-y and LDLIBS.
But in the static case, you wrote:

	LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

endif

Quoted 3 lines
Quoted 1 line

Please could you check?

LDLIBS-y exists in some of the scenarios but not all.

I think I'm something obvious.
Please could you point the line where LDLIBS-y is used?

Quoted 6 lines
Quoted 2 lines

Line 62 of latest Makefile; LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

No, I mean where do you find LDLIBS- (without underscore) before your patch?
git grep '\<LDLIBS-' returns nothing.

Before my patch LDLIBS was not used in the testpmd Makefile.

The linking was done in rte.app.mk, this uses LDLIBS and _LDLIBS-y. I don't see LDLIBS-y either.

Regards,

Bernard.

#29 lore raw

Re: [PATCH v8 2/2] app/test_pmd: add tests for new API's

Hi Thomas,

<snip>

Quoted 66 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Subject: Re: [dpdk-dev] [PATCH v8 2/2] app/test_pmd: add tests for new API's

2016-10-12 16:03, Bernard Iremonger:

Quoted 6 lines
app/test-pmd/Makefile +0 -0
@@ -58,6 +58,17 @@ SRCS-y += csumonly.c  SRCS-y +=

icmpecho.c
SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c

Quoted 11 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

app/test-pmd/Makefile

Quoted 2 lines
app/test-pmd/Makefile +2 -0
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -

lrte_pmd_ixgbe

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

endif

Quoted 7 lines
Quoted 7 lines

app/test-pmd/Makefile

Quoted 4 lines
app/test-pmd/Makefile +4 -0
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
+LDLIBS += -lrte_pmd_ixgbe endif endif

Sorry if I miss something, but I thought it was enough to do:
LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -

lrte_pmd_ixgbe

Quoted 27 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

No unfortunately not, the above line does not work for all scenarios

.

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 4 lines

There are 4 scenarios as follows:

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with

CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=y with

CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with

CONFIG_RTE_BUILD_SHARED_LIB=y

Quoted 2 lines

CONFIG_RTE_LIBRTE_IXGBE_PMD=n with

CONFIG_RTE_BUILD_SHARED_LIB=n

Quoted 3 lines

I have been doing quite a bit of building today to get it to work in all 4

scenarios.

I have a doubt about the tests because LDLIBS-y does not exist. There is _LDLIBS-y and LDLIBS.
But in the static case, you wrote:

	LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -

lrte_pmd_ixgbe

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

endif

Quoted 3 lines
Quoted 1 line

Please could you check?

LDLIBS-y exists in some of the scenarios but not all.

I think I'm something obvious.
Please could you point the line where LDLIBS-y is used?

Quoted 6 lines
Quoted 2 lines

Line 62 of latest Makefile; LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

No, I mean where do you find LDLIBS- (without underscore) before your patch?
git grep '\<LDLIBS-' returns nothing.

Quoted 9 lines

Before my patch LDLIBS was not used in the testpmd Makefile.

The linking was done in rte.app.mk, this uses LDLIBS and _LDLIBS-y. I don't see LDLIBS-y either.

Regards,

Bernard.

_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe

Works in the 4 scenarios, I will send a v9

Regards,

Bernard.

#30 lore raw

PATCH v7 1/2 librte_ether: modify internal callback function

In reply to Bernard Iremonger

add cb_arg parameter to the _rte_eth_dev_callback_process function.

Adding a parameter to this function allows passing information to the application when an eth device event occurs such as a VF to PF message.
This allows the application to decide if a particular function is permitted.

drivers/net: add parameter to callback process function

add parameter to call of _rte_eth_dev_callback_process function in the following PMD's:

net/bonding
net/e1000
net/i40e
net/enic
net/ixgbe
net/mlx4
net/mlx5
net/nfp
net/thunderx
net/vhost
net/virtio

app/test: add parameter to callback process function add parameter to call of _rte_eth_dev_callback_process function

---
 app/test/virtual_pmd.c                 |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 +++---
 drivers/net/e1000/em_ethdev.c          |  2 +-
 drivers/net/e1000/igb_ethdev.c         |  4 ++--
 drivers/net/enic/enic_main.c           |  2 +-
 drivers/net/i40e/i40e_ethdev.c         |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c      |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++--
 drivers/net/mlx4/mlx4.c                |  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c         |  4 ++--
 drivers/net/nfp/nfp_net.c              |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c    |  2 +-
 drivers/net/vhost/rte_eth_vhost.c      |  6 +++---
 drivers/net/virtio/virtio_ethdev.c     |  2 +-
 lib/librte_ether/rte_ethdev.c          |  5 ++++-
 lib/librte_ether/rte_ethdev.h          | 12 +++++++++++-
 16 files changed, 38 insertions(+), 25 deletions(-)
app/test/virtual_pmd.c +1 -1
index 4831113..65b44c6 100644
@@ -485,7 +485,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint8_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);
+	_rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 int
drivers/net/bonding/rte_eth_bond_pmd.c +3 -3
index fb4050c..8d510e3 100644
@@ -1958,7 +1958,7 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
 		return;
 
 	_rte_eth_dev_callback_process((struct rte_eth_dev *)arg,
-			RTE_ETH_EVENT_INTR_LSC);
+			RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 void
@@ -2079,7 +2079,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
 						(void *)bonded_eth_dev);
 			else
 				_rte_eth_dev_callback_process(bonded_eth_dev,
-						RTE_ETH_EVENT_INTR_LSC);
+						RTE_ETH_EVENT_INTR_LSC, NULL);
 
 		} else {
 			if (internals->link_down_delay_ms > 0)
@@ -2088,7 +2088,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
 						(void *)bonded_eth_dev);
 			else
 				_rte_eth_dev_callback_process(bonded_eth_dev,
-						RTE_ETH_EVENT_INTR_LSC);
+						RTE_ETH_EVENT_INTR_LSC, NULL);
 		}
 	}
 }
drivers/net/e1000/em_ethdev.c +1 -1
index f767e1c..e13e858 100644
@@ -1599,7 +1599,7 @@ eth_em_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
 
 	eth_em_interrupt_get_status(dev);
 	eth_em_interrupt_action(dev);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int
drivers/net/e1000/igb_ethdev.c +2 -2
index 5a1a83e..d9ab2df 100644
@@ -2683,7 +2683,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev)
 		E1000_WRITE_REG(hw, E1000_TCTL, tctl);
 		E1000_WRITE_REG(hw, E1000_RCTL, rctl);
 		E1000_WRITE_FLUSH(hw);
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	return 0;
@@ -2743,7 +2743,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);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 }
 
 static int
drivers/net/enic/enic_main.c +1 -1
index 15a05b4..fb72491 100644
@@ -436,7 +436,7 @@ enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
 	vnic_intr_return_all_credits(&enic->intr);
 
 	enic_link_update(enic);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	enic_log_q_error(enic);
 }
 
drivers/net/i40e/i40e_ethdev.c +2 -2
index 697800e..d947760 100644
@@ -5510,7 +5510,7 @@ i40e_dev_interrupt_delayed_handler(void *param)
 
 	/* handle the link up interrupt in an alarm callback */
 	i40e_dev_link_update(dev, 0);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	i40e_pf_enable_irq0(hw);
 	rte_intr_enable(&(dev->pci_dev->intr_handle));
@@ -5594,7 +5594,7 @@ i40e_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
 			return;
 		else
 			_rte_eth_dev_callback_process(dev,
-				RTE_ETH_EVENT_INTR_LSC);
+				RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 done:
drivers/net/i40e/i40e_ethdev_vf.c +1 -1
index 34eb274..bd89cd9 100644
@@ -1341,7 +1341,7 @@ i40evf_handle_pf_event(__rte_unused struct rte_eth_dev *dev,
 	switch (pf_msg->event) {
 	case I40E_VIRTCHNL_EVENT_RESET_IMPENDING:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event\n");
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 		break;
 	case I40E_VIRTCHNL_EVENT_LINK_CHANGE:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event\n");
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index 35281f9..b00aef3 100644
@@ -3559,7 +3559,7 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
 		ixgbe_dev_link_update(dev, 0);
 		intr->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE;
 		ixgbe_dev_link_status_print(dev);
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr);
@@ -7537,7 +7537,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);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 }
 
 static int
drivers/net/mlx4/mlx4.c +2 -2
index 1553b2e..3e57cca 100644
@@ -5448,7 +5448,7 @@ mlx4_dev_link_status_handler(void *arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
@@ -5471,7 +5471,7 @@ mlx4_dev_interrupt_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
drivers/net/mlx5/mlx5_ethdev.c +2 -2
index bf4232a..c76e754 100644
@@ -1069,7 +1069,7 @@ mlx5_dev_link_status_handler(void *arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
@@ -1092,7 +1092,7 @@ mlx5_dev_interrupt_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
drivers/net/nfp/nfp_net.c +1 -1
index d526f34..a2b9056 100644
@@ -1219,7 +1219,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);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	nfp_net_dev_link_status_print(dev);
 
drivers/net/thunderx/nicvf_ethdev.c +1 -1
index b758c9f..c61e171 100644
@@ -108,7 +108,7 @@ nicvf_interrupt(void *arg)
 			nicvf_set_eth_link_status(nic,
 					&nic->eth_dev->data->dev_link);
 		_rte_eth_dev_callback_process(nic->eth_dev,
-				RTE_ETH_EVENT_INTR_LSC);
+				RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	rte_eal_alarm_set(NICVF_INTR_POLL_INTERVAL_MS * 1000,
drivers/net/vhost/rte_eth_vhost.c +3 -3
index c1d09a0..18a0c10 100644
@@ -559,7 +559,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);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	return 0;
 }
@@ -626,7 +626,7 @@ destroy_device(int vid)
 
 	RTE_LOG(INFO, PMD, "Connection closed\n");
 
-	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int
@@ -655,7 +655,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);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE, NULL);
 
 	return 0;
 }
drivers/net/virtio/virtio_ethdev.c +1 -1
index b4dfc0a..2f0065a 100644
@@ -1103,7 +1103,7 @@ virtio_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
 	if (isr & VIRTIO_PCI_ISR_CONFIG) {
 		if (virtio_dev_link_update(dev, 0) == 0)
 			_rte_eth_dev_callback_process(dev,
-						      RTE_ETH_EVENT_INTR_LSC);
+						      RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 }
lib/librte_ether/rte_ethdev.c +4 -1
index c517e88..13ba70d 100644
@@ -2508,7 +2508,7 @@ rte_eth_dev_callback_unregister(uint8_t port_id,
 
 void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-	enum rte_eth_event_type event)
+	enum rte_eth_event_type event, void *cb_arg)
 {
 	struct rte_eth_dev_callback *cb_lst;
 	struct rte_eth_dev_callback dev_cb;
@@ -2519,6 +2519,9 @@ _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 = (void *) cb_arg;
+
 		rte_spinlock_unlock(&rte_eth_dev_cb_lock);
 		dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
 						dev_cb.cb_arg);
lib/librte_ether/rte_ethdev.h +11 -1
index 7218b6f..6667655 100644
@@ -3026,6 +3026,7 @@ enum rte_eth_event_type {
 				/**< queue state event (enabled/disabled) */
 	RTE_ETH_EVENT_INTR_RESET,
 			/**< reset interrupt event, sent to VF on PF reset */
+	RTE_ETH_EVENT_VF_MBOX,  /**< message from the VF received by PF */
 	RTE_ETH_EVENT_MAX       /**< max value of this enum */
 };
 
@@ -3047,6 +3048,11 @@ typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \
  * @param cb_arg
  *  Pointer to the parameters for the registered callback.
  *
+ *  The user data is overwritten in the case of RTE_ETH_EVENT_VF_MBOX.
+ *	This even occurs when a message from the VF is received by the PF.
+ *	The user data is overwritten with struct rte_pmd_ixgbe_mb_event_param.
+ *	This struct is defined in rte_pmd_ixgbe.h.
+ *
  * @return
  *  - On success, zero.
  *  - On failure, a negative value.
@@ -3085,12 +3091,16 @@ int rte_eth_dev_callback_unregister(uint8_t port_id,
  *  Pointer to struct rte_eth_dev.
  * @param event
  *  Eth device interrupt event type.
+ * @param cb_arg
+ *  Update callback parameter to pass data back to user application.
+ *  This allows the user application to decide if a particular function
+ *  is permitted or not.
  *
  * @return
  *  void
  */
 void _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-				enum rte_eth_event_type event);
+				enum rte_eth_event_type event, void *cb_arg);
 
 /**
  * When there is no rx packet coming in Rx Queue for a long time, we can
Signature · 1 line
2.9.0
#31 lore raw

PATCH v7 2/2 net/ixgbe: add callback to user app on VF to PF mbox msg

In reply to Bernard Iremonger

call _rte_eth_dev_callback_process from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform the function.

If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue, if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

---
 drivers/net/ixgbe/ixgbe_pf.c      | 42 +++++++++++++++++++++++++++++++++------
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 20 +++++++++++++++++++
 2 files changed, 56 insertions(+), 6 deletions(-)
drivers/net/ixgbe/ixgbe_pf.c +36 -6
index 56393ff..2a177b8 100644
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,7 @@
 
 #include "base/ixgbe_common.h"
 #include "ixgbe_ethdev.h"
+#include "rte_pmd_ixgbe.h"
 
 #define IXGBE_MAX_VFTA     (128)
 #define IXGBE_VF_MSG_SIZE_DEFAULT 1
@@ -660,6 +661,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ixgbe_vf_info *vfinfo =
 		*IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+	struct rte_pmd_ixgbe_mb_event_param cb_param;
 
 	retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
 	if (retval) {
@@ -674,27 +676,54 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 	/* flush the ack before we write any messages back */
 	IXGBE_WRITE_FLUSH(hw);
 
+	/**
+	 * initialise structure to send to user application
+	 * will return response from user in retval field
+	 */
+	cb_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
+	cb_param.vfid = vf;
+	cb_param.msg_type = msgbuf[0] & 0xFFFF;
+	cb_param.userdata = (void *)msgbuf;
+
 	/* perform VF reset */
 	if (msgbuf[0] == IXGBE_VF_RESET) {
 		int ret = ixgbe_vf_reset(dev, vf, msgbuf);
 
 		vfinfo[vf].clear_to_send = true;
+
+		/* notify application about VF reset */
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
 		return ret;
 	}
 
+	/**
+	 * ask user application if we allowed to perform those functions
+	 * if we get cb_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED
+	 * then business as usual,
+	 * if 0, do nothing and send ACK to VF
+	 * if cb_param.retval > 1, do nothing and send NAK to VF
+	 */
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
+
+	retval = cb_param.retval;
+
 	/* check & process VF to PF mailbox message */
 	switch ((msgbuf[0] & 0xFFFF)) {
 	case IXGBE_VF_SET_MAC_ADDR:
-		retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_SET_MULTICAST:
-		retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_SET_LPE:
-		retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_SET_VLAN:
-		retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_API_NEGOTIATE:
 		retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
@@ -704,7 +733,8 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 		msg_size = IXGBE_VF_GET_QUEUE_MSG_SIZE;
 		break;
 	case IXGBE_VF_UPDATE_XCAST_MODE:
-		retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
 		break;
 	default:
 		PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);
drivers/net/ixgbe/rte_pmd_ixgbe.h +20 -0
index 2689668..8665cea 100644
@@ -179,4 +179,24 @@ int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on);
  */
 int
 rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
+
+/**
+ * Response sent back to ixgbe driver from user app after callback
+ */
+enum rte_pmd_ixgbe_mb_event_rsp {
+	RTE_PMD_IXGBE_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+	RTE_PMD_IXGBE_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+	RTE_PMD_IXGBE_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+	RTE_PMD_IXGBE_MB_EVENT_MAX       /**< max value of this enum */
+};
+
+/**
+ * Data sent to the user application when the callback is executed.
+ */
+struct rte_pmd_ixgbe_mb_event_param {
+	uint16_t vfid;     /**< Virtual Function number */
+	uint16_t msg_type; /**< message type */
+	uint16_t retval;   /**< return value */
+	void *userdata;    /**< pointer to user data */
+};
 #endif /* _PMD_IXGBE_H_ */
Signature · 1 line
2.9.0
#32 lore raw

Re: [PATCH v7 2/2] net/ixgbe: add callback to user app on VF to PF mbox msg

2016-10-07 17:46, Bernard Iremonger:

drivers/net/ixgbe/rte_pmd_ixgbe.h int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on); · line 200

Quoted 5 lines
drivers/net/ixgbe/rte_pmd_ixgbe.h +5 -0
+struct rte_pmd_ixgbe_mb_event_param {
+	uint16_t vfid;     /**< Virtual Function number */
+	uint16_t msg_type; /**< message type */
+	uint16_t retval;   /**< return value */
+	void *userdata;    /**< pointer to user data */

Generally speaking, the user data is a pointer passed by the application when registering the callback and must be untouched.
It should be the name of the parameter that you are overriding with this structure.
So this "userdata" pointer could probably be better defined.

By the way, it is far from trivial to understand how to write the callback. I think it deserves more explanations.

#33 lore raw

Re: [PATCH v7 2/2] net/ixgbe: add callback to user app on VF to PF mbox msg

Hi Thomas,

<snip>

Quoted 16 lines

Subject: Re: [dpdk-dev] [PATCH v7 2/2] net/ixgbe: add callback to user app on VF to PF mbox msg

2016-10-07 17:46, Bernard Iremonger:

drivers/net/ixgbe/rte_pmd_ixgbe.h int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on); · line 200

Quoted 5 lines
drivers/net/ixgbe/rte_pmd_ixgbe.h +5 -0
+struct rte_pmd_ixgbe_mb_event_param {
+	uint16_t vfid;     /**< Virtual Function number */
+	uint16_t msg_type; /**< message type */
+	uint16_t retval;   /**< return value */
+	void *userdata;    /**< pointer to user data */

Generally speaking, the user data is a pointer passed by the application when registering the callback and must be untouched.
It should be the name of the parameter that you are overriding with this structure.
So this "userdata" pointer could probably be better defined.

Quoted 3 lines

By the way, it is far from trivial to understand how to write the callback. I think it deserves more explanations.

I will clarify the description of the struct rte_pmd_ixgbe_mb_event_param, and rename the member userdate to msg in a v8 patchset.

Regards,

Bernard.

#34 lore raw

PATCH v6 1/2 librte_ether: modify internal callback function

In reply to Bernard Iremonger

add cb_arg parameter to the _rte_eth_dev_callback_process function.

Adding a parameter to this function allows passing information to the application when an eth device event occurs such as a VF to PF message.
This allows the application to decide if a particular function is permitted.

drivers/net: add parameter to callback process function

add parameter to call of _rte_eth_dev_callback_process function in the following PMD's:

net/bonding
net/e1000
net/i40e
net/mlx4
net/mlx5
net/nfp
net/thunderx
net/vhost
net/virtio
net/enic

app/test: add parameter to callback process function add parameter to call of _rte_eth_dev_callback_process function

---
 app/test/virtual_pmd.c                 |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  6 +++---
 drivers/net/e1000/em_ethdev.c          |  2 +-
 drivers/net/e1000/igb_ethdev.c         |  4 ++--
 drivers/net/enic/enic_main.c           |  2 +-
 drivers/net/i40e/i40e_ethdev.c         |  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c      |  2 +-
 drivers/net/mlx4/mlx4.c                |  4 ++--
 drivers/net/mlx5/mlx5_ethdev.c         |  4 ++--
 drivers/net/nfp/nfp_net.c              |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c    |  2 +-
 drivers/net/vhost/rte_eth_vhost.c      |  6 +++---
 drivers/net/virtio/virtio_ethdev.c     |  2 +-
 lib/librte_ether/rte_ethdev.c          |  5 ++++-
 lib/librte_ether/rte_ethdev.h          | 12 +++++++++++-
 15 files changed, 36 insertions(+), 23 deletions(-)
app/test/virtual_pmd.c +1 -1
index 4831113..65b44c6 100644
@@ -485,7 +485,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint8_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);
+	_rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 int
drivers/net/bonding/rte_eth_bond_pmd.c +3 -3
index fb4050c..8d510e3 100644
@@ -1958,7 +1958,7 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
 		return;
 
 	_rte_eth_dev_callback_process((struct rte_eth_dev *)arg,
-			RTE_ETH_EVENT_INTR_LSC);
+			RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 void
@@ -2079,7 +2079,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
 						(void *)bonded_eth_dev);
 			else
 				_rte_eth_dev_callback_process(bonded_eth_dev,
-						RTE_ETH_EVENT_INTR_LSC);
+						RTE_ETH_EVENT_INTR_LSC, NULL);
 
 		} else {
 			if (internals->link_down_delay_ms > 0)
@@ -2088,7 +2088,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
 						(void *)bonded_eth_dev);
 			else
 				_rte_eth_dev_callback_process(bonded_eth_dev,
-						RTE_ETH_EVENT_INTR_LSC);
+						RTE_ETH_EVENT_INTR_LSC, NULL);
 		}
 	}
 }
drivers/net/e1000/em_ethdev.c +1 -1
index f767e1c..e13e858 100644
@@ -1599,7 +1599,7 @@ eth_em_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
 
 	eth_em_interrupt_get_status(dev);
 	eth_em_interrupt_action(dev);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int
drivers/net/e1000/igb_ethdev.c +2 -2
index 5a1a83e..d9ab2df 100644
@@ -2683,7 +2683,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev)
 		E1000_WRITE_REG(hw, E1000_TCTL, tctl);
 		E1000_WRITE_REG(hw, E1000_RCTL, rctl);
 		E1000_WRITE_FLUSH(hw);
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	return 0;
@@ -2743,7 +2743,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);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 }
 
 static int
drivers/net/enic/enic_main.c +1 -1
index 15a05b4..fb72491 100644
@@ -436,7 +436,7 @@ enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
 	vnic_intr_return_all_credits(&enic->intr);
 
 	enic_link_update(enic);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	enic_log_q_error(enic);
 }
 
drivers/net/i40e/i40e_ethdev.c +2 -2
index 697800e..d947760 100644
@@ -5510,7 +5510,7 @@ i40e_dev_interrupt_delayed_handler(void *param)
 
 	/* handle the link up interrupt in an alarm callback */
 	i40e_dev_link_update(dev, 0);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	i40e_pf_enable_irq0(hw);
 	rte_intr_enable(&(dev->pci_dev->intr_handle));
@@ -5594,7 +5594,7 @@ i40e_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
 			return;
 		else
 			_rte_eth_dev_callback_process(dev,
-				RTE_ETH_EVENT_INTR_LSC);
+				RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 done:
drivers/net/i40e/i40e_ethdev_vf.c +1 -1
index 34eb274..bd89cd9 100644
@@ -1341,7 +1341,7 @@ i40evf_handle_pf_event(__rte_unused struct rte_eth_dev *dev,
 	switch (pf_msg->event) {
 	case I40E_VIRTCHNL_EVENT_RESET_IMPENDING:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event\n");
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 		break;
 	case I40E_VIRTCHNL_EVENT_LINK_CHANGE:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event\n");
drivers/net/mlx4/mlx4.c +2 -2
index 1553b2e..3e57cca 100644
@@ -5448,7 +5448,7 @@ mlx4_dev_link_status_handler(void *arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
@@ -5471,7 +5471,7 @@ mlx4_dev_interrupt_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
drivers/net/mlx5/mlx5_ethdev.c +2 -2
index bf4232a..c76e754 100644
@@ -1069,7 +1069,7 @@ mlx5_dev_link_status_handler(void *arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
@@ -1092,7 +1092,7 @@ mlx5_dev_interrupt_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
drivers/net/nfp/nfp_net.c +1 -1
index d526f34..a2b9056 100644
@@ -1219,7 +1219,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);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	nfp_net_dev_link_status_print(dev);
 
drivers/net/thunderx/nicvf_ethdev.c +1 -1
index b758c9f..c61e171 100644
@@ -108,7 +108,7 @@ nicvf_interrupt(void *arg)
 			nicvf_set_eth_link_status(nic,
 					&nic->eth_dev->data->dev_link);
 		_rte_eth_dev_callback_process(nic->eth_dev,
-				RTE_ETH_EVENT_INTR_LSC);
+				RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	rte_eal_alarm_set(NICVF_INTR_POLL_INTERVAL_MS * 1000,
drivers/net/vhost/rte_eth_vhost.c +3 -3
index c1d09a0..18a0c10 100644
@@ -559,7 +559,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);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	return 0;
 }
@@ -626,7 +626,7 @@ destroy_device(int vid)
 
 	RTE_LOG(INFO, PMD, "Connection closed\n");
 
-	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int
@@ -655,7 +655,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);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE, NULL);
 
 	return 0;
 }
drivers/net/virtio/virtio_ethdev.c +1 -1
index b4dfc0a..2f0065a 100644
@@ -1103,7 +1103,7 @@ virtio_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
 	if (isr & VIRTIO_PCI_ISR_CONFIG) {
 		if (virtio_dev_link_update(dev, 0) == 0)
 			_rte_eth_dev_callback_process(dev,
-						      RTE_ETH_EVENT_INTR_LSC);
+						      RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 }
lib/librte_ether/rte_ethdev.c +4 -1
index c517e88..13ba70d 100644
@@ -2508,7 +2508,7 @@ rte_eth_dev_callback_unregister(uint8_t port_id,
 
 void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-	enum rte_eth_event_type event)
+	enum rte_eth_event_type event, void *cb_arg)
 {
 	struct rte_eth_dev_callback *cb_lst;
 	struct rte_eth_dev_callback dev_cb;
@@ -2519,6 +2519,9 @@ _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 = (void *) cb_arg;
+
 		rte_spinlock_unlock(&rte_eth_dev_cb_lock);
 		dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
 						dev_cb.cb_arg);
lib/librte_ether/rte_ethdev.h +11 -1
index 7218b6f..775e899 100644
@@ -3026,6 +3026,7 @@ enum rte_eth_event_type {
 				/**< queue state event (enabled/disabled) */
 	RTE_ETH_EVENT_INTR_RESET,
 			/**< reset interrupt event, sent to VF on PF reset */
+	RTE_ETH_EVENT_VF_MBOX,  /**< message from the VF received by PF */
 	RTE_ETH_EVENT_MAX       /**< max value of this enum */
 };
 
@@ -3047,6 +3048,11 @@ typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \
  * @param cb_arg
  *  Pointer to the parameters for the registered callback.
  *
+ *  The cb_arg must not be NULL if the application requires
+ *  data to be returned when the callback is processed.
+ *  For the RTE_ETH_EVENT_VF_MBOX data is returned to the
+ *  application.
+ *
  * @return
  *  - On success, zero.
  *  - On failure, a negative value.
@@ -3085,12 +3091,16 @@ int rte_eth_dev_callback_unregister(uint8_t port_id,
  *  Pointer to struct rte_eth_dev.
  * @param event
  *  Eth device interrupt event type.
+ * @param cb_arg
+ *  Update callback parameter to pass data back to user application.
+ *  This allows the user application to decide if a particular function
+ *  is permitted or not.
  *
  * @return
  *  void
  */
 void _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-				enum rte_eth_event_type event);
+				enum rte_eth_event_type event, void *cb_arg);
 
 /**
  * When there is no rx packet coming in Rx Queue for a long time, we can
Signature · 1 line
2.9.0
#35 lore raw

Re: [PATCH v6 1/2] librte_ether: modify internal callback function

2016-10-06 17:48, Bernard Iremonger:

Quoted 19 lines
lib/librte_ether/rte_ethdev.c +4 -1
@@ -2508,7 +2508,7 @@ rte_eth_dev_callback_unregister(uint8_t port_id,
 
 void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-	enum rte_eth_event_type event)
+	enum rte_eth_event_type event, void *cb_arg)
 {
 	struct rte_eth_dev_callback *cb_lst;
 	struct rte_eth_dev_callback dev_cb;
@@ -2519,6 +2519,9 @@ _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 = (void *) cb_arg;
+
 		rte_spinlock_unlock(&rte_eth_dev_cb_lock);
 		dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
 						dev_cb.cb_arg);

[...]

lib/librte_ether/rte_ethdev.h typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \ · line 3054

Quoted 8 lines
lib/librte_ether/rte_ethdev.h +4 -0
@@ -3047,6 +3048,11 @@ typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \
  * @param cb_arg
  *  Pointer to the parameters for the registered callback.
  *
+ *  The cb_arg must not be NULL if the application requires
+ *  data to be returned when the callback is processed.
+ *  For the RTE_ETH_EVENT_VF_MBOX data is returned to the
+ *  application.

This comment is wrong.
You should say that the user data is overwritten in the case of RTE_ETH_EVENT_VF_MBOX. And you should point to where the meaning of this parameter is documented (ixgbe.h) or document it here.

#36 lore raw

Re: [PATCH v6 1/2] librte_ether: modify internal callback function

Hi Thomas,

<snip>

Quoted 36 lines

Subject: Re: [dpdk-dev] [PATCH v6 1/2] librte_ether: modify internal callback function

2016-10-06 17:48, Bernard Iremonger:

Review rte_eth_dev_callback_unregister(uint8_t

Quoted 1 line
(quoted diff) +0 -0
@@ -2508,7 +2508,7 @@ rte_eth_dev_callback_unregister(uint8_t

port_id,

lib/librte_ether/rte_ethdev.c _rte_eth_dev_callback_process(struct

Quoted 9 lines
lib/librte_ether/rte_ethdev.c +1 -1
 void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-	enum rte_eth_event_type event)
+	enum rte_eth_event_type event, void *cb_arg)
 {
 	struct rte_eth_dev_callback *cb_lst;
 	struct rte_eth_dev_callback dev_cb;
@@ -2519,6 +2519,9 @@ _rte_eth_dev_callback_process(struct

rte_eth_dev *dev,

Quoted 9 lines
lib/librte_ether/rte_ethdev.c +3 -0
 			continue;
 		dev_cb = *cb_lst;
 		cb_lst->active = 1;
+		if (cb_arg != NULL)
+			dev_cb.cb_arg = (void *) cb_arg;
+
 		rte_spinlock_unlock(&rte_eth_dev_cb_lock);
 		dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
 						dev_cb.cb_arg);

[...]

Review typedef void (*rte_eth_dev_cb_fn)(uint8_t

Quoted 1 line
(quoted diff) +0 -0
@@ -3047,6 +3048,11 @@ typedef void (*rte_eth_dev_cb_fn)(uint8_t

port_id, \

lib/librte_ether/rte_ethdev.h typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \ · line 3054

Quoted 7 lines
lib/librte_ether/rte_ethdev.h +4 -0
  * @param cb_arg
  *  Pointer to the parameters for the registered callback.
  *
+ *  The cb_arg must not be NULL if the application requires
+ *  data to be returned when the callback is processed.
+ *  For the RTE_ETH_EVENT_VF_MBOX data is returned to the
+ *  application.
Quoted 4 lines

This comment is wrong.
You should say that the user data is overwritten in the case of RTE_ETH_EVENT_VF_MBOX. And you should point to where the meaning of this parameter is documented (ixgbe.h) or document it here.

This is corrected in the v7 patchset.

Regards.

Bernard.

#37 lore raw

PATCH v6 2/2 net/ixgbe: add callback to user app on VF to PF mbox msg

In reply to Bernard Iremonger

call _rte_eth_dev_callback_process from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform the function.
If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue, if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

---
 drivers/net/ixgbe/ixgbe_ethdev.c  |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c      | 42 +++++++++++++++++++++++++++++++++------
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 17 ++++++++++++++++
 3 files changed, 55 insertions(+), 8 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index 55a82d3..91db2c3 100644
@@ -3559,7 +3559,7 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
 		ixgbe_dev_link_update(dev, 0);
 		intr->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE;
 		ixgbe_dev_link_status_print(dev);
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr);
@@ -7525,7 +7525,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);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 }
 
 static int
drivers/net/ixgbe/ixgbe_pf.c +36 -6

89 lines not on this page · raw message

drivers/net/ixgbe/rte_pmd_ixgbe.h +17 -0
index 33b5b2d..2f6cf46 100644
@@ -181,4 +181,21 @@ int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on);
  */
 int
 rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
+
+/**
+ * Response sent back to ixgbe driver from user app after callback
+ */
+enum rte_pmd_ixgbe_mb_event_rsp {
+	RTE_PMD_IXGBE_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+	RTE_PMD_IXGBE_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+	RTE_PMD_IXGBE_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+	RTE_PMD_IXGBE_MB_EVENT_MAX       /**< max value of this enum */
+};
+
+struct rte_pmd_ixgbe_mb_event_param {
+	uint16_t vfid;
+	uint16_t msg_type;
+	uint16_t retval;
+	void *userdata;
+};
 #endif /* _PMD_IXGBE_H_ */
Signature · 1 line
2.9.0
#38 lore raw

Re: [PATCH v6 2/2] net/ixgbe: add callback to user app on VF to PF mbox msg

2016-10-06 17:48, Bernard Iremonger:

Quoted 7 lines

call _rte_eth_dev_callback_process from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform the function.
If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue, if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

[...]

Quoted 12 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
@@ -3559,7 +3559,7 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
 		ixgbe_dev_link_update(dev, 0);
 		intr->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE;
 		ixgbe_dev_link_status_print(dev);
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr);

drivers/net/ixgbe/ixgbe_ethdev.c static void ixgbevf_mbx_process(struct rte_eth_dev *dev) · line 7529

Quoted 6 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
@@ -7525,7 +7525,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);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 }

This piece should go into the patch 1.

#39 lore raw

Re: [PATCH v6 2/2] net/ixgbe: add callback to user app on VF to PF mbox msg

Hi Thomas,

<snip>

Quoted 35 lines

Subject: Re: [dpdk-dev] [PATCH v6 2/2] net/ixgbe: add callback to user app on VF to PF mbox msg

2016-10-06 17:48, Bernard Iremonger:

Quoted 1 line

call _rte_eth_dev_callback_process from ixgbe_rcv_msg_from_vf

function.

Quoted 6 lines

The callback asks the user application if it is allowed to perform the function.
If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue, if 0, do nothing and send ACK to VF if > 1, do nothing and send NAK to VF.

[...]

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_dev_interrupt_delayed_handler(void

Quoted 3 lines
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
@@ -3559,7 +3559,7 @@ ixgbe_dev_interrupt_delayed_handler(void

*param)

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_dev_interrupt_delayed_handler(void *param)

Quoted 4 lines
drivers/net/ixgbe/ixgbe_ethdev.c +0 -1
 		ixgbe_dev_link_update(dev, 0);
 		intr->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE;
 		ixgbe_dev_link_status_print(dev);
-		_rte_eth_dev_callback_process(dev,

RTE_ETH_EVENT_INTR_LSC);

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_dev_interrupt_delayed_handler(void · line 3562

Quoted 1 line
drivers/net/ixgbe/ixgbe_ethdev.c +1 -0
+		_rte_eth_dev_callback_process(dev,

RTE_ETH_EVENT_INTR_LSC, NULL);

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_dev_interrupt_delayed_handler(void · line 3565

Quoted 3 lines
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
 	}
 
 	PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]",

eicr);

drivers/net/ixgbe/ixgbe_ethdev.c static void ixgbevf_mbx_process(struct · line 7529

Quoted 6 lines
drivers/net/ixgbe/ixgbe_ethdev.c +0 -1
@@ -7525,7 +7525,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);

Quoted 5 lines

drivers/net/ixgbe/ixgbe_ethdev.c static void ixgbevf_mbx_process(struct · line 7529

Quoted 1 line
drivers/net/ixgbe/ixgbe_ethdev.c +1 -0
+		_rte_eth_dev_callback_process(dev,

RTE_ETH_EVENT_INTR_RESET, NULL);

drivers/net/ixgbe/ixgbe_ethdev.c static void ixgbevf_mbx_process(struct · line 7530

Quoted 1 line
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
 }

This piece should go into the patch 1.

Ok, I will send a v7.

Regards,

Bernard.

#40 lore raw

PATCH v5 1/13 librte_ether: modify internal callback function

In reply to Bernard Iremonger

add parameter to the _rte_eth_dev_callback_process function.

Adding a parameter to this function allows passing information to the application when an eth device event occurs such as a VF to PF message.
This allows the application to decide if a particular function is permitted.

---
 lib/librte_ether/rte_ethdev.c | 5 ++++-
 lib/librte_ether/rte_ethdev.h | 7 ++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
lib/librte_ether/rte_ethdev.c +4 -1
index c517e88..416ca77 100644
@@ -2508,7 +2508,7 @@ rte_eth_dev_callback_unregister(uint8_t port_id,
 
 void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-	enum rte_eth_event_type event)
+	enum rte_eth_event_type event, void *param)
 {
 	struct rte_eth_dev_callback *cb_lst;
 	struct rte_eth_dev_callback dev_cb;
@@ -2519,6 +2519,9 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
 			continue;
 		dev_cb = *cb_lst;
 		cb_lst->active = 1;
+		if (param != NULL)
+			dev_cb.cb_arg = (void *) param;
+
 		rte_spinlock_unlock(&rte_eth_dev_cb_lock);
 		dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
 						dev_cb.cb_arg);
lib/librte_ether/rte_ethdev.h +6 -1
index 7218b6f..9fb34ca 100644
@@ -3026,6 +3026,7 @@ enum rte_eth_event_type {
 				/**< queue state event (enabled/disabled) */
 	RTE_ETH_EVENT_INTR_RESET,
 			/**< reset interrupt event, sent to VF on PF reset */
+	RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */
 	RTE_ETH_EVENT_MAX       /**< max value of this enum */
 };
 
@@ -3085,12 +3086,16 @@ int rte_eth_dev_callback_unregister(uint8_t port_id,
  *  Pointer to struct rte_eth_dev.
  * @param event
  *  Eth device interrupt event type.
+ * @param param
+ *  Parameter to pass back to user application.
+ *  Allows the user application to decide if a particular function
+ *  is permitted.
  *
  * @return
  *  void
  */
 void _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
-				enum rte_eth_event_type event);
+				enum rte_eth_event_type event, void *param);
 
 /**
  * When there is no rx packet coming in Rx Queue for a long time, we can
Signature · 1 line
2.9.0
#41 lore raw

Re: [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 12:26, Bernard Iremonger:

lib/librte_ether/rte_ethdev.c rte_eth_dev_callback_unregister(uint8_t port_id, · line 2511

Quoted 4 lines

void
_rte_eth_dev_callback_process(struct rte_eth_dev *dev,

lib/librte_ether/rte_ethdev.c +1 -1
-	enum rte_eth_event_type event)
+	enum rte_eth_event_type event, void *param)

You need to squash the patches updating the calls to this function. Otherwise, this patch does not compile.

[...]

lib/librte_ether/rte_ethdev.c _rte_eth_dev_callback_process(struct rte_eth_dev *dev, · line 2523

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +2 -0
+		if (param != NULL)
+			dev_cb.cb_arg = (void *) param;

You are overriding the user parameter.
As it is only for a new event, it can be described in the register API that the user param won't be returned for this event.
But a better design would be to add a new parameter to the callback. However it will be an API breakage.

lib/librte_ether/rte_ethdev.h enum rte_eth_event_type { · line 3029

Quoted 1 line
lib/librte_ether/rte_ethdev.h +1 -0
+	RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */

Sorry I do not parse well this line.
The event name is VF_MBOX and the comment is about the callback processing this event on PF side?
I would suggest this kind of comment: "message from VF received by PF"

[...]

Quoted 7 lines

* Pointer to struct rte_eth_dev.
* @param event
* Eth device interrupt event type.
+ * @param param

+ *  Parameter to pass back to user application.
+ *  Allows the user application to decide if a particular function
+ *  is permitted.

In a more generic case, the parameter gives some details about the event.

#42 lore raw

Re: [PATCH v5 01/13] librte_ether: modify internal callback function

Hi Thomas,

Quoted 11 lines

Subject: Re: [dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 12:26, Bernard Iremonger:

lib/librte_ether/rte_ethdev.c rte_eth_dev_callback_unregister(uint8_t port_id, · line 2511

Quoted 4 lines

void
_rte_eth_dev_callback_process(struct rte_eth_dev *dev,

lib/librte_ether/rte_ethdev.c +1 -1
-	enum rte_eth_event_type event)
+	enum rte_eth_event_type event, void *param)

You need to squash the patches updating the calls to this function. Otherwise, this patch does not compile.

I will have to squash everything into one patch, separate patches will not compile.

Quoted 5 lines

[...]

lib/librte_ether/rte_ethdev.c _rte_eth_dev_callback_process(struct rte_eth_dev *dev, · line 2523

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +2 -0
+		if (param != NULL)
+			dev_cb.cb_arg = (void *) param;

You are overriding the user parameter.

Yes, we want to update the user parameter for the RTE_ETH_EVENT_VF_MBOX

Quoted 2 lines

As it is only for a new event, it can be described in the register API that the user param won't be returned for this event.

I will add a description in the rte_eth_dev_callback_register function.

Quoted 2 lines

But a better design would be to add a new parameter to the callback. However it will be an API breakage.

I do not want to break the ABI at this point.

Quoted 7 lines

lib/librte_ether/rte_ethdev.h enum rte_eth_event_type { · line 3029

Quoted 2 lines
lib/librte_ether/rte_ethdev.h +1 -0
+	RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */

Sorry I do not parse well this line.
The event name is VF_MBOX and the comment is about the callback processing this event on PF side?
I would suggest this kind of comment: "message from VF received by PF"

Ok.

Quoted 11 lines

[...]

Quoted 7 lines

* Pointer to struct rte_eth_dev.
* @param event
* Eth device interrupt event type.
+ * @param param

+ *  Parameter to pass back to user application.
+ *  Allows the user application to decide if a particular function
+ *  is permitted.

In a more generic case, the parameter gives some details about the event.

#43 lore raw

Re: [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 14:33, Iremonger, Bernard:

Quoted 14 lines

Hi Thomas,

Quoted 11 lines

Subject: Re: [dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 12:26, Bernard Iremonger:

lib/librte_ether/rte_ethdev.c rte_eth_dev_callback_unregister(uint8_t port_id, · line 2511

Quoted 4 lines

void
_rte_eth_dev_callback_process(struct rte_eth_dev *dev,

lib/librte_ether/rte_ethdev.c +1 -1
-	enum rte_eth_event_type event)
+	enum rte_eth_event_type event, void *param)

You need to squash the patches updating the calls to this function. Otherwise, this patch does not compile.

Quoted 1 line

I will have to squash everything into one patch, separate patches will not compile.

No you can keep a separate patch for the VF event in ixgbe.

Quoted 11 lines
Quoted 5 lines

[...]

lib/librte_ether/rte_ethdev.c _rte_eth_dev_callback_process(struct rte_eth_dev *dev, · line 2523

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +2 -0
+		if (param != NULL)
+			dev_cb.cb_arg = (void *) param;

You are overriding the user parameter.

Yes, we want to update the user parameter for the RTE_ETH_EVENT_VF_MBOX

Quoted 2 lines

As it is only for a new event, it can be described in the register API that the user param won't be returned for this event.

Quoted 6 lines

I will add a description in the rte_eth_dev_callback_register function.

Quoted 2 lines

But a better design would be to add a new parameter to the callback. However it will be an API breakage.

I do not want to break the ABI at this point.

Yes, but it can be considered for a later change.

Quoted 7 lines
Quoted 6 lines

lib/librte_ether/rte_ethdev.h enum rte_eth_event_type { · line 3029

Quoted 1 line
lib/librte_ether/rte_ethdev.h +1 -0
+	RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */

Sorry I do not parse well this line.
The event name is VF_MBOX and the comment is about the callback processing this event on PF side?
I would suggest this kind of comment: "message from VF received by PF"

Quoted 13 lines

Ok.

Quoted 11 lines

[...]

Quoted 7 lines

* Pointer to struct rte_eth_dev.
* @param event
* Eth device interrupt event type.
+ * @param param

+ *  Parameter to pass back to user application.
+ *  Allows the user application to decide if a particular function
+ *  is permitted.

In a more generic case, the parameter gives some details about the event.

Please consider a rewording here, thanks.

#44 lore raw

Re: [PATCH v5 01/13] librte_ether: modify internal callback function

Hi Thomas,

<snip>

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

Subject: Re: [dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 12:26, Bernard Iremonger:

lib/librte_ether/rte_ethdev.c rte_eth_dev_callback_unregister(uint8_t port_id, · line 2511

Quoted 4 lines

void
_rte_eth_dev_callback_process(struct rte_eth_dev *dev,

lib/librte_ether/rte_ethdev.c +1 -1
-	enum rte_eth_event_type event)
+	enum rte_eth_event_type event, void *param)

You need to squash the patches updating the calls to this function. Otherwise, this patch does not compile.

Quoted 4 lines
Quoted 1 line

I will have to squash everything into one patch, separate patches will not

compile.

No you can keep a separate patch for the VF event in ixgbe.

I have 4 patches at present

librte_ether
net/ixgbe
drivers/net
app/test

Would this be acceptable or do you just want everything squashed into librte_ether except for net/ixgbe?

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

[...]

lib/librte_ether/rte_ethdev.c _rte_eth_dev_callback_process(struct rte_eth_dev *dev, · line 2523

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +2 -0
+		if (param != NULL)
+			dev_cb.cb_arg = (void *) param;

You are overriding the user parameter.

Yes, we want to update the user parameter for the
RTE_ETH_EVENT_VF_MBOX

I have renamed param to cb_arg to make it clearer what is happening.

Quoted 11 lines
Quoted 9 lines
Quoted 2 lines

As it is only for a new event, it can be described in the register API that the user param won't be returned for this event.

I will add a description in the rte_eth_dev_callback_register function.

Quoted 2 lines

But a better design would be to add a new parameter to the callback. However it will be an API breakage.

I do not want to break the ABI at this point.

Yes, but it can be considered for a later change.

Yes, ok

Quoted 20 lines
Quoted 20 lines
Quoted 6 lines

lib/librte_ether/rte_ethdev.h enum rte_eth_event_type { · line 3029

Quoted 1 line
lib/librte_ether/rte_ethdev.h +1 -0
+	RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */

Sorry I do not parse well this line.
The event name is VF_MBOX and the comment is about the callback processing this event on PF side?
I would suggest this kind of comment: "message from VF received by PF"

Ok.

Quoted 11 lines

[...]

Quoted 8 lines

* Pointer to struct rte_eth_dev.
* @param event
* Eth device interrupt event type.
+ * @param param
+ * Parameter to pass back to user application.
+ * Allows the user application to decide if a particular
+ function
+ * is permitted.

Quoted 4 lines
Quoted 1 line
Quoted 1 line

In a more generic case, the parameter gives some details about the

event.

Please consider a rewording here, thanks.

I have reworded here, I hope it is clearer.

Regards,

Bernard.

#45 lore raw

Re: [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 15:32, Iremonger, Bernard:

Quoted 14 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

2016-10-06 12:26, Bernard Iremonger:

lib/librte_ether/rte_ethdev.c rte_eth_dev_callback_unregister(uint8_t port_id, · line 2511

Quoted 4 lines

void
_rte_eth_dev_callback_process(struct rte_eth_dev *dev,

lib/librte_ether/rte_ethdev.c +1 -1
-	enum rte_eth_event_type event)
+	enum rte_eth_event_type event, void *param)

You need to squash the patches updating the calls to this function. Otherwise, this patch does not compile.

Quoted 4 lines
Quoted 1 line

I will have to squash everything into one patch, separate patches will not

compile.

No you can keep a separate patch for the VF event in ixgbe.

Quoted 8 lines

I have 4 patches at present

librte_ether
net/ixgbe
drivers/net
app/test

Would this be acceptable or do you just want everything squashed into librte_ether except for net/ixgbe?

You can test the compilation of each patch with this command:
git rebase -i origin/master -x scripts/test-build.sh
or just:
git rebase -i origin/master -x make

I think you need to squash drivers/net (adding just NULL param) and app/test in ethdev patch.

#46 lore raw

Re: [PATCH v5 01/13] librte_ether: modify internal callback function

Hi Thomas,

Quoted 27 lines

Subject: Re: [dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function

2016-10-06 15:32, Iremonger, Bernard:

Quoted 15 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

2016-10-06 12:26, Bernard Iremonger:

lib/librte_ether/rte_ethdev.c rte_eth_dev_callback_unregister(uint8_t port_id, · line 2511

Quoted 4 lines

void
_rte_eth_dev_callback_process(struct rte_eth_dev *dev,

lib/librte_ether/rte_ethdev.c +1 -1
-	enum rte_eth_event_type event)
+	enum rte_eth_event_type event, void *param)

You need to squash the patches updating the calls to this function. Otherwise, this patch does not compile.

Quoted 5 lines
Quoted 2 lines

I will have to squash everything into one patch, separate patches will not

compile.

No you can keep a separate patch for the VF event in ixgbe.

Quoted 8 lines

I have 4 patches at present

librte_ether
net/ixgbe
drivers/net
app/test

Would this be acceptable or do you just want everything squashed into

Quoted 8 lines

librte_ether except for net/ixgbe?

You can test the compilation of each patch with this command:
git rebase -i origin/master -x scripts/test-build.sh or just:
git rebase -i origin/master -x make

I think you need to squash drivers/net (adding just NULL param) and app/test in ethdev patch.

They do not compile if applied one by one.
Ok, I will squash drivers/net and app/test into the librte_ether patch.

Regards,

Bernard.

#47 lore raw

PATCH v5 2/13 net/ixgbe: add callback to user app on VF to PF mbox msg

In reply to Bernard Iremonger

call _rte_eth_dev_callback_process from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform the function.
If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue, if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

---
 drivers/net/ixgbe/ixgbe_ethdev.c  |  4 ++--
 drivers/net/ixgbe/ixgbe_pf.c      | 42 +++++++++++++++++++++++++++++++++------
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 17 ++++++++++++++++
 3 files changed, 55 insertions(+), 8 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index 55a82d3..91db2c3 100644
@@ -3559,7 +3559,7 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
 		ixgbe_dev_link_update(dev, 0);
 		intr->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE;
 		ixgbe_dev_link_status_print(dev);
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr);
@@ -7525,7 +7525,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);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 }
 
 static int
drivers/net/ixgbe/ixgbe_pf.c +36 -6

89 lines not on this page · raw message

drivers/net/ixgbe/rte_pmd_ixgbe.h +17 -0
index 33b5b2d..2f6cf46 100644
@@ -181,4 +181,21 @@ int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on);
  */
 int
 rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
+
+/**
+ * Response sent back to ixgbe driver from user app after callback
+ */
+enum rte_pmd_ixgbe_mb_event_rsp {
+	RTE_PMD_IXGBE_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+	RTE_PMD_IXGBE_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+	RTE_PMD_IXGBE_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+	RTE_PMD_IXGBE_MB_EVENT_MAX       /**< max value of this enum */
+};
+
+struct rte_pmd_ixgbe_mb_event_param {
+	uint16_t vfid;
+	uint16_t msg_type;
+	uint16_t retval;
+	void *userdata;
+};
 #endif /* _PMD_IXGBE_H_ */
Signature · 1 line
2.9.0
#48 lore raw

PATCH v5 3/13 app/test: add parameter to callback process function

In reply to Bernard Iremonger

add parameter to call of _rte_eth_dev_callback_process function

---
 app/test/virtual_pmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/virtual_pmd.c +1 -1
index 4831113..65b44c6 100644
@@ -485,7 +485,7 @@ virtual_ethdev_simulate_link_status_interrupt(uint8_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);
+	_rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 int
Signature · 1 line
2.9.0
#49 lore raw

PATCH v5 4/13 net/bonding: add parameter to callback process function

In reply to Bernard Iremonger

add parameter to call of _rte_eth_dev_callback_process function

---
 drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +3 -3
index 292086a..0913020 100644
@@ -1958,7 +1958,7 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
 		return;
 
 	_rte_eth_dev_callback_process((struct rte_eth_dev *)arg,
-			RTE_ETH_EVENT_INTR_LSC);
+			RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 void
@@ -2079,7 +2079,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
 						(void *)bonded_eth_dev);
 			else
 				_rte_eth_dev_callback_process(bonded_eth_dev,
-						RTE_ETH_EVENT_INTR_LSC);
+						RTE_ETH_EVENT_INTR_LSC, NULL);
 
 		} else {
 			if (internals->link_down_delay_ms > 0)
@@ -2088,7 +2088,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
 						(void *)bonded_eth_dev);
 			else
 				_rte_eth_dev_callback_process(bonded_eth_dev,
-						RTE_ETH_EVENT_INTR_LSC);
+						RTE_ETH_EVENT_INTR_LSC, NULL);
 		}
 	}
 }
Signature · 1 line
2.9.0
#50 lore raw

PATCH v5 5/13 net/e1000: add parameter to callback process function

In reply to Bernard Iremonger

add parameter to call of _rte_eth_dev_callback_process function

---
 drivers/net/e1000/em_ethdev.c  | 2 +-
 drivers/net/e1000/igb_ethdev.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/e1000/em_ethdev.c +1 -1
index f767e1c..e13e858 100644
@@ -1599,7 +1599,7 @@ eth_em_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
 
 	eth_em_interrupt_get_status(dev);
 	eth_em_interrupt_action(dev);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int
drivers/net/e1000/igb_ethdev.c +2 -2
index 5a1a83e..d9ab2df 100644
@@ -2683,7 +2683,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev)
 		E1000_WRITE_REG(hw, E1000_TCTL, tctl);
 		E1000_WRITE_REG(hw, E1000_RCTL, rctl);
 		E1000_WRITE_FLUSH(hw);
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	return 0;
@@ -2743,7 +2743,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);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 }
 
 static int
Signature · 1 line
2.9.0
#51 lore raw

PATCH v5 6/13 net/i40e: update call to callback process function

In reply to Bernard Iremonger

add parameter to call of _rte_eth_dev_callback_process function

---
 drivers/net/i40e/i40e_ethdev.c    | 4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_ethdev.c +2 -2
index 697800e..d947760 100644
@@ -5510,7 +5510,7 @@ i40e_dev_interrupt_delayed_handler(void *param)
 
 	/* handle the link up interrupt in an alarm callback */
 	i40e_dev_link_update(dev, 0);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	i40e_pf_enable_irq0(hw);
 	rte_intr_enable(&(dev->pci_dev->intr_handle));
@@ -5594,7 +5594,7 @@ i40e_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
 			return;
 		else
 			_rte_eth_dev_callback_process(dev,
-				RTE_ETH_EVENT_INTR_LSC);
+				RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 done:
drivers/net/i40e/i40e_ethdev_vf.c +1 -1
index 34eb274..bd89cd9 100644
@@ -1341,7 +1341,7 @@ i40evf_handle_pf_event(__rte_unused struct rte_eth_dev *dev,
 	switch (pf_msg->event) {
 	case I40E_VIRTCHNL_EVENT_RESET_IMPENDING:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event\n");
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
 		break;
 	case I40E_VIRTCHNL_EVENT_LINK_CHANGE:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event\n");
Signature · 1 line
2.9.0
#52 lore raw

PATCH v5 7/13 net/mlx4: add parameter to callback process function

In reply to Bernard Iremonger

add parameter to call of _rte_eth_dev_callback_process function

---
 drivers/net/mlx4/mlx4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx4/mlx4.c +2 -2
index 1553b2e..3e57cca 100644
@@ -5448,7 +5448,7 @@ mlx4_dev_link_status_handler(void *arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
@@ -5471,7 +5471,7 @@ mlx4_dev_interrupt_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
Signature · 1 line
2.9.0
#53 lore raw

PATCH v5 8/13 net/mlx5: add parameter to callback process function

In reply to Bernard Iremonger

add parameter to call of _rte_eth_dev_callback_process function

---
 drivers/net/mlx5/mlx5_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_ethdev.c +2 -2
index bf4232a..c76e754 100644
@@ -1069,7 +1069,7 @@ mlx5_dev_link_status_handler(void *arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
@@ -1092,7 +1092,7 @@ mlx5_dev_interrupt_handler(struct rte_intr_handle *intr_handle, void *cb_arg)
 	ret = priv_dev_link_status_handler(priv, dev);
 	priv_unlock(priv);
 	if (ret)
-		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 /**
Signature · 1 line
2.9.0
#54 lore raw

PATCH v5 9/13 net/nfp: add parameter to callback process function

In reply to Bernard Iremonger

add parameter to call of _rte_eth_dev_callback_process function

---
 drivers/net/nfp/nfp_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/nfp/nfp_net.c +1 -1
index d526f34..a2b9056 100644
@@ -1219,7 +1219,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);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	nfp_net_dev_link_status_print(dev);
 
Signature · 1 line
2.9.0
#55 lore raw

PATCH v5 10/13 net/thunderx: add parameter to callback process function

In reply to Bernard Iremonger

add parameter to call of _rte_eth_dev_callback_process function

---
 drivers/net/thunderx/nicvf_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/thunderx/nicvf_ethdev.c +1 -1
index b758c9f..c61e171 100644
@@ -108,7 +108,7 @@ nicvf_interrupt(void *arg)
 			nicvf_set_eth_link_status(nic,
 					&nic->eth_dev->data->dev_link);
 		_rte_eth_dev_callback_process(nic->eth_dev,
-				RTE_ETH_EVENT_INTR_LSC);
+				RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 	rte_eal_alarm_set(NICVF_INTR_POLL_INTERVAL_MS * 1000,
Signature · 1 line
2.9.0
#56 lore raw

PATCH v5 11/13 net/vhost: add parameter to callback process function

In reply to Bernard Iremonger

add parameter to call of _rte_eth_dev_callback_process function

---
 drivers/net/vhost/rte_eth_vhost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/vhost/rte_eth_vhost.c +3 -3
index 409e090..421cdba 100644
@@ -559,7 +559,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);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 
 	return 0;
 }
@@ -626,7 +626,7 @@ destroy_device(int vid)
 
 	RTE_LOG(INFO, PMD, "Connection closed\n");
 
-	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 static int
@@ -655,7 +655,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);
+	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE, NULL);
 
 	return 0;
 }
Signature · 1 line
2.9.0
#57 lore raw

PATCH v5 12/13 net/virtio: add parameter to callback process function

In reply to Bernard Iremonger

add parameter to call of _rte_eth_dev_callback_process function

---
 drivers/net/virtio/virtio_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_ethdev.c +1 -1
index b4dfc0a..2f0065a 100644
@@ -1103,7 +1103,7 @@ virtio_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
 	if (isr & VIRTIO_PCI_ISR_CONFIG) {
 		if (virtio_dev_link_update(dev, 0) == 0)
 			_rte_eth_dev_callback_process(dev,
-						      RTE_ETH_EVENT_INTR_LSC);
+						      RTE_ETH_EVENT_INTR_LSC, NULL);
 	}
 
 }
Signature · 1 line
2.9.0
#58 lore raw

PATCH v5 13/13 net/enic: add parameter to callback process function

In reply to Bernard Iremonger

add parameter to call of _rte_eth_dev_callback_process function

---
 drivers/net/enic/enic_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/enic/enic_main.c +1 -1
index 15a05b4..fb72491 100644
@@ -436,7 +436,7 @@ enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
 	vnic_intr_return_all_credits(&enic->intr);
 
 	enic_link_update(enic);
-	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC);
+	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	enic_log_q_error(enic);
 }
 
Signature · 1 line
2.9.0
#59 lore raw

PATCH v4 1/2 librte_ether: add internal callback functions

In reply to Bernard Iremonger

add _rte_eth_dev_callback_process_vf function. add _rte_eth_dev_callback_process_generic function

Adding a callback to the user application on VF to PF mailbox message, allows passing information to the application controlling the PF when a VF mailbox event message is received, such as VF reset.

---
 lib/librte_ether/rte_ethdev.c          | 17 +++++++++++++
 lib/librte_ether/rte_ethdev.h          | 44 ++++++++++++++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  2 ++
 3 files changed, 63 insertions(+)
lib/librte_ether/rte_ethdev.c +17 -0
index c517e88..e850d88 100644
@@ -2510,6 +2510,20 @@ void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
 	enum rte_eth_event_type event)
 {
+	return _rte_eth_dev_callback_process_generic(dev, event, NULL);
+}
+
+void
+_rte_eth_dev_callback_process_vf(struct rte_eth_dev *dev,
+	enum rte_eth_event_type event, void *param)
+{
+	return _rte_eth_dev_callback_process_generic(dev, event, param);
+}
+
+void
+_rte_eth_dev_callback_process_generic(struct rte_eth_dev *dev,
+	enum rte_eth_event_type event, void *param)
+{
 	struct rte_eth_dev_callback *cb_lst;
 	struct rte_eth_dev_callback dev_cb;
 
@@ -2519,6 +2533,9 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
 			continue;
 		dev_cb = *cb_lst;
 		cb_lst->active = 1;
+		if (param != NULL)
+			dev_cb.cb_arg = (void *) param;
+
 		rte_spinlock_unlock(&rte_eth_dev_cb_lock);
 		dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
 						dev_cb.cb_arg);
lib/librte_ether/rte_ethdev.h +44 -0

56 lines not on this page · raw message

lib/librte_ether/rte_ether_version.map +2 -0
index 72be66d..6f97a8f 100644
@@ -143,6 +143,8 @@ DPDK_16.07 {
 DPDK_16.11 {
 	global:
 
+	_rte_eth_dev_callback_process_generic;
+	_rte_eth_dev_callback_process_vf;
 	rte_eth_dev_pci_probe;
 	rte_eth_dev_pci_remove;
 
Signature · 1 line
2.9.0
#60 lore raw

Re: [PATCH v4 1/2] librte_ether: add internal callback functions

2016-10-04 15:52, Bernard Iremonger:

Quoted 6 lines

add _rte_eth_dev_callback_process_vf function. add _rte_eth_dev_callback_process_generic function

Adding a callback to the user application on VF to PF mailbox message, allows passing information to the application controlling the PF when a VF mailbox event message is received, such as VF reset.

I have some difficulties to parse this explanation. Please could you reword it and precise the direction of the message and the use case context?

Quoted 5 lines
lib/librte_ether/rte_ethdev.c +0 -0
@@ -2510,6 +2510,20 @@ void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
 	enum rte_eth_event_type event)

lib/librte_ether/rte_ethdev.c void · line 2521

Quoted 10 lines
lib/librte_ether/rte_ethdev.c +9 -0
 {
+	return _rte_eth_dev_callback_process_generic(dev, event, NULL);
+}
+
+void
+_rte_eth_dev_callback_process_vf(struct rte_eth_dev *dev,
+	enum rte_eth_event_type event, void *param)
+{
+	return _rte_eth_dev_callback_process_generic(dev, event, param);
+}

This function is just adding a parameter, compared to the legacy _rte_eth_dev_callback_process.
Why calling it process_vf?
And by the way, why not just replacing the legacy function? As it is a driver interface, there is no ABI restriction.

Quoted 5 lines
lib/librte_ether/rte_ethdev.c +5 -0
+
+void
+_rte_eth_dev_callback_process_generic(struct rte_eth_dev *dev,
+	enum rte_eth_event_type event, void *param)
+{

[...]

lib/librte_ether/rte_ethdev.h enum rte_eth_event_type { · line 3031

Quoted 9 lines
lib/librte_ether/rte_ethdev.h +1 -0
@@ -3026,6 +3026,7 @@ enum rte_eth_event_type {
 				/**< queue state event (enabled/disabled) */
 	RTE_ETH_EVENT_INTR_RESET,
 			/**< reset interrupt event, sent to VF on PF reset */
+	RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */
 	RTE_ETH_EVENT_MAX       /**< max value of this enum */
 };

Either we choose to have a "generic" VF event well documented, or it is just a specific event with a tip on where to find the doc. Here we need at least to know how to handle the argument.

Quoted 10 lines
lib/librte_ether/rte_ethdev.h +10 -0
+/**
+ * @internal Executes all the user application registered callbacks. Used by:
+ * _rte_eth_dev_callback_process and _rte_eth_dev_callback_process_vf
+ * It is for DPDK internal user only. User application should not call it
+ * directly.
+ *
+ * @param dev
+ *  Pointer to struct rte_eth_dev.
+ * @param event
+ *  Eth device interrupt event type.

lib/librte_ether/rte_ethdev.h void _rte_eth_dev_callback_process(struct rte_eth_dev *dev, · line 3137

Quoted 10 lines
lib/librte_ether/rte_ethdev.h +10 -0
+ *
+ * @param param
+ *  parameters to pass back to user application.
+ *
+ * @return
+ *  void
+ */
+void
+_rte_eth_dev_callback_process_generic(struct rte_eth_dev *dev,
+				enum rte_eth_event_type event, void *param);

This is really an internal function and should not be exported at all.

#61 lore raw

Re: [PATCH v4 1/2] librte_ether: add internal callback functions

Hi Thomas,

<snip>

Quoted 7 lines

Subject: Re: [dpdk-dev] [PATCH v4 1/2] librte_ether: add internal callback functions

2016-10-04 15:52, Bernard Iremonger:

Quoted 3 lines

add _rte_eth_dev_callback_process_vf function. add _rte_eth_dev_callback_process_generic function

Quoted 7 lines
Quoted 3 lines

Adding a callback to the user application on VF to PF mailbox message, allows passing information to the application controlling the PF when a VF mailbox event message is received, such as VF reset.

I have some difficulties to parse this explanation.
Please could you reword it and precise the direction of the message and the use case context?

I will reword the explanation and add use case context.

Quoted 14 lines

lib/librte_ether/rte_ethdev.c void · line 2518

Quoted 12 lines
lib/librte_ether/rte_ethdev.c +6 -0
@@ -2510,6 +2510,20 @@ void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
 	enum rte_eth_event_type event)
 {
+	return _rte_eth_dev_callback_process_generic(dev, event, NULL); }
+
+void
+_rte_eth_dev_callback_process_vf(struct rte_eth_dev *dev,
+	enum rte_eth_event_type event, void *param) {
+	return _rte_eth_dev_callback_process_generic(dev, event, param);

}

Quoted 3 lines

This function is just adding a parameter, compared to the legacy _rte_eth_dev_callback_process.
Why calling it process_vf?

The parameter is just being added for the VF event, the handling of the other events is unchanged.

Quoted 2 lines

And by the way, why not just replacing the legacy function? As it is a driver interface, there is no ABI restriction.

I thought there would be an ABI issue if the legacy function is replaced.
The _rte_eth_dev_callback_process is exported in DPDK 2.2 and used in the following PMD's, lib and app:

app/test/virtual_pmd
drivers/net/e1000
drivers/net/ixgbe
drivers/net/mlx5
drivers/net/vhost
drivers/net/virtio
lib/librte_ether

Adding a parameter to _rte_eth_dev_callback_process() will impact all of the above.
Will this cause an ABI issue?

Quoted 10 lines
Quoted 4 lines
lib/librte_ether/rte_ethdev.c +4 -0
+
+void
+_rte_eth_dev_callback_process_generic(struct rte_eth_dev *dev,
+	enum rte_eth_event_type event, void *param) {

[...]

lib/librte_ether/rte_ethdev.h enum rte_eth_event_type { · line 3026

Quoted 4 lines
lib/librte_ether/rte_ethdev.h +0 -0
@@ -3026,6 +3026,7 @@ enum rte_eth_event_type {
 				/**< queue state event (enabled/disabled)

*/

Quoted 9 lines

lib/librte_ether/rte_ethdev.h enum rte_eth_event_type { · line 3031

Quoted 5 lines
lib/librte_ether/rte_ethdev.h +1 -0
 	RTE_ETH_EVENT_INTR_RESET,
 			/**< reset interrupt event, sent to VF on PF reset */
+	RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */
 	RTE_ETH_EVENT_MAX       /**< max value of this enum */
 };

Either we choose to have a "generic" VF event well documented, or it is just a specific event with a tip on where to find the doc.
Here we need at least to know how to handle the argument.

It is a specific event for VF to PF messages, details on the function and arguments are in the rte_ethdev.h file.

Quoted 25 lines

lib/librte_ether/rte_ethdev.h enum rte_eth_event_type {

Quoted 2 lines
lib/librte_ether/rte_ethdev.h +2 -0
+/**
+ * @internal Executes all the user application registered callbacks. Used

by:

Quoted 1 line

+ * _rte_eth_dev_callback_process and

_rte_eth_dev_callback_process_vf

Quoted 8 lines

+ * It is for DPDK internal user only. User application should not

lib/librte_ether/rte_ethdev.h +7 -0
+call it
+ * directly.
+ *
+ * @param dev
+ *  Pointer to struct rte_eth_dev.
+ * @param event
+ *  Eth device interrupt event type.

lib/librte_ether/rte_ethdev.h void _rte_eth_dev_callback_process(struct rte_eth_dev *dev,

Quoted 10 lines
lib/librte_ether/rte_ethdev.h +10 -0
+ *
+ * @param param
+ *  parameters to pass back to user application.
+ *
+ * @return
+ *  void
+ */
+void
+_rte_eth_dev_callback_process_generic(struct rte_eth_dev *dev,
+				enum rte_eth_event_type event, void

*param);

Quoted 1 line

This is really an internal function and should not be exported at all.

Both new functions are internal I will make them static and remove them from the map file. When the functions are made static, should the function declarations be moved from rte_ethdev.h to rte_ethdev.c ?

Thanks for the review.

Regards,

Bernard.

#62 lore raw

Re: [PATCH v4 1/2] librte_ether: add internal callback functions

2016-10-05 17:04, Iremonger, Bernard:

Quoted 34 lines
Quoted 14 lines

lib/librte_ether/rte_ethdev.c void · line 2518

Quoted 12 lines
lib/librte_ether/rte_ethdev.c +6 -0
@@ -2510,6 +2510,20 @@ void
 _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
 	enum rte_eth_event_type event)
 {
+	return _rte_eth_dev_callback_process_generic(dev, event, NULL); }
+
+void
+_rte_eth_dev_callback_process_vf(struct rte_eth_dev *dev,
+	enum rte_eth_event_type event, void *param) {
+	return _rte_eth_dev_callback_process_generic(dev, event, param);

}

Quoted 3 lines

This function is just adding a parameter, compared to the legacy _rte_eth_dev_callback_process.
Why calling it process_vf?

The parameter is just being added for the VF event, the handling of the other events is unchanged.

Quoted 2 lines

And by the way, why not just replacing the legacy function? As it is a driver interface, there is no ABI restriction.

I thought there would be an ABI issue if the legacy function is replaced.
The _rte_eth_dev_callback_process is exported in DPDK 2.2 and used in the following PMD's, lib and app:

app/test/virtual_pmd
drivers/net/e1000
drivers/net/ixgbe
drivers/net/mlx5
drivers/net/vhost
drivers/net/virtio
lib/librte_ether

Quoted 2 lines

Adding a parameter to _rte_eth_dev_callback_process() will impact all of the above.
Will this cause an ABI issue?

No because ABI is for applications (Application Binary Interface). Here you are just changing the driver interface. And we have no commitment to maintain the compatibility of this interface for external drivers.

Quoted 15 lines
Quoted 5 lines

lib/librte_ether/rte_ethdev.h enum rte_eth_event_type { · line 3026

Quoted 4 lines
lib/librte_ether/rte_ethdev.h +0 -0
@@ -3026,6 +3026,7 @@ enum rte_eth_event_type {
 				/**< queue state event (enabled/disabled)

*/

Quoted 9 lines

lib/librte_ether/rte_ethdev.h enum rte_eth_event_type { · line 3031

Quoted 5 lines
lib/librte_ether/rte_ethdev.h +1 -0
 	RTE_ETH_EVENT_INTR_RESET,
 			/**< reset interrupt event, sent to VF on PF reset */
+	RTE_ETH_EVENT_VF_MBOX,  /**< PF mailbox processing callback */
 	RTE_ETH_EVENT_MAX       /**< max value of this enum */
 };

Either we choose to have a "generic" VF event well documented, or it is just a specific event with a tip on where to find the doc.
Here we need at least to know how to handle the argument.

Quoted 1 line

It is a specific event for VF to PF messages, details on the function and arguments are in the rte_ethdev.h file.

No I think it is only explained in the ixgbe code.

#63 lore raw

PATCH v4 2/2 net/ixgbe: add callback to user app on VF to PF mbox msg

In reply to Bernard Iremonger

call _rte_eth_dev_callback_process_vf from ixgbe_rcv_msg_from_vf function.

The callback asks the user application if it is allowed to perform the function.
If the cb_param.retval is RTE_PMD_IXGBE_MB_EVENT_PROCEED then continue, if 0, do nothing and send ACK to VF
if > 1, do nothing and send NAK to VF.

---
 drivers/net/ixgbe/ixgbe_pf.c      | 42 +++++++++++++++++++++++++++++++++------
 drivers/net/ixgbe/rte_pmd_ixgbe.h | 17 ++++++++++++++++
 2 files changed, 53 insertions(+), 6 deletions(-)
drivers/net/ixgbe/ixgbe_pf.c +36 -6
index 56393ff..5277517 100644
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,7 @@
 
 #include "base/ixgbe_common.h"
 #include "ixgbe_ethdev.h"
+#include "rte_pmd_ixgbe.h"
 
 #define IXGBE_MAX_VFTA     (128)
 #define IXGBE_VF_MSG_SIZE_DEFAULT 1
@@ -660,6 +661,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ixgbe_vf_info *vfinfo =
 		*IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+	struct rte_pmd_ixgbe_mb_event_param cb_param;
 
 	retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
 	if (retval) {
@@ -674,27 +676,54 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 	/* flush the ack before we write any messages back */
 	IXGBE_WRITE_FLUSH(hw);
 
+	/**
+	 * initialise structure to send to user application
+	 * will return response from user in retval field
+	 */
+	cb_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
+	cb_param.vfid = vf;
+	cb_param.msg_type = msgbuf[0] & 0xFFFF;
+	cb_param.userdata = (void *)msgbuf;
+
 	/* perform VF reset */
 	if (msgbuf[0] == IXGBE_VF_RESET) {
 		int ret = ixgbe_vf_reset(dev, vf, msgbuf);
 
 		vfinfo[vf].clear_to_send = true;
+
+		/* notify application about VF reset */
+		_rte_eth_dev_callback_process_vf(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
 		return ret;
 	}
 
+	/**
+	 * ask user application if we allowed to perform those functions
+	 * if we get cb_param.retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED
+	 * then business as usual,
+	 * if 0, do nothing and send ACK to VF
+	 * if cb_param.retval > 1, do nothing and send NAK to VF
+	 */
+	_rte_eth_dev_callback_process_vf(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
+
+	retval = cb_param.retval;
+
 	/* check & process VF to PF mailbox message */
 	switch ((msgbuf[0] & 0xFFFF)) {
 	case IXGBE_VF_SET_MAC_ADDR:
-		retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_vf_set_mac_addr(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_SET_MULTICAST:
-		retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_vf_set_multicast(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_SET_LPE:
-		retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_set_vf_lpe(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_SET_VLAN:
-		retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
 		break;
 	case IXGBE_VF_API_NEGOTIATE:
 		retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
@@ -704,7 +733,8 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 		msg_size = IXGBE_VF_GET_QUEUE_MSG_SIZE;
 		break;
 	case IXGBE_VF_UPDATE_XCAST_MODE:
-		retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
+		if (retval == RTE_PMD_IXGBE_MB_EVENT_PROCEED)
+			retval = ixgbe_set_vf_mc_promisc(dev, vf, msgbuf);
 		break;
 	default:
 		PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);
drivers/net/ixgbe/rte_pmd_ixgbe.h +17 -0
index 33b5b2d..2f6cf46 100644
@@ -181,4 +181,21 @@ int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on);
  */
 int
 rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
+
+/**
+ * Response sent back to ixgbe driver from user app after callback
+ */
+enum rte_pmd_ixgbe_mb_event_rsp {
+	RTE_PMD_IXGBE_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+	RTE_PMD_IXGBE_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+	RTE_PMD_IXGBE_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+	RTE_PMD_IXGBE_MB_EVENT_MAX       /**< max value of this enum */
+};
+
+struct rte_pmd_ixgbe_mb_event_param {
+	uint16_t vfid;
+	uint16_t msg_type;
+	uint16_t retval;
+	void *userdata;
+};
 #endif /* _PMD_IXGBE_H_ */
Signature · 1 line
2.9.0