[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56dac46c-37f8-431b-82b2-bfa75e9e63a2@lunn.ch>
Date: Fri, 30 Jun 2023 19:08:47 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Joakim Tjernlund <Joakim.Tjernlund@...inera.com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: Disable TX path on eth I/F from driver?
On Fri, Jun 30, 2023 at 04:57:31PM +0000, Joakim Tjernlund wrote:
> On Fri, 2023-06-30 at 18:50 +0200, Andrew Lunn wrote:
> > On Fri, Jun 30, 2023 at 03:48:15PM +0000, Joakim Tjernlund wrote:
> > > We have a few eth I/F that is for monitoring only, if any TX one gets:
> > > NETDEV WATCHDOG: trap0 (xr-ccip): transmit queue 0 timed out
> > > [ 55.903074] WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:477 dev_watchdog+0x138/0x160
> > > [ 55.911380] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.109-00161-g1268ae25c302-dirty #7
> > > <long trace snipped>
> > >
> > > I would like to, from within the driver, disable the TX path so the IP stack cannot TX any
> > > pkgs but cannot find a way to do so.
> > > Is there a way(to at least avid the NETDEV WATCHDOG msg) disable TX?
> > > On kernel 5.15
> >
> > Have you tried using TC or iptables to just unconditionally drop all
> > packets?
> >
>
> No, this is an embedded target with no iptables/TC
> Would be much nicer if I could do this in driver.
I would argue it is much uglier. You need to hack the kernel driver to
throw away packets, vs just installing a couple extra packages and us
a supported mechanism to throw packets away.
Anyway, if you want to hack the driver, simply replace its
.ndo_start_xmit with
https://elixir.bootlin.com/linux/v6.4/source/drivers/net/dummy.c#L59
static netdev_tx_t dummy_xmit(struct sk_buff *skb, struct net_device *dev)
{
dev_lstats_add(dev, skb->len);
skb_tx_timestamp(skb);
dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
Andrew
Powered by blists - more mailing lists