From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Biju Das <biju.das.jz@bp.renesas.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Nikita Yushchenko <nikita.yoush@cogentembedded.com>,
<netdev@vger.kernel.org>, <linux-renesas-soc@vger.kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Biju Das <biju.das.au@gmail.com>
Subject: Re: [PATCH net-next v2 2/2] ravb: Add Tx checksum offload support
Date: Sat, 27 Jan 2024 00:00:20 +0300 [thread overview]
Message-ID: <fb8302e3-8491-09d0-3f94-1599bbe42743@omp.ru> (raw)
In-Reply-To: <20240124102115.132154-3-biju.das.jz@bp.renesas.com>
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@bp.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
next prev parent reply other threads:[~2024-01-26 21:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 10:21 [PATCH net-next v2 0/2] Add HW checksum offload support for RZ/G2L GbEthernet IP Biju Das
2024-01-24 10:21 ` [PATCH net-next v2 1/2] ravb: Add Rx checksum offload support Biju Das
2024-01-25 20:42 ` Sergey Shtylyov
2024-01-25 22:15 ` Biju Das
2024-01-29 20:59 ` Sergey Shtylyov
2024-01-30 17:00 ` Biju Das
2024-01-24 10:21 ` [PATCH net-next v2 2/2] ravb: Add Tx " Biju Das
2024-01-26 21:00 ` Sergey Shtylyov [this message]
2024-01-28 9:21 ` Biju Das
2024-01-25 19:10 ` [PATCH net-next v2 0/2] Add HW checksum offload support for RZ/G2L GbEthernet IP Sergey Shtylyov
2024-01-25 22:08 ` Biju Das
2024-01-26 19:01 ` Sergey Shtylyov
2024-01-25 19:11 ` Sergey Shtylyov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fb8302e3-8491-09d0-3f94-1599bbe42743@omp.ru \
--to=s.shtylyov@omp.ru \
--cc=biju.das.au@gmail.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geert+renesas@glider.be \
--cc=kuba@kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikita.yoush@cogentembedded.com \
--cc=pabeni@redhat.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=wsa+renesas@sang-engineering.com \
--cc=yoshihiro.shimoda.uh@renesas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox