Skip to content

Commit 8452a05

Browse files
rohangt07davem330
authored andcommitted
net: stmmac: Tx coe sw fallback
Add sw fallback of tx checksum calculation for those tx queues that don't support tx checksum offloading. DW xGMAC IP can be synthesized such that it can support tx checksum offloading only for a few initial tx queues. Also as Serge pointed out, for the DW QoS IP, tx coe can be individually configured for each tx queue. So when tx coe is enabled, for any tx queue that doesn't support tx coe with 'coe-unsupported' flag set will have a sw fallback happen in the driver for tx checksum calculation when any packets to be transmitted on these tx queues. Signed-off-by: Rohan G Thomas <rohan.g.thomas@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6fb8c20 commit 8452a05

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4401,6 +4401,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
44014401
WARN_ON(tx_q->tx_skbuff[first_entry]);
44024402

44034403
csum_insertion = (skb->ip_summed == CHECKSUM_PARTIAL);
4404+
/* DWMAC IPs can be synthesized to support tx coe only for a few tx
4405+
* queues. In that case, checksum offloading for those queues that don't
4406+
* support tx coe needs to fallback to software checksum calculation.
4407+
*/
4408+
if (csum_insertion &&
4409+
priv->plat->tx_queues_cfg[queue].coe_unsupported) {
4410+
if (unlikely(skb_checksum_help(skb)))
4411+
goto dma_map_err;
4412+
csum_insertion = !csum_insertion;
4413+
}
44044414

44054415
if (likely(priv->extend_desc))
44064416
desc = (struct dma_desc *)(tx_q->dma_etx + entry);

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
276276
plat->tx_queues_cfg[queue].use_prio = true;
277277
}
278278

279+
plat->tx_queues_cfg[queue].coe_unsupported =
280+
of_property_read_bool(q_node, "snps,coe-unsupported");
281+
279282
queue++;
280283
}
281284
if (queue != plat->tx_queues_to_use) {

include/linux/stmmac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ struct stmmac_rxq_cfg {
139139

140140
struct stmmac_txq_cfg {
141141
u32 weight;
142+
bool coe_unsupported;
142143
u8 mode_to_use;
143144
/* Credit Base Shaper parameters */
144145
u32 send_slope;

0 commit comments

Comments
 (0)