[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fb8302e3-8491-09d0-3f94-1599bbe42743@omp.ru>
Date: Sat, 27 Jan 2024 00:00:20 +0300
From: Sergey Shtylyov <s.shtylyov@....ru>
To: Biju Das <biju.das.jz@...renesas.com>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
CC: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@...esas.com>, Wolfram Sang
<wsa+renesas@...g-engineering.com>, Nikita Yushchenko
<nikita.yoush@...entembedded.com>, <netdev@...r.kernel.org>,
<linux-renesas-soc@...r.kernel.org>, Geert Uytterhoeven
<geert+renesas@...der.be>, Prabhakar Mahadev Lad
<prabhakar.mahadev-lad.rj@...renesas.com>, Biju Das <biju.das.au@...il.com>
Subject: Re: [PATCH net-next v2 2/2] ravb: Add Tx checksum offload support
On 1/24/24 1:21 PM, Biju Das wrote:
> TOE has hw support for calculating IP header and TCP/UDP/ICMP checksum for
s/hw/hardware/, please...
> both IPV4 and IPV6.
>
> Add Tx checksum offload supported by TOE for IPv4 and TCP/UDP.
>
> For Tx, the result of checksum calculation is set to the checksum field of
> each IPv4 Header/TCP/UDP/ICMP of ethernet frames. For the unsupported
> frames, those fields are not changed. If a transmission frame is an UDP
> frame of IPv4 and its checksum value in the UDP header field is H’0000,
> TOE does not calculate checksum for UDP part of this frame as it is
> optional function as per standards.
>
> We can test this functionality by the below commands
>
> ethtool -K eth0 tx on --> to turn on Tx checksum offload
> ethtool -K eth0 tx off --> to turn off Tx checksum offload
>
> Signed-off-by: Biju Das <biju.das.jz@...renesas.com>
[...]
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 59c7bedacef6..3c748a54fae0 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -29,6 +29,7 @@
> #include <linux/spinlock.h>
> #include <linux/reset.h>
> #include <linux/math64.h>
> +#include <net/ip.h>
What do you need from that header, BTW?
[...]
> @@ -1990,6 +2001,39 @@ static void ravb_tx_timeout_work(struct work_struct *work)
> rtnl_unlock();
> }
>
> +static bool ravb_is_tx_checksum_offload_gbeth_possible(struct sk_buff *skb)
I'd suggest s/th shorter and more consistent with the used naming,
like ravb_tx_csum_possible_gbeth()...
> +{
> + struct iphdr *ip = ip_hdr(skb);
> +
> + /* TODO: Need to add support for VLAN tag 802.1Q */
> + if (skb_vlan_tag_present(skb))
> + return false;
> +
> + /* TODO: Need to add HW checksum for IPV6 */
> + if (skb->protocol != htons(ETH_P_IP))
> + return false;
So maybe we need to report just NETIF_F_IP_CSUM, not NETIF_F_HW_CSUM
ATM?
> +
> + switch (ip->protocol) {
> + case IPPROTO_TCP:
> + break;
> + case IPPROTO_UDP:
> + /* If the checksum value in the UDP header field is “H’0000”,
Use 0x0000 or just 0, please. I don't know where Renesas found this
weird hex notation...
[...]
> @@ -2005,6 +2049,11 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> u32 entry;
> u32 len;
>
> + if (skb->ip_summed == CHECKSUM_PARTIAL) {
> + if (!ravb_is_tx_checksum_offload_gbeth_possible(skb))
I'd collapse those 2 *if* statements...
[...]
MBR, Sergey
Powered by blists - more mailing lists