netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Saeed Mahameed <saeed@kernel.org>
Cc: David Thompson <davthompson@nvidia.com>,
	Andrew Lunn <andrew@lunn.ch>,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	netdev@vger.kernel.org, cai.huoqing@linux.dev, brgl@bgdev.pl,
	limings@nvidia.com, chenhao288@hisilicon.com,
	huangguangbin2@huawei.com, Asmaa Mnebhi <asmaa@nvidia.com>
Subject: Re: [PATCH net-next v2 3/4] mlxbf_gige: add BlueField-3 Serdes configuration
Date: Wed, 16 Nov 2022 22:23:39 -0800	[thread overview]
Message-ID: <20221116222339.54052a83@kernel.org> (raw)
In-Reply-To: <Y3WWBcCwif7bADY4@x130.lan>

On Wed, 16 Nov 2022 18:01:41 -0800 Saeed Mahameed wrote:
> >	fw = request_firmware("whatever_name.ftb");
> >	
> >	abc = fw_table_get(fw, "table_abc");
> >	/* use abc */
> >  
> 
> abc is just a byte buffer ? right ?

pointer to const struct fw_table32, which is just;

struct fw_table32 {
	u32 addr;
	u32 value;
};

Actually we need the length as well, so perhaps this is better:

struct fw_table32 {
	u32 addr;
	u32 val;
};

struct fw_table_result {
	uint cnt;
	union {
		const struct fw_table32 *tb32;
	};
};

User:

	struct fw_table_result tab;

	fw = request_firmware("whatever_name.ftb");
	if (!fw)
		...

	err = fw_table_get(fw, "table_abc", &tab);
	if (err)
		...
	for (i = 0; i < tab.cnt; i++) /* use abc */
		write_or_whatever(hw, tab.tb32[i].addr, tab.tb32[i].val);

	def = fw_table_get(fw, "table_def");
	if (err)
		...
	for (i = 0; i < tab.cnt; i++) /* use def */
		write_or_whatever(hw, tab.tb32[i].addr, tab.tb32[i].val);

	release_firmware(fw)

> >	def = fw_table_get(fw, "table_def");
> >	/* use def */
> >  
> 
> And what goes here? any constraints on how the driver must interpret
> and handle abc/def blobs ? 

In the example I assumed a typical buffer with addr / value pairs.
But we can define more table types as needed.

> >	release_firmware(fw)  
> 
> What if the same abc blob structure/table format is used to setup dynamic link
> properties, say via ethtool -s ? Then the whole request firmware will be
> redundant since "struct abc {};" must be defined in the driver src code.

No complex structures, we'd be only targeting register init 
and small FW blobs (IOW { u32 addr; u32 val; } and { u8 val; }).
Stuff which Windows? drivers tend to put into the code as static array.

> I like the idea, i am just trying to figure how we are going to define it
> and how developers will differentiate between when to use this or when to
> use standard APIs to setup their devices.


  reply	other threads:[~2022-11-17  6:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 22:47 [PATCH net-next v2 0/4] mlxbf_gige: add BlueField-3 support David Thompson
2022-11-09 22:47 ` [PATCH net-next v2 1/4] mlxbf_gige: add MDIO support for BlueField-3 David Thompson
2022-11-10 13:24   ` Andrew Lunn
2022-11-09 22:47 ` [PATCH net-next v2 2/4] mlxbf_gige: support 10M/100M/1G speeds on BlueField-3 David Thompson
2022-11-10 13:23   ` Andrew Lunn
2022-11-09 22:47 ` [PATCH net-next v2 3/4] mlxbf_gige: add BlueField-3 Serdes configuration David Thompson
2022-11-10 13:33   ` Andrew Lunn
2022-11-12  5:34     ` Jakub Kicinski
2022-11-12  9:52       ` Saeed Mahameed
2022-11-12 15:53         ` Andrew Lunn
2022-11-15  0:56           ` Jakub Kicinski
2022-11-15  0:50         ` Jakub Kicinski
2022-11-15  1:06           ` Andrew Lunn
2022-11-15  1:13             ` Jakub Kicinski
2022-11-16 16:30               ` Jakub Kicinski
2022-11-17  2:01                 ` Saeed Mahameed
2022-11-17  6:23                   ` Jakub Kicinski [this message]
2022-11-09 22:47 ` [PATCH net-next v2 4/4] mlxbf_gige: add "set_link_ksettings" ethtool callback David Thompson
2022-11-10 13:26   ` Andrew Lunn

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=20221116222339.54052a83@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=asmaa@nvidia.com \
    --cc=brgl@bgdev.pl \
    --cc=cai.huoqing@linux.dev \
    --cc=chenhao288@hisilicon.com \
    --cc=davem@davemloft.net \
    --cc=davthompson@nvidia.com \
    --cc=edumazet@google.com \
    --cc=huangguangbin2@huawei.com \
    --cc=limings@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeed@kernel.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).