ethdev: add return values to callback process API
Change the rte_eth_dev_callback_process function to return int, and add a void *ret_param parameter. The new parameter is used by ixgbe and i40e instead of abusing the user data of the callback. Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
This commit is contained in:
parent
aae9817d5d
commit
d6af1a13d7
@ -381,9 +381,9 @@ uint8_t bitrate_enabled;
|
||||
/* Forward function declarations */
|
||||
static void map_port_queue_stats_mapping_registers(uint8_t pi, struct rte_port *port);
|
||||
static void check_all_ports_link_status(uint32_t port_mask);
|
||||
static void eth_event_callback(uint8_t port_id,
|
||||
enum rte_eth_event_type type,
|
||||
void *param);
|
||||
static int eth_event_callback(uint8_t port_id,
|
||||
enum rte_eth_event_type type,
|
||||
void *param, void *ret_param);
|
||||
|
||||
/*
|
||||
* Check if all the ports are started.
|
||||
@ -1829,8 +1829,9 @@ rmv_event_callback(void *arg)
|
||||
}
|
||||
|
||||
/* This function is used by the interrupt thread */
|
||||
static void
|
||||
eth_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param)
|
||||
static int
|
||||
eth_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param,
|
||||
void *ret_param)
|
||||
{
|
||||
static const char * const event_desc[] = {
|
||||
[RTE_ETH_EVENT_UNKNOWN] = "Unknown",
|
||||
@ -1844,6 +1845,7 @@ eth_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param)
|
||||
};
|
||||
|
||||
RTE_SET_USED(param);
|
||||
RTE_SET_USED(ret_param);
|
||||
|
||||
if (type >= RTE_ETH_EVENT_MAX) {
|
||||
fprintf(stderr, "\nPort %" PRIu8 ": %s called upon invalid event %d\n",
|
||||
@ -1864,6 +1866,7 @@ eth_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -34,10 +34,6 @@ Deprecation Notices
|
||||
* The struct ``rte_pci_driver`` is planned to be removed from
|
||||
``rte_cryptodev_driver`` and ``rte_eventdev_driver`` in 17.08.
|
||||
|
||||
* ethdev: An API change is planned for 17.08 for the function
|
||||
``_rte_eth_dev_callback_process``. In 17.08 the function will return an ``int``
|
||||
instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
|
||||
|
||||
* The mbuf flags PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT are deprecated and
|
||||
are respectively replaced by PKT_RX_VLAN_STRIPPED and
|
||||
PKT_RX_QINQ_STRIPPED, that are better described. The old flags and
|
||||
|
@ -57,7 +57,7 @@ int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg)
|
||||
cb_param.msg = msg;
|
||||
|
||||
_rte_eth_dev_callback_process(bp->eth_dev, RTE_ETH_EVENT_VF_MBOX,
|
||||
&cb_param);
|
||||
&cb_param, NULL);
|
||||
|
||||
/* Default to approve */
|
||||
if (cb_param.retval == RTE_PMD_BNXT_MB_EVENT_PROCEED)
|
||||
|
@ -1438,7 +1438,8 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
|
||||
if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
|
||||
slave_eth_dev->dev_ops->link_update(slave_eth_dev, 0);
|
||||
bond_ethdev_lsc_event_callback(slave_eth_dev->data->port_id,
|
||||
RTE_ETH_EVENT_INTR_LSC, &bonded_eth_dev->data->port_id);
|
||||
RTE_ETH_EVENT_INTR_LSC, &bonded_eth_dev->data->port_id,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1849,7 +1850,8 @@ bond_ethdev_slave_link_status_change_monitor(void *cb_arg)
|
||||
|
||||
bond_ethdev_lsc_event_callback(internals->slaves[i].port_id,
|
||||
RTE_ETH_EVENT_INTR_LSC,
|
||||
&bonded_ethdev->data->port_id);
|
||||
&bonded_ethdev->data->port_id,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
rte_spinlock_unlock(&internals->lock);
|
||||
@ -1995,35 +1997,36 @@ bond_ethdev_delayed_lsc_propagation(void *arg)
|
||||
return;
|
||||
|
||||
_rte_eth_dev_callback_process((struct rte_eth_dev *)arg,
|
||||
RTE_ETH_EVENT_INTR_LSC, NULL);
|
||||
RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
|
||||
void *param)
|
||||
void *param, void *ret_param __rte_unused)
|
||||
{
|
||||
struct rte_eth_dev *bonded_eth_dev, *slave_eth_dev;
|
||||
struct bond_dev_private *internals;
|
||||
struct rte_eth_link link;
|
||||
int rc = -1;
|
||||
|
||||
int i, valid_slave = 0;
|
||||
uint8_t active_pos;
|
||||
uint8_t lsc_flag = 0;
|
||||
|
||||
if (type != RTE_ETH_EVENT_INTR_LSC || param == NULL)
|
||||
return;
|
||||
return rc;
|
||||
|
||||
bonded_eth_dev = &rte_eth_devices[*(uint8_t *)param];
|
||||
slave_eth_dev = &rte_eth_devices[port_id];
|
||||
|
||||
if (check_for_bonded_ethdev(bonded_eth_dev))
|
||||
return;
|
||||
return rc;
|
||||
|
||||
internals = bonded_eth_dev->data->dev_private;
|
||||
|
||||
/* If the device isn't started don't handle interrupts */
|
||||
if (!bonded_eth_dev->data->dev_started)
|
||||
return;
|
||||
return rc;
|
||||
|
||||
/* verify that port_id is a valid slave of bonded port */
|
||||
for (i = 0; i < internals->slave_count; i++) {
|
||||
@ -2034,7 +2037,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
|
||||
}
|
||||
|
||||
if (!valid_slave)
|
||||
return;
|
||||
return rc;
|
||||
|
||||
/* Search for port in active port list */
|
||||
active_pos = find_slave_by_id(internals->active_slaves,
|
||||
@ -2043,7 +2046,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
|
||||
rte_eth_link_get_nowait(port_id, &link);
|
||||
if (link.link_status) {
|
||||
if (active_pos < internals->active_slave_count)
|
||||
return;
|
||||
return rc;
|
||||
|
||||
/* if no active slave ports then set this port to be primary port */
|
||||
if (internals->active_slave_count < 1) {
|
||||
@ -2065,7 +2068,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
|
||||
RTE_LOG(ERR, PMD,
|
||||
"port %u invalid speed/duplex\n",
|
||||
port_id);
|
||||
return;
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2077,7 +2080,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
|
||||
bond_ethdev_primary_set(internals, port_id);
|
||||
} else {
|
||||
if (active_pos == internals->active_slave_count)
|
||||
return;
|
||||
return rc;
|
||||
|
||||
/* Remove from active slave list */
|
||||
deactivate_slave(bonded_eth_dev, port_id);
|
||||
@ -2116,7 +2119,8 @@ 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, NULL);
|
||||
RTE_ETH_EVENT_INTR_LSC,
|
||||
NULL, NULL);
|
||||
|
||||
} else {
|
||||
if (internals->link_down_delay_ms > 0)
|
||||
@ -2125,9 +2129,11 @@ 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, NULL);
|
||||
RTE_ETH_EVENT_INTR_LSC,
|
||||
NULL, NULL);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -260,9 +260,9 @@ void
|
||||
bond_ethdev_primary_set(struct bond_dev_private *internals,
|
||||
uint8_t slave_port_id);
|
||||
|
||||
void
|
||||
int
|
||||
bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
|
||||
void *param);
|
||||
void *param, void *ret_param);
|
||||
|
||||
int
|
||||
bond_ethdev_parse_slave_port_kvarg(const char *key,
|
||||
|
@ -1670,7 +1670,7 @@ eth_em_interrupt_handler(void *param)
|
||||
|
||||
eth_em_interrupt_get_status(dev);
|
||||
eth_em_interrupt_action(dev, dev->intr_handle);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -2898,7 +2898,8 @@ 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, NULL);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -2957,7 +2958,8 @@ void igbvf_mbx_process(struct rte_eth_dev *dev)
|
||||
|
||||
/* PF reset VF event */
|
||||
if (in_msg == E1000_PF_CONTROL_MSG)
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -430,7 +430,7 @@ enic_intr_handler(void *arg)
|
||||
vnic_intr_return_all_credits(&enic->intr);
|
||||
|
||||
enic_link_update(enic);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
|
||||
enic_log_q_error(enic);
|
||||
}
|
||||
|
||||
|
@ -5804,7 +5804,7 @@ i40e_dev_handle_aq_msg(struct rte_eth_dev *dev)
|
||||
ret = i40e_dev_link_update(dev, 0);
|
||||
if (!ret)
|
||||
_rte_eth_dev_callback_process(dev,
|
||||
RTE_ETH_EVENT_INTR_LSC, NULL);
|
||||
RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
|
||||
break;
|
||||
default:
|
||||
PMD_DRV_LOG(DEBUG, "Request %u is not supported yet",
|
||||
|
@ -1328,7 +1328,8 @@ i40evf_handle_pf_event(struct rte_eth_dev *dev, uint8_t *msg,
|
||||
switch (pf_msg->event) {
|
||||
case I40E_VIRTCHNL_EVENT_RESET_IMPENDING:
|
||||
PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event");
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
|
||||
NULL, NULL);
|
||||
break;
|
||||
case I40E_VIRTCHNL_EVENT_LINK_CHANGE:
|
||||
PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event");
|
||||
|
@ -1231,7 +1231,7 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
|
||||
struct i40e_pf_vf *vf;
|
||||
/* AdminQ will pass absolute VF id, transfer to internal vf id */
|
||||
uint16_t vf_id = abs_vf_id - hw->func_caps.vf_base_id;
|
||||
struct rte_pmd_i40e_mb_event_param cb_param;
|
||||
struct rte_pmd_i40e_mb_event_param ret_param;
|
||||
bool b_op = TRUE;
|
||||
|
||||
if (vf_id > pf->vf_num - 1 || !pf->vfs) {
|
||||
@ -1251,22 +1251,23 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,
|
||||
* initialise structure to send to user application
|
||||
* will return response from user in retval field
|
||||
*/
|
||||
cb_param.retval = RTE_PMD_I40E_MB_EVENT_PROCEED;
|
||||
cb_param.vfid = vf_id;
|
||||
cb_param.msg_type = opcode;
|
||||
cb_param.msg = (void *)msg;
|
||||
cb_param.msglen = msglen;
|
||||
ret_param.retval = RTE_PMD_I40E_MB_EVENT_PROCEED;
|
||||
ret_param.vfid = vf_id;
|
||||
ret_param.msg_type = opcode;
|
||||
ret_param.msg = (void *)msg;
|
||||
ret_param.msglen = msglen;
|
||||
|
||||
/**
|
||||
* Ask user application if we're allowed to perform those functions.
|
||||
* If we get cb_param.retval == RTE_PMD_I40E_MB_EVENT_PROCEED,
|
||||
* If we get ret_param.retval == RTE_PMD_I40E_MB_EVENT_PROCEED,
|
||||
* then business as usual.
|
||||
* If RTE_PMD_I40E_MB_EVENT_NOOP_ACK or RTE_PMD_I40E_MB_EVENT_NOOP_NACK,
|
||||
* do nothing and send not_supported to VF. As PF must send a response
|
||||
* to VF and ACK/NACK is not defined.
|
||||
*/
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
|
||||
if (cb_param.retval != RTE_PMD_I40E_MB_EVENT_PROCEED) {
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX,
|
||||
NULL, &ret_param);
|
||||
if (ret_param.retval != RTE_PMD_I40E_MB_EVENT_PROCEED) {
|
||||
PMD_DRV_LOG(WARNING, "VF to PF message(%d) is not permitted!",
|
||||
opcode);
|
||||
b_op = FALSE;
|
||||
|
@ -4155,12 +4155,13 @@ 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, NULL);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
if (intr->flags & IXGBE_FLAG_MACSEC) {
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_MACSEC,
|
||||
NULL);
|
||||
NULL, NULL);
|
||||
intr->flags &= ~IXGBE_FLAG_MACSEC;
|
||||
}
|
||||
|
||||
@ -7868,7 +7869,8 @@ static void ixgbevf_mbx_process(struct rte_eth_dev *dev)
|
||||
|
||||
/* PF reset VF event */
|
||||
if (in_msg == IXGBE_PF_CONTROL_MSG)
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -683,7 +683,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;
|
||||
struct rte_pmd_ixgbe_mb_event_param ret_param;
|
||||
|
||||
retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
|
||||
if (retval) {
|
||||
@ -702,10 +702,10 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
|
||||
* 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;
|
||||
ret_param.retval = RTE_PMD_IXGBE_MB_EVENT_PROCEED;
|
||||
ret_param.vfid = vf;
|
||||
ret_param.msg_type = msgbuf[0] & 0xFFFF;
|
||||
ret_param.msg = (void *)msgbuf;
|
||||
|
||||
/* perform VF reset */
|
||||
if (msgbuf[0] == IXGBE_VF_RESET) {
|
||||
@ -714,20 +714,22 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
|
||||
vfinfo[vf].clear_to_send = true;
|
||||
|
||||
/* notify application about VF reset */
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX,
|
||||
NULL, &ret_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
|
||||
* if we get ret_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
|
||||
* if ret_param.retval > 1, do nothing and send NAK to VF
|
||||
*/
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &cb_param);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX,
|
||||
NULL, &ret_param);
|
||||
|
||||
retval = cb_param.retval;
|
||||
retval = ret_param.retval;
|
||||
|
||||
/* check & process VF to PF mailbox message */
|
||||
switch ((msgbuf[0] & 0xFFFF)) {
|
||||
|
@ -5411,7 +5411,8 @@ mlx4_dev_link_status_handler(void *arg)
|
||||
ret = priv_dev_status_handler(priv, dev, &events);
|
||||
priv_unlock(priv);
|
||||
if (ret > 0 && events & (1 << RTE_ETH_EVENT_INTR_LSC))
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5440,7 +5441,8 @@ mlx4_dev_interrupt_handler(void *cb_arg)
|
||||
i++) {
|
||||
if (ev & (1 << i)) {
|
||||
ev &= ~(1 << i);
|
||||
_rte_eth_dev_callback_process(dev, i, NULL);
|
||||
_rte_eth_dev_callback_process(dev, i, NULL,
|
||||
NULL);
|
||||
ret--;
|
||||
}
|
||||
}
|
||||
|
@ -1262,7 +1262,8 @@ 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, NULL);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1284,7 +1285,8 @@ mlx5_dev_interrupt_handler(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, NULL);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1334,7 +1334,7 @@ nfp_net_dev_interrupt_delayed_handler(void *param)
|
||||
struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
|
||||
|
||||
nfp_net_link_update(dev, 0);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
|
||||
|
||||
nfp_net_dev_link_status_print(dev);
|
||||
|
||||
|
@ -111,7 +111,8 @@ exit:
|
||||
sa->eth_dev->data->dev_link.link_status ?
|
||||
"UP" : "DOWN");
|
||||
_rte_eth_dev_callback_process(sa->eth_dev,
|
||||
RTE_ETH_EVENT_INTR_LSC, NULL);
|
||||
RTE_ETH_EVENT_INTR_LSC,
|
||||
NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +153,8 @@ exit:
|
||||
if (lsc_seq != sa->port.lsc_seq) {
|
||||
sfc_info(sa, "link status change event");
|
||||
_rte_eth_dev_callback_process(sa->eth_dev,
|
||||
RTE_ETH_EVENT_INTR_LSC, NULL);
|
||||
RTE_ETH_EVENT_INTR_LSC,
|
||||
NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,8 @@ nicvf_interrupt(void *arg)
|
||||
if (nicvf_reg_poll_interrupts(nic) == NIC_MBOX_MSG_BGX_LINK_CHANGE) {
|
||||
if (dev->data->dev_conf.intr_conf.lsc)
|
||||
nicvf_set_eth_link_status(nic, &dev->data->dev_link);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
|
||||
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
rte_eal_alarm_set(NICVF_INTR_POLL_INTERVAL_MS * 1000,
|
||||
|
@ -607,7 +607,8 @@ new_device(int vid)
|
||||
|
||||
RTE_LOG(INFO, PMD, "New connection established\n");
|
||||
|
||||
_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
|
||||
_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC,
|
||||
NULL, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -661,7 +662,8 @@ destroy_device(int vid)
|
||||
|
||||
RTE_LOG(INFO, PMD, "Connection closed\n");
|
||||
|
||||
_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
|
||||
_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -690,7 +692,8 @@ vring_state_changed(int vid, uint16_t vring, int enable)
|
||||
RTE_LOG(INFO, PMD, "vring%u is %s\n",
|
||||
vring, enable ? "enabled" : "disabled");
|
||||
|
||||
_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE, NULL);
|
||||
_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_QUEUE_STATE,
|
||||
NULL, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1229,7 +1229,8 @@ virtio_interrupt_handler(void *param)
|
||||
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, NULL);
|
||||
RTE_ETH_EVENT_INTR_LSC,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -469,14 +469,16 @@ lsi_parse_args(int argc, char **argv)
|
||||
* Pointer to(address of) the parameters.
|
||||
*
|
||||
* @return
|
||||
* void.
|
||||
* int.
|
||||
*/
|
||||
static void
|
||||
lsi_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param)
|
||||
static int
|
||||
lsi_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param,
|
||||
void *ret_param)
|
||||
{
|
||||
struct rte_eth_link link;
|
||||
|
||||
RTE_SET_USED(param);
|
||||
RTE_SET_USED(ret_param);
|
||||
|
||||
printf("\n\nIn registered callback...\n");
|
||||
printf("Event type: %s\n", type == RTE_ETH_EVENT_INTR_LSC ? "LSC interrupt" : "unknown event");
|
||||
@ -488,6 +490,8 @@ lsi_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param)
|
||||
("full-duplex") : ("half-duplex"));
|
||||
} else
|
||||
printf("Port %d Link Down\n\n", port_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check the link status of all ports in up to 9s, and print them finally */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
|
||||
* Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -129,6 +129,7 @@ struct rte_eth_dev_callback {
|
||||
TAILQ_ENTRY(rte_eth_dev_callback) next; /**< Callbacks list */
|
||||
rte_eth_dev_cb_fn cb_fn; /**< Callback address */
|
||||
void *cb_arg; /**< Parameter for callback */
|
||||
void *ret_param; /**< Return parameter */
|
||||
enum rte_eth_event_type event; /**< Interrupt event type */
|
||||
uint32_t active; /**< Callback is executing */
|
||||
};
|
||||
@ -2717,12 +2718,13 @@ rte_eth_dev_callback_unregister(uint8_t port_id,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
_rte_eth_dev_callback_process(struct rte_eth_dev *dev,
|
||||
enum rte_eth_event_type event, void *cb_arg)
|
||||
enum rte_eth_event_type event, void *cb_arg, void *ret_param)
|
||||
{
|
||||
struct rte_eth_dev_callback *cb_lst;
|
||||
struct rte_eth_dev_callback dev_cb;
|
||||
int rc = 0;
|
||||
|
||||
rte_spinlock_lock(&rte_eth_dev_cb_lock);
|
||||
TAILQ_FOREACH(cb_lst, &(dev->link_intr_cbs), next) {
|
||||
@ -2732,14 +2734,17 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
|
||||
cb_lst->active = 1;
|
||||
if (cb_arg != NULL)
|
||||
dev_cb.cb_arg = cb_arg;
|
||||
if (ret_param != NULL)
|
||||
dev_cb.ret_param = ret_param;
|
||||
|
||||
rte_spinlock_unlock(&rte_eth_dev_cb_lock);
|
||||
dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
|
||||
dev_cb.cb_arg);
|
||||
rc = dev_cb.cb_fn(dev->data->port_id, dev_cb.event,
|
||||
dev_cb.cb_arg, dev_cb.ret_param);
|
||||
rte_spinlock_lock(&rte_eth_dev_cb_lock);
|
||||
cb_lst->active = 0;
|
||||
}
|
||||
rte_spinlock_unlock(&rte_eth_dev_cb_lock);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
|
||||
* Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -3337,8 +3337,8 @@ enum rte_eth_event_type {
|
||||
RTE_ETH_EVENT_MAX /**< max value of this enum */
|
||||
};
|
||||
|
||||
typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \
|
||||
enum rte_eth_event_type event, void *cb_arg);
|
||||
typedef int (*rte_eth_dev_cb_fn)(uint8_t port_id,
|
||||
enum rte_eth_event_type event, void *cb_arg, void *ret_param);
|
||||
/**< user application callback to be registered for interrupts */
|
||||
|
||||
|
||||
@ -3355,11 +3355,6 @@ 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.
|
||||
@ -3399,15 +3394,17 @@ int rte_eth_dev_callback_unregister(uint8_t port_id,
|
||||
* @param event
|
||||
* Eth device interrupt event type.
|
||||
* @param cb_arg
|
||||
* Update callback parameter to pass data back to user application.
|
||||
* callback parameter.
|
||||
* @param ret_param
|
||||
* To pass data back to user application.
|
||||
* This allows the user application to decide if a particular function
|
||||
* is permitted or not.
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
* int
|
||||
*/
|
||||
void _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
|
||||
enum rte_eth_event_type event, void *cb_arg);
|
||||
int _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
|
||||
enum rte_eth_event_type event, void *cb_arg, void *ret_param);
|
||||
|
||||
/**
|
||||
* When there is no rx packet coming in Rx Queue for a long time, we can
|
||||
|
@ -1,7 +1,6 @@
|
||||
DPDK_2.2 {
|
||||
global:
|
||||
|
||||
_rte_eth_dev_callback_process;
|
||||
rte_eth_add_rx_callback;
|
||||
rte_eth_add_tx_callback;
|
||||
rte_eth_allmulticast_disable;
|
||||
@ -152,6 +151,7 @@ DPDK_17.05 {
|
||||
DPDK_17.08 {
|
||||
global:
|
||||
|
||||
_rte_eth_dev_callback_process;
|
||||
rte_flow_isolate;
|
||||
|
||||
} DPDK_17.05;
|
||||
|
@ -1173,15 +1173,19 @@ test_adding_slave_after_bonded_device_started(void)
|
||||
int test_lsc_interrupt_count;
|
||||
|
||||
|
||||
static void
|
||||
static int
|
||||
test_bonding_lsc_event_callback(uint8_t port_id __rte_unused,
|
||||
enum rte_eth_event_type type __rte_unused, void *param __rte_unused)
|
||||
enum rte_eth_event_type type __rte_unused,
|
||||
void *param __rte_unused,
|
||||
void *ret_param __rte_unused)
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
test_lsc_interrupt_count++;
|
||||
|
||||
pthread_cond_signal(&cvar);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
@ -484,7 +484,8 @@ 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, NULL);
|
||||
_rte_eth_dev_callback_process(vrtl_eth_dev, RTE_ETH_EVENT_INTR_LSC,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
x
Reference in New Issue
Block a user