int rw_piot_dev_callback_unregister(rw_piot_api_handle_t api_handle, enum rte_eth_event_type event, rte_eth_dev_cb_fn cb_fn, void *cb_arg) { rw_piot_device_t *rw_piot_dev = RWPIOT_GET_DEVICE(api_handle); ASSERT(RWPIOT_VALID_DEVICE(rw_piot_dev)); if (NULL == rw_piot_dev) { RW_PIOT_LOG(RTE_LOG_ERR, "PIOT Could not find device by handle\n"); return -1; } return(rte_eth_dev_callback_unregister(rw_piot_dev->rte_port_id, event, cb_fn, cb_arg)); }
static int __eth_bond_slave_remove_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id) { struct rte_eth_dev *bonded_eth_dev; struct bond_dev_private *internals; int i, slave_idx; if (valid_slave_port_id(slave_port_id) != 0) return -1; bonded_eth_dev = &rte_eth_devices[bonded_port_id]; internals = bonded_eth_dev->data->dev_private; /* first remove from active slave list */ slave_idx = find_slave_by_id(internals->active_slaves, internals->active_slave_count, slave_port_id); if (slave_idx < internals->active_slave_count) deactivate_slave(bonded_eth_dev, slave_port_id); slave_idx = -1; /* now find in slave list */ for (i = 0; i < internals->slave_count; i++) if (internals->slaves[i].port_id == slave_port_id) { slave_idx = i; break; } if (slave_idx < 0) { RTE_BOND_LOG(ERR, "Couldn't find slave in port list, slave count %d", internals->slave_count); return -1; } /* Un-register link status change callback with bonded device pointer as * argument*/ rte_eth_dev_callback_unregister(slave_port_id, RTE_ETH_EVENT_INTR_LSC, bond_ethdev_lsc_event_callback, &rte_eth_devices[bonded_port_id].data->port_id); /* Restore original MAC address of slave device */ mac_address_set(&rte_eth_devices[slave_port_id], &(internals->slaves[slave_idx].persisted_mac_addr)); slave_remove(internals, &rte_eth_devices[slave_port_id]); /* first slave in the active list will be the primary by default, * otherwise use first device in list */ if (internals->current_primary_port == slave_port_id) { if (internals->active_slave_count > 0) internals->current_primary_port = internals->active_slaves[0]; else if (internals->slave_count > 0) internals->current_primary_port = internals->slaves[0].port_id; else internals->primary_port = 0; } if (internals->active_slave_count < 1) { /* reset device link properties as no slaves are active */ link_properties_reset(&rte_eth_devices[bonded_port_id]); /* if no slaves are any longer attached to bonded device and MAC is not * user defined then clear MAC of bonded device as it will be reset * when a new slave is added */ if (internals->slave_count < 1 && !internals->user_defined_mac) memset(rte_eth_devices[bonded_port_id].data->mac_addrs, 0, sizeof(*(rte_eth_devices[bonded_port_id].data->mac_addrs))); } if (internals->slave_count == 0) { internals->rx_offload_capa = 0; internals->tx_offload_capa = 0; } return 0; }