[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00d00a1c-2a78-4b7d-815d-8977fb4795be@lunn.ch>
Date: Sat, 15 Jun 2024 20:33:04 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Hans-Frieder Vogt <hfdevel@....net>
Cc: FUJITA Tomonori <fujita.tomonori@...il.com>, kuba@...nel.org,
netdev@...r.kernel.org, horms@...nel.org, jiri@...nulli.us,
pabeni@...hat.com, linux@...linux.org.uk, naveenm@...vell.com,
jdamato@...tly.com
Subject: Re: [PATCH net-next v10 4/7] net: tn40xx: add basic Tx handling
> /* Sizes of tx desc (including padding if needed) as function of the SKB's
> * frag number
> * 7 - is number of lwords in txd with one phys buffer
> * 3 - is number of lwords used for every additional phys buffer
> * for (i = 0; i < TN40_MAX_PBL; i++) {
> * lwords = 7 + (i * 3);
> * if (lwords & 1)
> * lwords++; pad it with 1 lword
> * tn40_txd_sizes[i].qwords = lwords >> 1;
> * tn40_txd_sizes[i].bytes = lwords << 2;
> * }
> */
> static struct {
> u16 bytes;
> u16 qwords; /* qword = 64 bit */
> } const tn40_txd_sizes[] = {
> { 0x20, 0x04 },
> { 0x28, 0x05 },
> { 0x38, 0x07 },
Nice comment section. Please keep it to help explain the table.
I did wounder if calculating the value as needed would be any
slower/faster than doing a table access. Doing arithmetic is very
cheap compared to a cache miss for a table lookup. Something which
could be bench marked and optimised later.
Andrew
Powered by blists - more mailing lists