Skip to content

Commit e8535bf

Browse files
committed
Merge branch 'stmmac-tx-coe'
Rohan G Thomas says: ==================== net: stmmac: Tx coe sw fallback 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. This patchset adds support for tx coe sw fallback for those queues that don't support tx coe. Also, add binding for snps,coe-unsupported property. changelog v7: * Updated commit message. * Add blank lines around newly added dt binding. changelog v6: * Reworked patchset to cover DW QoS Ethernet IP also. changelog v5: * As rightly suggested by Serge, reworked redundant code. changelog v4: * Replaced tx_q_coe_lmt with bit flag. changelog v3: * Resend with complete email list. changelog v2: * Reformed binding description. * Minor grammatical corrections in comments and commit messages. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 1cb6422 + 8452a05 commit e8535bf

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

Documentation/devicetree/bindings/net/snps,dwmac.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,11 @@ properties:
394394
When a PFC frame is received with priorities matching the bitmask,
395395
the queue is blocked from transmitting for the pause time specified
396396
in the PFC frame.
397+
398+
snps,coe-unsupported:
399+
type: boolean
400+
description: TX checksum offload is unsupported by the TX queue.
401+
397402
allOf:
398403
- if:
399404
required:

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)