Skip to content

Commit acede3c

Browse files
IoanaCiorneidavem330
authored andcommitted
net: enetc: declare NETIF_F_HW_CSUM and do it in software
This is just a preparation patch for software TSO in the enetc driver. Unfortunately, ENETC does not support Tx checksum offload which would normally render TSO, even software, impossible. Declare NETIF_F_HW_CSUM as part of the feature set and do it at driver level using skb_csum_hwoffload_help() so that we can move forward and also add support for TSO in the next patch. Signed-off-by: Ioana Ciornei <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 36ee728 commit acede3c

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

drivers/net/ethernet/freescale/enetc/enetc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static netdev_tx_t enetc_start_xmit(struct sk_buff *skb,
319319
{
320320
struct enetc_ndev_priv *priv = netdev_priv(ndev);
321321
struct enetc_bdr *tx_ring;
322-
int count;
322+
int count, err;
323323

324324
/* Queue one-step Sync packet if already locked */
325325
if (skb->cb[0] & ENETC_F_TX_ONESTEP_SYNC_TSTAMP) {
@@ -342,6 +342,12 @@ static netdev_tx_t enetc_start_xmit(struct sk_buff *skb,
342342
return NETDEV_TX_BUSY;
343343
}
344344

345+
if (skb->ip_summed == CHECKSUM_PARTIAL) {
346+
err = skb_checksum_help(skb);
347+
if (err)
348+
goto drop_packet_err;
349+
}
350+
345351
enetc_lock_mdio();
346352
count = enetc_map_tx_buffs(tx_ring, skb);
347353
enetc_unlock_mdio();

drivers/net/ethernet/freescale/enetc/enetc_pf.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,10 +759,12 @@ static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
759759

760760
ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
761761
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
762-
NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK;
762+
NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_LOOPBACK |
763+
NETIF_F_HW_CSUM;
763764
ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM |
764765
NETIF_F_HW_VLAN_CTAG_TX |
765-
NETIF_F_HW_VLAN_CTAG_RX;
766+
NETIF_F_HW_VLAN_CTAG_RX |
767+
NETIF_F_HW_CSUM;
766768

767769
if (si->num_rss)
768770
ndev->hw_features |= NETIF_F_RXHASH;

drivers/net/ethernet/freescale/enetc/enetc_vf.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,12 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
122122

123123
ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
124124
NETIF_F_HW_VLAN_CTAG_TX |
125-
NETIF_F_HW_VLAN_CTAG_RX;
125+
NETIF_F_HW_VLAN_CTAG_RX |
126+
NETIF_F_HW_CSUM;
126127
ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM |
127128
NETIF_F_HW_VLAN_CTAG_TX |
128-
NETIF_F_HW_VLAN_CTAG_RX;
129+
NETIF_F_HW_VLAN_CTAG_RX |
130+
NETIF_F_HW_CSUM;
129131

130132
if (si->num_rss)
131133
ndev->hw_features |= NETIF_F_RXHASH;

0 commit comments

Comments
 (0)