Although their "removed" version acts as a safety against unexpected bursts
while queues are being modified by the control path, these callbacks are
set per device instead of per queue. It makes sense to update them during
start/stop/close cycles instead of queue setup.
As a side effect, this commit addresses a bug left over from a prior
commit: bringing the link down causes the "removed" Tx callback to be used,
however the normal callback is not restored when bringing it back up,
preventing the application from sending traffic at all.
Updating callbacks for a link change is not necessary as bringing the
netdevice down is normally enough to prevent traffic from flowing in.
Fixes:
3f75a0271941 ("net/mlx4: drop scatter/gather support")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
error.message ? error.message : "(unspecified)");
goto err;
}
error.message ? error.message : "(unspecified)");
goto err;
}
+ rte_wmb();
+ dev->tx_pkt_burst = mlx4_tx_burst;
+ dev->rx_pkt_burst = mlx4_rx_burst;
return 0;
err:
/* Rollback. */
return 0;
err:
/* Rollback. */
return;
DEBUG("%p: detaching flows from all RX queues", (void *)dev);
priv->started = 0;
return;
DEBUG("%p: detaching flows from all RX queues", (void *)dev);
priv->started = 0;
+ dev->tx_pkt_burst = mlx4_tx_burst_removed;
+ dev->rx_pkt_burst = mlx4_rx_burst_removed;
+ rte_wmb();
mlx4_flow_sync(priv, NULL);
mlx4_intr_uninstall(priv);
}
mlx4_flow_sync(priv, NULL);
mlx4_intr_uninstall(priv);
}
struct priv *priv = dev->data->dev_private;
unsigned int i;
struct priv *priv = dev->data->dev_private;
unsigned int i;
- if (priv == NULL)
- return;
DEBUG("%p: closing device \"%s\"",
(void *)dev,
((priv->ctx != NULL) ? priv->ctx->device->name : ""));
DEBUG("%p: closing device \"%s\"",
(void *)dev,
((priv->ctx != NULL) ? priv->ctx->device->name : ""));
dev->rx_pkt_burst = mlx4_rx_burst_removed;
dev->tx_pkt_burst = mlx4_tx_burst_removed;
dev->rx_pkt_burst = mlx4_rx_burst_removed;
dev->tx_pkt_burst = mlx4_tx_burst_removed;
+ rte_wmb();
+ mlx4_flow_clean(priv);
for (i = 0; i != dev->data->nb_rx_queues; ++i)
mlx4_rx_queue_release(dev->data->rx_queues[i]);
for (i = 0; i != dev->data->nb_tx_queues; ++i)
for (i = 0; i != dev->data->nb_rx_queues; ++i)
mlx4_rx_queue_release(dev->data->rx_queues[i]);
for (i = 0; i != dev->data->nb_tx_queues; ++i)
static int
mlx4_dev_set_link(struct priv *priv, int up)
{
static int
mlx4_dev_set_link(struct priv *priv, int up)
{
- struct rte_eth_dev *dev = priv->dev;
int err;
if (up) {
err = mlx4_set_flags(priv, ~IFF_UP, IFF_UP);
if (err)
return err;
int err;
if (up) {
err = mlx4_set_flags(priv, ~IFF_UP, IFF_UP);
if (err)
return err;
- dev->rx_pkt_burst = mlx4_rx_burst;
} else {
err = mlx4_set_flags(priv, ~IFF_UP, ~IFF_UP);
if (err)
return err;
} else {
err = mlx4_set_flags(priv, ~IFF_UP, ~IFF_UP);
if (err)
return err;
- dev->rx_pkt_burst = mlx4_rx_burst_removed;
- dev->tx_pkt_burst = mlx4_tx_burst_removed;
rte_free(rxq);
return ret;
}
rte_free(rxq);
return ret;
}
- /* Update receive callback. */
- dev->rx_pkt_burst = mlx4_rx_burst;
DEBUG("%p: adding Tx queue %p to list",
(void *)dev, (void *)txq);
dev->data->tx_queues[idx] = txq;
DEBUG("%p: adding Tx queue %p to list",
(void *)dev, (void *)txq);
dev->data->tx_queues[idx] = txq;
- /* Update send callback. */
- dev->tx_pkt_burst = mlx4_tx_burst;