Skip to content

Commit dbeb256

Browse files
longlimsftrleon
authored andcommitted
RDMA/mana_ib: Disable RX steering on RSS QP destroy
When an RSS QP is destroyed (e.g. DPDK exit), mana_ib_destroy_qp_rss() destroys the RX WQ objects but does not disable vPort RX steering in firmware. This leaves stale steering configuration that still points to the destroyed RX objects. If traffic continues to arrive (e.g. peer VM is still transmitting) and the VF interface is subsequently brought up (mana_open), the firmware may deliver completions using stale CQ IDs from the old RX objects. These CQ IDs can be reused by the ethernet driver for new TX CQs, causing RX completions to land on TX CQs: WARNING: mana_poll_tx_cq+0x1b8/0x220 [mana] (is_sq == false) WARNING: mana_gd_process_eq_events+0x209/0x290 (cq_table lookup fails) Fix this by disabling vPort RX steering before destroying RX WQ objects. Note that mana_fence_rqs() cannot be used here because the fence completion is delivered on the CQ, which is polled by user-mode (e.g. DPDK) and not visible to the kernel driver. Refactor the disable logic into a shared mana_disable_vport_rx() in mana_en, exported for use by mana_ib, replacing the duplicate code. The ethernet driver's mana_dealloc_queues() is also updated to call this common function. Fixes: 0266a17 ("RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter") Cc: stable@vger.kernel.org Signed-off-by: Long Li <longli@microsoft.com> Link: https://patch.msgid.link/20260325194100.1929056-1-longli@microsoft.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 911e5ca commit dbeb256

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

drivers/infiniband/hw/mana/qp.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,21 @@ static int mana_ib_destroy_qp_rss(struct mana_ib_qp *qp,
799799
ndev = mana_ib_get_netdev(qp->ibqp.device, qp->port);
800800
mpc = netdev_priv(ndev);
801801

802+
/* Disable vPort RX steering before destroying RX WQ objects.
803+
* Otherwise firmware still routes traffic to the destroyed queues,
804+
* which can cause bogus completions on reused CQ IDs when the
805+
* ethernet driver later creates new queues on mana_open().
806+
*
807+
* Unlike the ethernet teardown path, mana_fence_rqs() cannot be
808+
* used here because the fence completion CQE is delivered on the
809+
* CQ which is polled by userspace (e.g. DPDK), so there is no way
810+
* for the kernel to wait for fence completion.
811+
*
812+
* This is best effort — if it fails there is not much we can do,
813+
* and mana_cfg_vport_steering() already logs the error.
814+
*/
815+
mana_disable_vport_rx(mpc);
816+
802817
for (i = 0; i < (1 << ind_tbl->log_ind_tbl_size); i++) {
803818
ibwq = ind_tbl->ind_tbl[i];
804819
wq = container_of(ibwq, struct mana_ib_wq, ibwq);

drivers/net/ethernet/microsoft/mana/mana_en.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2882,6 +2882,13 @@ static void mana_rss_table_init(struct mana_port_context *apc)
28822882
ethtool_rxfh_indir_default(i, apc->num_queues);
28832883
}
28842884

2885+
int mana_disable_vport_rx(struct mana_port_context *apc)
2886+
{
2887+
return mana_cfg_vport_steering(apc, TRI_STATE_FALSE, false, false,
2888+
false);
2889+
}
2890+
EXPORT_SYMBOL_NS(mana_disable_vport_rx, "NET_MANA");
2891+
28852892
int mana_config_rss(struct mana_port_context *apc, enum TRI_STATE rx,
28862893
bool update_hash, bool update_tab)
28872894
{
@@ -3266,10 +3273,12 @@ static int mana_dealloc_queues(struct net_device *ndev)
32663273
*/
32673274

32683275
apc->rss_state = TRI_STATE_FALSE;
3269-
err = mana_config_rss(apc, TRI_STATE_FALSE, false, false);
3276+
err = mana_disable_vport_rx(apc);
32703277
if (err && mana_en_need_log(apc, err))
32713278
netdev_err(ndev, "Failed to disable vPort: %d\n", err);
32723279

3280+
mana_fence_rqs(apc);
3281+
32733282
/* Even in err case, still need to cleanup the vPort */
32743283
mana_destroy_vport(apc);
32753284

include/net/mana/mana.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ struct mana_port_context {
568568
netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev);
569569
int mana_config_rss(struct mana_port_context *ac, enum TRI_STATE rx,
570570
bool update_hash, bool update_tab);
571+
int mana_disable_vport_rx(struct mana_port_context *apc);
571572

572573
int mana_alloc_queues(struct net_device *ndev);
573574
int mana_attach(struct net_device *ndev);

0 commit comments

Comments
 (0)