[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1ae2ddab-b6d2-499d-9aa1-3033c730bb87@gmx.net>
Date: Sat, 15 Jun 2024 09:44:31 +0200
From: Hans-Frieder Vogt <hfdevel@....net>
To: Jakub Kicinski <kuba@...nel.org>,
FUJITA Tomonori <fujita.tomonori@...il.com>
Cc: netdev@...r.kernel.org, andrew@...n.ch, 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
On 14.06.2024 02.30, Jakub Kicinski wrote:
> On Tue, 11 Jun 2024 13:52:14 +0900 FUJITA Tomonori wrote:
>> +static void tn40_init_txd_sizes(void)
>> +{
>> + int i, lwords;
>> +
>> + if (tn40_txd_sizes[0].bytes)
>> + return;
>> +
>> + /* 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;
>> + }
>> +}
> Since this initializes global data - you should do it in module init.
> Due to this you can't rely on module_pci_driver(), you gotta write
> the module init / exit functions by hand.
I would rather move tn40_txd_sizes into tn40_priv and initialize it at
probe-time. Just thinking what will happen if there is more than one
tn40 card in a computer. Then a driver-based global struct would lead to
all sorts of problems.
Powered by blists - more mailing lists