netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Simon Horman <simon.horman@corigine.com>
Cc: "David Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, oss-drivers@corigine.com,
	"Niklas Söderlund" <niklas.soderlund@corigine.com>,
	"Danie du Toit" <danie.dutoit@corigine.com>
Subject: Re: [PATCH net] nfp: do not use driver_data to index device info
Date: Fri, 1 Apr 2022 10:22:30 -0700	[thread overview]
Message-ID: <20220401102230.2caab128@kernel.org> (raw)
In-Reply-To: <20220401111936.92777-1-simon.horman@corigine.com>

On Fri,  1 Apr 2022 13:19:36 +0200 Simon Horman wrote:
> From: Niklas Söderlund <niklas.soderlund@corigine.com>
> 
> When adding support for multiple chips the struct pci_device_id
> driver_data field was used to hold a index to lookup chip device
> specific information from a table. This works but creates a regressions
> for users who uses /sys/bus/pci/drivers/nfp_netvf/new_id.
> 
> For example, before the change writing "19ee 6003" to new_id was
> sufficient 

Can you explain the use case? I think this worked somewhat
coincidentally. If we had entries that matched subvendor = 0
subdevice = 0 it'd fail with EEXIST.

> but after one needs to write enough fields to be able to also
> match on the driver_data field, "19ee 6003 19ee ffffffff ffffffff 0 1".
> 
> The usage of driver_data field was only a convenience and in the belief
> the driver_data field was private to the driver and not exposed in
> anyway to users. Changing the device info lookup to a function that
> translates from struct pci_device_id device field instead works just as
> well and removes the user facing regression.

I think you're trading a coincidental "feature" while breaking what
new_id is actually supposed to be used for. Which is adding IDs.
nfp_get_dev_info() you add only recognizes existing IDs.

> As a bonus the enum and table with lookup information can be moved out
> from a shared header file to the only file where it's used.
> 
> Reported-by: Danie du Toit <danie.dutoit@corigine.com>
> Fixes: e900db704c8512bc ("nfp: parametrize QCP offset/size using dev_info")
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>

      parent reply	other threads:[~2022-04-01 17:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 11:19 [PATCH net] nfp: do not use driver_data to index device info Simon Horman
2022-04-01 13:18 ` Andrew Lunn
2022-04-01 13:51   ` Simon Horman
2022-04-01 17:22 ` Jakub Kicinski [this message]

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=20220401102230.2caab128@kernel.org \
    --to=kuba@kernel.org \
    --cc=danie.dutoit@corigine.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=simon.horman@corigine.com \
    /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).