path: root/drivers/net/mlx5/mlx5_trigger.c
diff options
authorNĂ©lio Laranjeiro <>2018-03-12 14:43:18 +0100
committerFerruh Yigit <>2018-03-30 14:08:44 +0200
commit7ba5320baa3285bf8beca96cc025ff56b494060d (patch)
treeca5f0657a5acda7803bad5ee12ab2cbbc60f7954 /drivers/net/mlx5/mlx5_trigger.c
parentf47ba80080ab81ad513f843407bec7178fed8857 (diff)
net/mlx5: fix link status behavior
This behavior is mixed between what should be handled by the application and what is under PMD responsibility. According to DPDK API: - link_update() should only query the link status [1] - link_set_{up,down}() should only set the link to the according status [1] - dev_{start,stop}() should enable/disable traffic reception/emission [2] On this PMD, the link status is retrieved from the net device associated owned by the Linux Kernel, it does not means that even when this interface is down, the PMD cannot send/receive traffic from the NIC those two information are unrelated, until the physical port is active and has a link, the PMD can receive/send traffic on the wire. According to DPDK API, calling the rte_eth_dev_start() even when the Linux interface link is down is then possible and allowed, as the traffic will flow between the DPDK application and the Physical port. This also means that a synchronization between the Linux interface and the DPDK application remains under the DPDK application responsibility. To handle such synchronization the application should behave as the following scheme, to start: rte_eth_get_link(port_id, &link); if (link.link_status == ETH_DOWN) rte_eth_dev_set_link_up(port_id); rte_eth_dev_start(port_id); Taking in account the possible returned values for each function. and to stop: rte_eth_dev_stop(port_id); rte_eth_dev_set_link_down(port_id); The application should also set the LSC interrupt callbacks to catch and behave accordingly when the administrator set the Linux device down/up. The same callbacks are called when the link on the medium falls/raise. [1] [2] Fixes: c7bf62255edf ("net/mlx5: fix handling link status event") Fixes: e313ef4c2fe8 ("net/mlx5: fix link state on device start") Cc: Signed-off-by: Nelio Laranjeiro <> Acked-by: Adrien Mazarguil <> Acked-by: Yongseok Koh <>
Diffstat (limited to 'drivers/net/mlx5/mlx5_trigger.c')
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 28770b8..6bb4ffb 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -176,15 +176,20 @@ mlx5_dev_start(struct rte_eth_dev *dev)
goto error;
- /* Update link status and Tx/Rx callbacks for the first time. */
- memset(&dev->data->dev_link, 0, sizeof(struct rte_eth_link));
- DRV_LOG(INFO, "forcing port %u link to be up", dev->data->port_id);
- ret = mlx5_force_link_status_change(dev, ETH_LINK_UP);
+ ret = mlx5_traffic_enable(dev);
if (ret) {
- DRV_LOG(DEBUG, "failed to set port %u link to be up",
+ DRV_LOG(DEBUG, "port %u failed to set defaults flows",
goto error;
+ ret = mlx5_flow_start(dev, &priv->flows);
+ if (ret) {
+ DRV_LOG(DEBUG, "port %u failed to set flows",
+ dev->data->port_id);
+ goto error;
+ }
+ dev->tx_pkt_burst = mlx5_select_tx_function(dev);
+ dev->rx_pkt_burst = mlx5_select_rx_function(dev);
return 0;