[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240615.180209.1799432003527929919.fujita.tomonori@gmail.com>
Date: Sat, 15 Jun 2024 18:02:09 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: hfdevel@....net
Cc: kuba@...nel.org, fujita.tomonori@...il.com, 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 Sat, 15 Jun 2024 09:44:31 +0200
Hans-Frieder Vogt <hfdevel@....net> 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.
The tn40_txd_sizes array is ready-only and the same values are used
for all TN40 cards? So no need to move it into the priv?
Powered by blists - more mailing lists