Re: [PATCH v2 net-next] net-core: add rx_otherhost_dropped counter
From: Jakub Kicinski
Date: Sat Mar 05 2022 - 00:40:35 EST
On Thu, 3 Mar 2022 13:59:58 -0800 Brian Vazquez wrote:
> LGTM, thanks Jeffrey!
>
> Reviewed-by: Brian Vazquez <brianvv@xxxxxxxxxx>
Please keep Brian's review tag..
> On Wed, Mar 2, 2022 at 4:30 PM Jeffrey Ji <jeffreyjilinux@xxxxxxxxx> wrote:
> >
> > From: jeffreyji <jeffreyji@xxxxxxxxxx>
> >
> > Increment rx_otherhost_dropped counter when packet dropped due to
> > mismatched dest MAC addr.
> >
> > An example when this drop can occur is when manually crafting raw
> > packets that will be consumed by a user space application via a tap
> > device. For testing purposes local traffic was generated using trafgen
> > for the client and netcat to start a server
> >
> > Tested: Created 2 netns, sent 1 packet using trafgen from 1 to the other
> > with "{eth(daddr=$INCORRECT_MAC...}", verified that iproute2 showed the
> > counter was incremented. (Also had to modify iproute2 to show the stat,
> > additional patch for that coming next.)
> >
> > changelog:
> >
> > v2: add kdoc comment
move the changelog under the '---' separator
> > Signed-off-by: jeffreyji <jeffreyji@xxxxxxxxxx>
> > ---
> > include/linux/netdevice.h | 3 +++
> > include/uapi/linux/if_link.h | 5 +++++
> > net/core/dev.c | 2 ++
> > net/ipv4/ip_input.c | 1 +
> > net/ipv6/ip6_input.c | 1 +
> > 5 files changed, 12 insertions(+)
> > diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
> > index e315e53125f4..17e74385fca8 100644
> > --- a/include/uapi/linux/if_link.h
> > +++ b/include/uapi/linux/if_link.h
> > @@ -211,6 +211,9 @@ struct rtnl_link_stats {
> > * @rx_nohandler: Number of packets received on the interface
> > * but dropped by the networking stack because the device is
> > * not designated to receive packets (e.g. backup link in a bond).
> > + *
> > + * @rx_otherhost_dropped: Number of packets dropped due to mismatch in
> > + * packet's destination MAC address.
> > */
> > struct rtnl_link_stats64 {
> > __u64 rx_packets;
> > @@ -243,6 +246,8 @@ struct rtnl_link_stats64 {
> > __u64 rx_compressed;
> > __u64 tx_compressed;
> > __u64 rx_nohandler;
> > +
> > + __u64 rx_otherhost_dropped;
> > };
> >
> > /* The struct should be in sync with struct ifmap */
rebase on latest net-next/master and repost.
Looks like it's conflicting with recently merged
commit 9309f97aef6d ("net: dev: Add hardware stats support")