Skip to contentSkip to conversation

cxgb4: Fix uld_send() for ctrl pkts

PATCH Applied Ganesh Goudar 2 participants 2 messages Feb 2, 2017 – Feb 3, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxgb4: Fix uld_send() for ctrl pkts

From: Arjun V <[email protected]>

Without any uld being loaded, uld_txq_info[] will be NULL. uld_send() is also used for sending control work requests(for eg: setting filter) that dont require any ulds to be loaded. Hence move uld_txq_info[] assignment after ctrl_xmit().

Also added a NULL check for uld_txq_info[].

Fixes 94cdb8bb993a (cxgb4: Add support for dynamic allocation

of resources for ULD).

---
 drivers/net/ethernet/chelsio/cxgb4/sge.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/sge.c +8 -3
index 0fe04b4..09653ae 100644
@@ -1774,15 +1774,20 @@ static inline int uld_send(struct adapter *adap, struct sk_buff *skb,
 	struct sge_uld_txq *txq;
 	unsigned int idx = skb_txq(skb);
 
-	txq_info = adap->sge.uld_txq_info[tx_uld_type];
-	txq = &txq_info->uldtxq[idx];
-
 	if (unlikely(is_ctrl_pkt(skb))) {
 		/* Single ctrl queue is a requirement for LE workaround path */
 		if (adap->tids.nsftids)
 			idx = 0;
 		return ctrl_xmit(&adap->sge.ctrlq[idx], skb);
 	}
+
+	txq_info = adap->sge.uld_txq_info[tx_uld_type];
+	if (unlikely(!txq_info)) {
+		WARN_ON(true);
+		return NET_XMIT_DROP;
+	}
+
+	txq = &txq_info->uldtxq[idx];
 	return ofld_xmit(txq, skb);
 }
 
Signature · 1 line
2.1.0
maintainer Applied
#1 lore raw

From: Ganesh Goudar <[email protected]>
Date: Thu, 2 Feb 2017 12:43:29 +0530

Quoted 7 lines

From: Arjun V <[email protected]>

Without any uld being loaded, uld_txq_info[] will be NULL. uld_send() is also used for sending control work requests(for eg: setting filter) that dont require any ulds to be loaded. Hence move uld_txq_info[] assignment after ctrl_xmit().

Quoted 7 lines

Also added a NULL check for uld_txq_info[].

Fixes 94cdb8bb993a (cxgb4: Add support for dynamic allocation

of resources for ULD).

Applied, thanks.