From: Arne Meyer <meyer.arne83@netcologne.de>
To: "9front@9front.org" <9front@9front.org>
Subject: [9front] [patch] ethervgbe: add rx checksum offloading
Date: Fri, 11 Nov 2022 17:13:13 +0100 (CET) [thread overview]
Message-ID: <1250188960.4593874.1668183193726@comcenter.netcologne.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 120 bytes --]
Hello,
this patch implements rx tcp and udp checksum offloading for ipv4 for the ethervgbe nic driver.
Greetings,
Arne
[-- Attachment #2: ethervgbe.patch --]
[-- Type: application/octet-stream, Size: 2114 bytes --]
diff 4e75dd52d6dc4601e1f9912779c85f760e8d71e1 uncommitted
--- a/sys/src/9/pc/ethervgbe.c
+++ b/sys/src/9/pc/ethervgbe.c
@@ -298,6 +298,13 @@
RxDesc_Status_Shutdown = (1<<30), /* shutdown during RX */
RxDesc_Status_Own = (1<<31), /* own bit */
+ RxDesc_Control_Udp = (1<<16), /* UDP packet */
+ RxDesc_Control_Tcp = (2<<16), /* TCP packet */
+ RxDesc_Control_Ip = (4<<16), /* IP packet */
+
+ RxDesc_Control_Protocsum = (2<<20), /* TCP/UDP checksum ok */
+ RxDesc_Control_Ipcsum = (4<<20), /* IP checksum ok */
+
/* ... */
TxDesc_Status_Own = (1<<31), /* own bit */
@@ -310,6 +317,9 @@
struct Stats
{
ulong rx;
+ ulong tcpck;
+ ulong udpck;
+ ulong ipck;
ulong tx;
ulong txe;
ulong intr;
@@ -468,6 +478,9 @@
l += snprint(p+l, READSTR-l, "tx: %uld\n", ctlr->stats.tx);
l += snprint(p+l, READSTR-l, "tx [errs]: %uld\n", ctlr->stats.txe);
l += snprint(p+l, READSTR-l, "rx: %uld\n", ctlr->stats.rx);
+ l += snprint(p+l, READSTR-l, "tcpck: %uld\n", ctlr->stats.tcpck);
+ l += snprint(p+l, READSTR-l, "udpck: %uld\n", ctlr->stats.udpck);
+ l += snprint(p+l, READSTR-l, "ipck: %uld\n", ctlr->stats.ipck);
l += snprint(p+l, READSTR-l, "intr: %uld\n", ctlr->stats.intr);
snprint(p+l, READSTR-l, "\n");
@@ -560,7 +573,7 @@
Ctlr* ctlr;
int i;
Block* block;
- ulong length, status;
+ ulong length, status, control;
RxDesc* desc;
ctlr = edev->ctlr;
@@ -573,6 +586,7 @@
desc = &ctlr->rx_ring[i];
status = le32toh(desc->status);
+ control = le32toh(desc->control);
if(status & RxDesc_Status_Own)
continue;
@@ -589,6 +603,21 @@
/* remember the block */
block = ctlr->rx_blocks[i];
+
+ if(control & (RxDesc_Control_Tcp | RxDesc_Control_Protocsum)){
+ block->flag |= Btcpck;
+ ctlr->stats.tcpck++;
+ }
+
+ if(control & (RxDesc_Control_Udp | RxDesc_Control_Protocsum)){
+ block->flag |= Budpck;
+ ctlr->stats.udpck++;
+ }
+
+ if(control & (RxDesc_Control_Ip | RxDesc_Control_Ipcsum)){
+ block->flag |= Bipck;
+ ctlr->stats.ipck++;
+ }
/* plant new block, might fail if out of memory */
if(vgbenewrx(ctlr, i) == 0){
next reply other threads:[~2022-11-11 16:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-11 16:13 Arne Meyer [this message]
2022-11-11 17:01 ` hiro
2022-11-11 17:35 ` Arne Meyer
2022-11-19 20:09 ` Arne Meyer
2022-11-19 21:36 ` ori
2022-11-20 12:44 ` hiro
2022-12-07 19:12 ` hiro
2022-12-08 1:41 ` cinap_lenrek
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=1250188960.4593874.1668183193726@comcenter.netcologne.de \
--to=meyer.arne83@netcologne.de \
--cc=9front@9front.org \
/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;
as well as URLs for NNTP newsgroup(s).