[PATCH net-next 5/9] net: enetc: use tso_features_check()

Eric Dumazet
2026-04-03T04:32:48Z

Fixes: fb8629e2cbfc ("net: enetc: add support for software TSO")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ioana Ciornei <ioana.ciornei@nxp.com>
---
drivers/net/ethernet/freescale/enetc/enetc.c | 2 ++
drivers/net/ethernet/freescale/enetc/enetc4_pf.c | 2 ++
drivers/net/ethernet/freescale/enetc/enetc_pf.c | 2 ++
drivers/net/ethernet/freescale/enetc/enetc_vf.c | 2 ++
4 files changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index aa8a87124b103261348fe371ef158571d4c9000c..a39aaf2d2f5345f71027bc0b813a96eb36ac3e5d 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -887,6 +887,8 @@ static int enetc_map_tx_tso_buffs(struct enetc_bdr *tx_ring, struct sk_buff *skb

/* Initialize the TSO handler, and prepare the first payload */
hdr_len = tso_start(skb, &tso);
+ DEBUG_NET_WARN_ON_ONCE(hdr_len > TSO_HEADER_SIZE);
+
total_len = skb->len - hdr_len;
i = tx_ring->next_to_use;

diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
index 56899f2254aaa2d87a184bc9dbf09298186148cf..52393c42d45ea1a50abbc9ee4e8e8b2fa462f70e 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
@@ -6,6 +6,7 @@
#include <linux/of_net.h>
#include <linux/of_platform.h>
#include <linux/unaligned.h>
+#include <net/tso.h>

#include "enetc_pf_common.h"
#include "enetc4_debugfs.h"
@@ -564,6 +565,7 @@ static int enetc4_pf_set_features(struct net_device *ndev,
static const struct net_device_ops enetc4_ndev_ops = {
.ndo_open = enetc_open,
.ndo_stop = enetc_close,
+ .ndo_features_check = tso_features_check,
.ndo_start_xmit = enetc_xmit,
.ndo_get_stats = enetc_get_stats,
.ndo_set_mac_address = enetc_pf_set_mac_addr,
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
index a12fd54a475f6cd0516185aa817f2d8c430a0a1d..6b5c3b1f43fc8f00cf0c58c28e5b5b035c0eec41 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
@@ -7,6 +7,7 @@
#include <linux/of_platform.h>
#include <linux/of_net.h>
#include <linux/pcs-lynx.h>
+#include <net/tso.h>
#include "enetc_ierb.h"
#include "enetc_pf_common.h"

@@ -617,6 +618,7 @@ static int enetc_pf_setup_tc(struct net_device *ndev, enum tc_setup_type type,
static const struct net_device_ops enetc_ndev_ops = {
.ndo_open = enetc_open,
.ndo_stop = enetc_close,
+ .ndo_features_check = tso_features_check,
.ndo_start_xmit = enetc_xmit,
.ndo_get_stats = enetc_get_stats,
.ndo_set_mac_address = enetc_pf_set_mac_addr,
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c b/drivers/net/ethernet/freescale/enetc/enetc_vf.c
index 6c4b374bcb0ef14284d2ea153d8bd4112fe5309a..7c9f3c7e9a5685530bf203ced3514d6dac574099 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c
@@ -3,6 +3,7 @@

#include <linux/module.h>
#include "enetc.h"
+#include <net/tso.h>

#define ENETC_DRV_NAME_STR "ENETC VF driver"

@@ -115,6 +116,7 @@ static int enetc_vf_setup_tc(struct net_device *ndev, enum tc_setup_type type,
static const struct net_device_ops enetc_ndev_ops = {
.ndo_open = enetc_open,
.ndo_stop = enetc_close,
+ .ndo_features_check = tso_features_check,
.ndo_start_xmit = enetc_xmit,
.ndo_get_stats = enetc_get_stats,
.ndo_set_mac_address = enetc_vf_set_mac_addr,
--
2.53.0.1213.gd9a14994de-goog