git: 5153206df0f2 - stable/13 - iflib drivers: Constify PCI ID LUTs

From: Marius Strobl <marius_at_FreeBSD.org>
Date: Sat, 06 Jan 2024 19:25:27 UTC
The branch stable/13 has been updated by marius:

URL: https://cgit.FreeBSD.org/src/commit/?id=5153206df0f29d682cdcad97b67d182b00204ccd

commit 5153206df0f29d682cdcad97b67d182b00204ccd
Author:     Marius Strobl <marius@FreeBSD.org>
AuthorDate: 2023-08-16 16:49:34 +0000
Commit:     Marius Strobl <marius@FreeBSD.org>
CommitDate: 2024-01-05 22:48:03 +0000

    iflib drivers: Constify PCI ID LUTs
    
    Since d49e83eac3baf16a22b1c5d42e8438b68b17e6f9, iflib(9) is ready
    for this change.
    While at it, make isc_driver_version strings (static) const where
    not apparently un-const on purpose, too.
    This reduces the size of the amd64 GENERIC by about 10 KiB.
    
    (cherry picked from commit 51e235148a4becba94e824a44bd69687644a7f56)
    
    Conflicts (drivers missing in stable/13):
            sys/dev/enetc/if_enetc.c
            sys/dev/enic/if_enic.c
---
 sys/dev/axgbe/if_axgbe_pci.c    | 2 +-
 sys/dev/bnxt/bnxt.h             | 2 +-
 sys/dev/bnxt/if_bnxt.c          | 4 ++--
 sys/dev/e1000/if_em.c           | 8 ++++----
 sys/dev/iavf/iavf_drv_info.h    | 2 +-
 sys/dev/ice/ice_drv_info.h      | 2 +-
 sys/dev/igc/if_igc.c            | 2 +-
 sys/dev/ixgbe/if_ix.c           | 4 ++--
 sys/dev/ixgbe/if_ixv.c          | 4 ++--
 sys/dev/ixl/if_ixl.c            | 2 +-
 sys/dev/mgb/if_mgb.c            | 2 +-
 sys/dev/vmware/vmxnet3/if_vmx.c | 2 +-
 12 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/sys/dev/axgbe/if_axgbe_pci.c b/sys/dev/axgbe/if_axgbe_pci.c
index 5f5be18b162d..cd498bf1b5d7 100644
--- a/sys/dev/axgbe/if_axgbe_pci.c
+++ b/sys/dev/axgbe/if_axgbe_pci.c
@@ -137,7 +137,7 @@ static struct resource_spec axgbe_pci_mac_spec[] = {
 	{ -1, 0 }
 };
 
-static pci_vendor_info_t axgbe_vendor_info_array[] =
+static const pci_vendor_info_t axgbe_vendor_info_array[] =
 {
 	PVID(0x1022, 0x1458,  "AMD 10 Gigabit Ethernet Driver"),
 	PVID(0x1022, 0x1459,  "AMD 10 Gigabit Ethernet Driver"),
diff --git a/sys/dev/bnxt/bnxt.h b/sys/dev/bnxt/bnxt.h
index 78b7e4ca6bf5..2b5c16e263d7 100644
--- a/sys/dev/bnxt/bnxt.h
+++ b/sys/dev/bnxt/bnxt.h
@@ -206,7 +206,7 @@
 
 #define BNXT_MIN_FRAME_SIZE	52	/* Frames must be padded to this size for some A0 chips */
 
-extern char bnxt_driver_version[];
+extern const char bnxt_driver_version[];
 typedef void (*bnxt_doorbell_tx)(void *, uint16_t idx);
 typedef void (*bnxt_doorbell_rx)(void *, uint16_t idx);
 typedef void (*bnxt_doorbell_rx_cq)(void *, bool);
diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c
index db8b4125e5bd..b7c71e70a576 100644
--- a/sys/dev/bnxt/if_bnxt.c
+++ b/sys/dev/bnxt/if_bnxt.c
@@ -67,7 +67,7 @@
  * PCI Device ID Table
  */
 
-static pci_vendor_info_t bnxt_vendor_info_array[] =
+static const pci_vendor_info_t bnxt_vendor_info_array[] =
 {
     PVID(BROADCOM_VENDOR_ID, BCM57301,
 	"Broadcom BCM57301 NetXtreme-C 10Gb Ethernet Controller"),
@@ -303,7 +303,7 @@ static driver_t bnxt_iflib_driver = {
  */
 
 #define BNXT_DRIVER_VERSION	"2.20.0.1"
-char bnxt_driver_version[] = BNXT_DRIVER_VERSION;
+const char bnxt_driver_version[] = BNXT_DRIVER_VERSION;
 extern struct if_txrx bnxt_txrx;
 static struct if_shared_ctx bnxt_sctx_init = {
 	.isc_magic = IFLIB_MAGIC,
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index 8cf130048128..b0870fd3f2b3 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -36,8 +36,8 @@
 /*********************************************************************
  *  Driver version:
  *********************************************************************/
-char em_driver_version[] = "7.7.8-fbsd";
-char igb_driver_version[] = "2.5.19-fbsd";
+static const char em_driver_version[] = "7.7.8-fbsd";
+static const char igb_driver_version[] = "2.5.19-fbsd";
 
 /*********************************************************************
  *  PCI Device ID Table
@@ -49,7 +49,7 @@ char igb_driver_version[] = "2.5.19-fbsd";
  *  { Vendor ID, Device ID, SubVendor ID, SubDevice ID, String Index }
  *********************************************************************/
 
-static pci_vendor_info_t em_vendor_info_array[] =
+static const pci_vendor_info_t em_vendor_info_array[] =
 {
 	/* Intel(R) - lem-class legacy devices */
 	PVID(0x8086, E1000_DEV_ID_82540EM, "Intel(R) Legacy PRO/1000 MT 82540EM"),
@@ -214,7 +214,7 @@ static pci_vendor_info_t em_vendor_info_array[] =
 	PVID_END
 };
 
-static pci_vendor_info_t igb_vendor_info_array[] =
+static const pci_vendor_info_t igb_vendor_info_array[] =
 {
 	/* Intel(R) - igb-class devices */
 	PVID(0x8086, E1000_DEV_ID_82575EB_COPPER, "Intel(R) PRO/1000 82575EB (Copper)"),
diff --git a/sys/dev/iavf/iavf_drv_info.h b/sys/dev/iavf/iavf_drv_info.h
index ed8e05fe9727..5a84a30662a8 100644
--- a/sys/dev/iavf/iavf_drv_info.h
+++ b/sys/dev/iavf/iavf_drv_info.h
@@ -66,7 +66,7 @@ const char iavf_driver_version[] = "3.0.26-k";
  * to most-generic entry; e.g. PVIDV_OEM()s for a device ID must come before
  * the PVIDV() for it.
  */
-static pci_vendor_info_t iavf_vendor_info_array[] = {
+static const pci_vendor_info_t iavf_vendor_info_array[] = {
 	PVIDV(IAVF_INTEL_VENDOR_ID, IAVF_DEV_ID_VF,
 	    "Intel(R) Ethernet Virtual Function 700 Series"),
 	PVIDV(IAVF_INTEL_VENDOR_ID, IAVF_DEV_ID_X722_VF,
diff --git a/sys/dev/ice/ice_drv_info.h b/sys/dev/ice/ice_drv_info.h
index f258650760bc..41598923dc94 100644
--- a/sys/dev/ice/ice_drv_info.h
+++ b/sys/dev/ice/ice_drv_info.h
@@ -85,7 +85,7 @@ const uint8_t ice_rc_version = 0;
  * to most-generic entry; e.g. PVIDV_OEM()s for a device ID must come before
  * the PVIDV() for it.
  */
-static pci_vendor_info_t ice_vendor_info_array[] = {
+static const pci_vendor_info_t ice_vendor_info_array[] = {
 	PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_BACKPLANE,
 		"Intel(R) Ethernet Controller E810-C for backplane"),
 	PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP,
diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c
index 82fb0d72070b..3e05d1a7b957 100644
--- a/sys/dev/igc/if_igc.c
+++ b/sys/dev/igc/if_igc.c
@@ -46,7 +46,7 @@
  *  { Vendor ID, Device ID, String }
  *********************************************************************/
 
-static pci_vendor_info_t igc_vendor_info_array[] =
+static const pci_vendor_info_t igc_vendor_info_array[] =
 {
 	/* Intel(R) PRO/1000 Network Connection - igc */
 	PVID(0x8086, IGC_DEV_ID_I225_LM, "Intel(R) Ethernet Controller I225-LM"),
diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index b1cba9f24929..e265fa77ba4b 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -45,7 +45,7 @@
 /************************************************************************
  * Driver version
  ************************************************************************/
-char ixgbe_driver_version[] = "4.0.1-k";
+static const char ixgbe_driver_version[] = "4.0.1-k";
 
 /************************************************************************
  * PCI Device ID Table
@@ -56,7 +56,7 @@ char ixgbe_driver_version[] = "4.0.1-k";
  *
  *   { Vendor ID, Device ID, SubVendor ID, SubDevice ID, String Index }
  ************************************************************************/
-static pci_vendor_info_t ixgbe_vendor_info_array[] =
+static const pci_vendor_info_t ixgbe_vendor_info_array[] =
 {
   PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598AF_DUAL_PORT,  "Intel(R) 82598EB AF (Dual Fiber)"),
   PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598AF_SINGLE_PORT,  "Intel(R) 82598EB AF (Fiber)"),
diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c
index 956acf46ee24..fe23ea226348 100644
--- a/sys/dev/ixgbe/if_ixv.c
+++ b/sys/dev/ixgbe/if_ixv.c
@@ -45,7 +45,7 @@
 /************************************************************************
  * Driver version
  ************************************************************************/
-char ixv_driver_version[] = "2.0.1-k";
+static const char ixv_driver_version[] = "2.0.1-k";
 
 /************************************************************************
  * PCI Device ID Table
@@ -56,7 +56,7 @@ char ixv_driver_version[] = "2.0.1-k";
  *
  *   { Vendor ID, Device ID, SubVendor ID, SubDevice ID, String Index }
  ************************************************************************/
-static pci_vendor_info_t ixv_vendor_info_array[] =
+static const pci_vendor_info_t ixv_vendor_info_array[] =
 {
 	PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_VF, "Intel(R) X520 82599 Virtual Function"),
 	PVID(IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540_VF, "Intel(R) X540 Virtual Function"),
diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c
index 23d8fc1c6cbb..c52d5ad287ba 100644
--- a/sys/dev/ixl/if_ixl.c
+++ b/sys/dev/ixl/if_ixl.c
@@ -63,7 +63,7 @@
  *  ( Vendor ID, Device ID, Branding String )
  *********************************************************************/
 
-static pci_vendor_info_t ixl_vendor_info_array[] =
+static const pci_vendor_info_t ixl_vendor_info_array[] =
 {
 	PVIDV(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_SFP_XL710, "Intel(R) Ethernet Controller X710 for 10GbE SFP+"),
 	PVIDV(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_KX_B, "Intel(R) Ethernet Controller XL710 for 40GbE backplane"),
diff --git a/sys/dev/mgb/if_mgb.c b/sys/dev/mgb/if_mgb.c
index e3806300ed9a..7ac93ec020c4 100644
--- a/sys/dev/mgb/if_mgb.c
+++ b/sys/dev/mgb/if_mgb.c
@@ -86,7 +86,7 @@
 #include "ifdi_if.h"
 #include "miibus_if.h"
 
-static pci_vendor_info_t mgb_vendor_info_array[] = {
+static const pci_vendor_info_t mgb_vendor_info_array[] = {
 	PVID(MGB_MICROCHIP_VENDOR_ID, MGB_LAN7430_DEVICE_ID,
 	    "Microchip LAN7430 PCIe Gigabit Ethernet Controller"),
 	PVID(MGB_MICROCHIP_VENDOR_ID, MGB_LAN7431_DEVICE_ID,
diff --git a/sys/dev/vmware/vmxnet3/if_vmx.c b/sys/dev/vmware/vmxnet3/if_vmx.c
index cd313b5b8084..4f2c8cb7f3cc 100644
--- a/sys/dev/vmware/vmxnet3/if_vmx.c
+++ b/sys/dev/vmware/vmxnet3/if_vmx.c
@@ -77,7 +77,7 @@
 #define VMXNET3_VMWARE_VENDOR_ID	0x15AD
 #define VMXNET3_VMWARE_DEVICE_ID	0x07B0
 
-static pci_vendor_info_t vmxnet3_vendor_info_array[] =
+static const pci_vendor_info_t vmxnet3_vendor_info_array[] =
 {
 	PVID(VMXNET3_VMWARE_VENDOR_ID, VMXNET3_VMWARE_DEVICE_ID, "VMware VMXNET3 Ethernet Adapter"),
 	/* required last entry */