From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 384F22C56 for ; Thu, 6 Oct 2016 13:26:43 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP; 06 Oct 2016 04:26:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,453,1473145200"; d="scan'208";a="769514648" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by FMSMGA003.fm.intel.com with ESMTP; 06 Oct 2016 04:26:36 -0700 From: Bernard Iremonger To: dev@dpdk.org, rahul.r.shah@intel.com, wenzhuo.lu@intel.com, az5157@att.com, jerin.jacob@caviumnetworks.com Cc: Bernard Iremonger Date: Thu, 6 Oct 2016 12:26:19 +0100 Message-Id: <1475753191-17391-2-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1475592734-22355-1-git-send-email-bernard.iremonger@intel.com> References: <1475592734-22355-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH v5 01/13] librte_ether: modify internal callback function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2016 11:26:43 -0000 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. Signed-off-by: Alex Zelezniak Signed-off-by: Bernard Iremonger --- lib/librte_ether/rte_ethdev.c | 5 ++++- lib/librte_ether/rte_ethdev.h | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index c517e88..416ca77 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -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); diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 7218b6f..9fb34ca 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -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 -- 2.9.0