[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7f1ff93c4f7d4fc9bdefbb646c18acc1@realtek.com>
Date: Mon, 13 May 2024 03:43:52 +0000
From: Justin Lai <justinlai0215@...ltek.com>
To: Andrew Lunn <andrew@...n.ch>
CC: "kuba@...nel.org" <kuba@...nel.org>,
"davem@...emloft.net"
<davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org"
<netdev@...r.kernel.org>,
"jiri@...nulli.us" <jiri@...nulli.us>,
"horms@...nel.org" <horms@...nel.org>,
Ping-Ke Shih <pkshih@...ltek.com>, Larry Chiu <larry.chiu@...ltek.com>
Subject: RE: [PATCH net-next v18 06/13] rtase: Implement .ndo_start_xmit function
>
> > +static u32 rtase_tx_csum(struct sk_buff *skb, const struct net_device
> > +*dev) {
> > + u32 csum_cmd = 0;
> > + u8 ip_protocol;
> > +
> > + switch (vlan_get_protocol(skb)) {
> > + case htons(ETH_P_IP):
> > + csum_cmd = RTASE_TX_IPCS_C;
> > + ip_protocol = ip_hdr(skb)->protocol;
> > + break;
> > +
> > + case htons(ETH_P_IPV6):
> > + csum_cmd = RTASE_TX_IPV6F_C;
> > + ip_protocol = ipv6_hdr(skb)->nexthdr;
> > + break;
> > +
> > + default:
> > + ip_protocol = IPPROTO_RAW;
> > + break;
> > + }
> > +
> > + if (ip_protocol == IPPROTO_TCP)
> > + csum_cmd |= RTASE_TX_TCPCS_C;
> > + else if (ip_protocol == IPPROTO_UDP)
> > + csum_cmd |= RTASE_TX_UDPCS_C;
> > + else
> > + WARN_ON_ONCE(1);
>
> I'm not so sure about this WARN_ON_ONCE(). It looks like if i send a custom
> packet which is not IPv4 or IPv6 it will fire. There are other protocols then IP.
> Connecting to an Ethernet switch using DSA tags would be a good example. So
> i don't think you want this warning.
>
> Andrew
Hi Andrew,
The condition for entering this function is checksum_partial, which requires
hardware to help calculate the checksum, so protocols that are not supported
by the hardware will issue warn_on_once.
Powered by blists - more mailing lists