@@ -529,8 +529,6 @@ parse_event_printing_config(const char *optarg, int enable)
mask = UINT32_C(1) << RTE_ETH_EVENT_IPSEC;
else if (!strcmp(optarg, "macsec"))
mask = UINT32_C(1) << RTE_ETH_EVENT_MACSEC;
- else if (!strcmp(optarg, "intr_rmv"))
- mask = UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV;
else if (!strcmp(optarg, "dev_probed"))
mask = UINT32_C(1) << RTE_ETH_EVENT_NEW;
else if (!strcmp(optarg, "dev_released"))
@@ -357,7 +357,6 @@ static const char * const eth_event_desc[] = {
[RTE_ETH_EVENT_VF_MBOX] = "VF mbox",
[RTE_ETH_EVENT_IPSEC] = "IPsec",
[RTE_ETH_EVENT_MACSEC] = "MACsec",
- [RTE_ETH_EVENT_INTR_RMV] = "device removal",
[RTE_ETH_EVENT_NEW] = "device probed",
[RTE_ETH_EVENT_DESTROY] = "device released",
[RTE_ETH_EVENT_MAX] = NULL,
@@ -372,8 +371,8 @@ uint32_t event_print_mask = (UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN) |
(UINT32_C(1) << RTE_ETH_EVENT_QUEUE_STATE) |
(UINT32_C(1) << RTE_ETH_EVENT_INTR_RESET) |
(UINT32_C(1) << RTE_ETH_EVENT_IPSEC) |
- (UINT32_C(1) << RTE_ETH_EVENT_MACSEC) |
- (UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV);
+ (UINT32_C(1) << RTE_ETH_EVENT_MACSEC);
+
/*
* Decide if all memory are locked for performance.
*/
@@ -2567,13 +2566,6 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
ports[port_id].need_setup = 1;
ports[port_id].port_status = RTE_PORT_HANDLING;
break;
- case RTE_ETH_EVENT_INTR_RMV:
- if (port_id_is_invalid(port_id, DISABLED_WARN))
- break;
- if (rte_eal_alarm_set(100000,
- rmv_port_callback, (void *)(intptr_t)port_id))
- fprintf(stderr, "Could not set up deferred device removal\n");
- break;
default:
break;
}
@@ -2626,19 +2618,7 @@ dev_event_callback(const char *device_name, enum rte_dev_event_type type,
device_name);
return;
}
- /*
- * Because the user's callback is invoked in eal interrupt
- * callback, the interrupt callback need to be finished before
- * it can be unregistered when detaching device. So finish
- * callback soon and use a deferred removal to detach device
- * is need. It is a workaround, once the device detaching be
- * moved into the eal in the future, the deferred removal could
- * be deleted.
- */
- if (rte_eal_alarm_set(100000,
- rmv_port_callback, (void *)(intptr_t)port_id))
- RTE_LOG(ERR, EAL,
- "Could not set up deferred device removal\n");
+ rmv_port_callback((void *)(intptr_t)port_id);
break;
case RTE_DEV_EVENT_ADD:
RTE_LOG(ERR, EAL, "The device: %s has been added!\n",
@@ -3170,20 +3150,6 @@ main(int argc, char** argv)
init_config();
if (hot_plug) {
- ret = rte_dev_hotplug_handle_enable();
- if (ret) {
- RTE_LOG(ERR, EAL,
- "fail to enable hotplug handling.");
- return -1;
- }
-
- ret = rte_dev_event_monitor_start();
- if (ret) {
- RTE_LOG(ERR, EAL,
- "fail to start device event monitoring.");
- return -1;
- }
-
ret = rte_dev_event_callback_register(NULL,
dev_event_callback, NULL);
if (ret) {
@@ -345,8 +345,7 @@ failsafe_eth_dev_unregister_callbacks(struct sub_device *sdev)
if (sdev == NULL)
return;
if (sdev->rmv_callback) {
- ret = rte_eth_dev_callback_unregister(PORT_ID(sdev),
- RTE_ETH_EVENT_INTR_RMV,
+ ret = rte_dev_event_callback_unregister(sdev->dev->name,
failsafe_eth_rmv_event_callback,
sdev);
if (ret)
@@ -559,10 +558,10 @@ failsafe_stats_increment(struct rte_eth_stats *to, struct rte_eth_stats *from)
}
}
-int
-failsafe_eth_rmv_event_callback(uint16_t port_id __rte_unused,
- enum rte_eth_event_type event __rte_unused,
- void *cb_arg, void *out __rte_unused)
+void
+failsafe_eth_rmv_event_callback(const char *device_name __rte_unused,
+ enum rte_dev_event_type event __rte_unused,
+ void *cb_arg)
{
struct sub_device *sdev = cb_arg;
@@ -577,7 +576,6 @@ failsafe_eth_rmv_event_callback(uint16_t port_id __rte_unused,
*/
sdev->remove = 1;
fs_unlock(sdev->fs_dev, 0);
- return 0;
}
int
@@ -140,8 +140,7 @@ fs_dev_configure(struct rte_eth_dev *dev)
return ret;
}
if (rmv_interrupt && sdev->rmv_callback == 0) {
- ret = rte_eth_dev_callback_register(PORT_ID(sdev),
- RTE_ETH_EVENT_INTR_RMV,
+ ret = rte_dev_event_callback_register(sdev->dev->name,
failsafe_eth_rmv_event_callback,
sdev);
if (ret)
@@ -224,9 +224,9 @@ void failsafe_eth_dev_unregister_callbacks(struct sub_device *sdev);
void failsafe_dev_remove(struct rte_eth_dev *dev);
void failsafe_stats_increment(struct rte_eth_stats *to,
struct rte_eth_stats *from);
-int failsafe_eth_rmv_event_callback(uint16_t port_id,
- enum rte_eth_event_type type,
- void *arg, void *out);
+void failsafe_eth_rmv_event_callback(const char *device_name,
+ enum rte_dev_event_type event,
+ void *cb_arg);
int failsafe_eth_lsc_event_callback(uint16_t port_id,
enum rte_eth_event_type event,
void *cb_arg, void *out);
@@ -180,7 +180,6 @@ mlx4_interrupt_handler(struct priv *priv)
enum { LSC, RMV, };
static const enum rte_eth_event_type type[] = {
[LSC] = RTE_ETH_EVENT_INTR_LSC,
- [RMV] = RTE_ETH_EVENT_INTR_RMV,
};
uint32_t caught[RTE_DIM(type)] = { 0 };
struct ibv_async_event event;
@@ -1033,7 +1033,7 @@ mlx5_dev_status_handler(struct rte_eth_dev *dev)
ret |= (1 << RTE_ETH_EVENT_INTR_LSC);
else if (event.event_type == IBV_EVENT_DEVICE_FATAL &&
dev->data->dev_conf.intr_conf.rmv == 1)
- ret |= (1 << RTE_ETH_EVENT_INTR_RMV);
+ ret |= (1 << RTE_DEV_EVENT_REMOVE);
else
DRV_LOG(DEBUG,
"port %u event type %d on not handled",
@@ -1060,8 +1060,9 @@ mlx5_dev_interrupt_handler(void *cb_arg)
events = mlx5_dev_status_handler(dev);
if (events & (1 << RTE_ETH_EVENT_INTR_LSC))
_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
- if (events & (1 << RTE_ETH_EVENT_INTR_RMV))
- _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RMV, NULL);
+ if (events & (1 << RTE_DEV_EVENT_REMOVE))
+ rte_dev_event_callback_process(dev->device->name,
+ RTE_DEV_EVENT_REMOVE);
}
/**
@@ -2619,7 +2619,6 @@ enum rte_eth_event_type {
/**< reset interrupt event, sent to VF on PF reset */
RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by PF */
RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */
- RTE_ETH_EVENT_INTR_RMV, /**< device removal event */
RTE_ETH_EVENT_NEW, /**< port is probed */
RTE_ETH_EVENT_DESTROY, /**< port is released */
RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */
Since eal device event had been introduced, and application could monitor eal device event and accordingly handle hot-unplug for device, so the ethdev rmv event could be replaced by eal device event. This patch aim to abandon ethdev rmv interrupt, its every usages in pmd and testpmd will be removed, while use a common way to detect device hotplug. Signed-off-by: Jeff Guo <jia.guo@intel.com> --- app/test-pmd/parameters.c | 2 -- app/test-pmd/testpmd.c | 40 +++------------------------------ drivers/net/failsafe/failsafe_ether.c | 12 +++++----- drivers/net/failsafe/failsafe_ops.c | 3 +-- drivers/net/failsafe/failsafe_private.h | 6 ++--- drivers/net/mlx4/mlx4_intr.c | 1 - drivers/net/mlx5/mlx5_ethdev.c | 7 +++--- lib/librte_ethdev/rte_ethdev.h | 1 - 8 files changed, 16 insertions(+), 56 deletions(-)