mbox series

[0/8] PCI/VPD: Extend PCI VPD API

Message ID f693b1ae-447c-0eb1-7a9a-d1aaf9a26641@gmail.com
Headers show
Series PCI/VPD: Extend PCI VPD API | expand

Message

Heiner Kallweit Aug. 18, 2021, 6:58 p.m. UTC
This series adds three functions to the PCI VPD API that help to
simplify driver code. First users are sfc and tg3 drivers because
I have test hw. The other users of the VPD API will benefit from a
migration as well.
I'd propose to apply this series via the PCI tree.

Added API calls:

pci_vpd_alloc()
Dynamically allocates a properly sized buffer and reads the VPD into it.

pci_vpd_find_ro_info_keyword()
Locates an info field keyword in the VPD RO section.
pci_vpd_find_info_keyword() can be removed once all
users have been migrated.

pci_vpd_check_csum()
Check VPD checksum based on algorithm defined in the PCI specification.

Tested on a SFN6122F and a BCM95719 card.

Heiner Kallweit (8):
  PCI/VPD: Add pci_vpd_alloc
  PCI/VPD: Add pci_vpd_find_ro_info_keyword and pci_vpd_check_csum
  PCI/VPD: Add missing VPD RO field keywords
  sfc: Use new function pci_vpd_alloc
  sfc: Use new VPD API function pci_vpd_find_ro_info_keyword
  tg3: Use new function pci_vpd_alloc
  tg3: Use new function pci_vpd_check_csum
  tg3: Use new function pci_vpd_find_ro_info_keyword

 drivers/net/ethernet/broadcom/tg3.c | 115 +++++++---------------------
 drivers/net/ethernet/broadcom/tg3.h |   1 -
 drivers/net/ethernet/sfc/efx.c      |  78 +++++--------------
 drivers/pci/vpd.c                   |  82 ++++++++++++++++++++
 include/linux/pci.h                 |  32 ++++++++
 5 files changed, 163 insertions(+), 145 deletions(-)

Comments

Bjorn Helgaas Aug. 20, 2021, 8:50 p.m. UTC | #1
On Wed, Aug 18, 2021 at 08:58:18PM +0200, Heiner Kallweit wrote:
> This series adds three functions to the PCI VPD API that help to

> simplify driver code. First users are sfc and tg3 drivers because

> I have test hw. The other users of the VPD API will benefit from a

> migration as well.

> I'd propose to apply this series via the PCI tree.

> 

> Added API calls:

> 

> pci_vpd_alloc()

> Dynamically allocates a properly sized buffer and reads the VPD into it.

> 

> pci_vpd_find_ro_info_keyword()

> Locates an info field keyword in the VPD RO section.

> pci_vpd_find_info_keyword() can be removed once all

> users have been migrated.

> 

> pci_vpd_check_csum()

> Check VPD checksum based on algorithm defined in the PCI specification.

> 

> Tested on a SFN6122F and a BCM95719 card.

> 

> Heiner Kallweit (8):

>   PCI/VPD: Add pci_vpd_alloc

>   PCI/VPD: Add pci_vpd_find_ro_info_keyword and pci_vpd_check_csum

>   PCI/VPD: Add missing VPD RO field keywords

>   sfc: Use new function pci_vpd_alloc

>   sfc: Use new VPD API function pci_vpd_find_ro_info_keyword

>   tg3: Use new function pci_vpd_alloc

>   tg3: Use new function pci_vpd_check_csum

>   tg3: Use new function pci_vpd_find_ro_info_keyword

> 

>  drivers/net/ethernet/broadcom/tg3.c | 115 +++++++---------------------

>  drivers/net/ethernet/broadcom/tg3.h |   1 -

>  drivers/net/ethernet/sfc/efx.c      |  78 +++++--------------

>  drivers/pci/vpd.c                   |  82 ++++++++++++++++++++

>  include/linux/pci.h                 |  32 ++++++++

>  5 files changed, 163 insertions(+), 145 deletions(-)


Beautiful!  I applied this with minor tweaks to pci/vpd for v5.15.

I dropped the "add missing keywords" patch because there are no users
of the missing keywords yet.

I would have removed pci_vpd_find_info_keyword() as well, but it looks
like there are stilla few users of it.
Heiner Kallweit Aug. 20, 2021, 9:36 p.m. UTC | #2
On 20.08.2021 22:50, Bjorn Helgaas wrote:
> On Wed, Aug 18, 2021 at 08:58:18PM +0200, Heiner Kallweit wrote:

>> This series adds three functions to the PCI VPD API that help to

>> simplify driver code. First users are sfc and tg3 drivers because

>> I have test hw. The other users of the VPD API will benefit from a

>> migration as well.

>> I'd propose to apply this series via the PCI tree.

>>

>> Added API calls:

>>

>> pci_vpd_alloc()

>> Dynamically allocates a properly sized buffer and reads the VPD into it.

>>

>> pci_vpd_find_ro_info_keyword()

>> Locates an info field keyword in the VPD RO section.

>> pci_vpd_find_info_keyword() can be removed once all

>> users have been migrated.

>>

>> pci_vpd_check_csum()

>> Check VPD checksum based on algorithm defined in the PCI specification.

>>

>> Tested on a SFN6122F and a BCM95719 card.

>>

>> Heiner Kallweit (8):

>>   PCI/VPD: Add pci_vpd_alloc

>>   PCI/VPD: Add pci_vpd_find_ro_info_keyword and pci_vpd_check_csum

>>   PCI/VPD: Add missing VPD RO field keywords

>>   sfc: Use new function pci_vpd_alloc

>>   sfc: Use new VPD API function pci_vpd_find_ro_info_keyword

>>   tg3: Use new function pci_vpd_alloc

>>   tg3: Use new function pci_vpd_check_csum

>>   tg3: Use new function pci_vpd_find_ro_info_keyword

>>

>>  drivers/net/ethernet/broadcom/tg3.c | 115 +++++++---------------------

>>  drivers/net/ethernet/broadcom/tg3.h |   1 -

>>  drivers/net/ethernet/sfc/efx.c      |  78 +++++--------------

>>  drivers/pci/vpd.c                   |  82 ++++++++++++++++++++

>>  include/linux/pci.h                 |  32 ++++++++

>>  5 files changed, 163 insertions(+), 145 deletions(-)

> 

> Beautiful!  I applied this with minor tweaks to pci/vpd for v5.15.

> 

> I dropped the "add missing keywords" patch because there are no users

> of the missing keywords yet.

> 

Chelsio T4 driver is using this keyword. Then I'll add this keyword
when migrating the driver.

> I would have removed pci_vpd_find_info_keyword() as well, but it looks

> like there are stilla few users of it.

> 

Right, there are few more users. In this initial series I only changed
users for which I have test hw.