Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Aug 2023 18:35:11 GMT
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 51e235148a4b - main - iflib drivers: Constify PCI ID LUTs
Message-ID:  <202308171835.37HIZBXD047108@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by marius:

URL: https://cgit.FreeBSD.org/src/commit/?id=51e235148a4becba94e824a44bd69687644a7f56

commit 51e235148a4becba94e824a44bd69687644a7f56
Author:     Marius Strobl <marius@FreeBSD.org>
AuthorDate: 2023-08-16 16:49:34 +0000
Commit:     Marius Strobl <marius@FreeBSD.org>
CommitDate: 2023-08-17 18:34:23 +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.
---
 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/enetc/if_enetc.c        | 2 +-
 sys/dev/enic/if_enic.c          | 2 +-
 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 +-
 14 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/sys/dev/axgbe/if_axgbe_pci.c b/sys/dev/axgbe/if_axgbe_pci.c
index ac0bab896cb9..7f661e6d9c98 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 c77be218e677..2796eed94e11 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"),
@@ -300,7 +300,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 aabd1242b74c..4fa275f08e28 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/enetc/if_enetc.c b/sys/dev/enetc/if_enetc.c
index 2924a8e19f86..04171698cd38 100644
--- a/sys/dev/enetc/if_enetc.c
+++ b/sys/dev/enetc/if_enetc.c
@@ -125,7 +125,7 @@ static int			enetc_ctrl_send(struct enetc_softc*,
 
 static const char enetc_driver_version[] = "1.0.0";
 
-static pci_vendor_info_t enetc_vendor_info_array[] = {
+static const pci_vendor_info_t enetc_vendor_info_array[] = {
 	PVID(PCI_VENDOR_FREESCALE, ENETC_DEV_ID_PF,
 	    "Freescale ENETC PCIe Gigabit Ethernet Controller"),
 	PVID_END
diff --git a/sys/dev/enic/if_enic.c b/sys/dev/enic/if_enic.c
index a386191a51ef..b2fc3af56006 100644
--- a/sys/dev/enic/if_enic.c
+++ b/sys/dev/enic/if_enic.c
@@ -57,7 +57,7 @@
 static SYSCTL_NODE(_hw, OID_AUTO, enic, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
     "ENIC");
 
-static pci_vendor_info_t enic_vendor_info_array[] =
+static const pci_vendor_info_t enic_vendor_info_array[] =
 {
 	PVID(CISCO_VENDOR_ID, PCI_DEVICE_ID_CISCO_VIC_ENET,
 	     DRV_DESCRIPTION),
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 03c366207ff0..c59e379ca2c8 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 ea705d427b86..e8fb5de493ce 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 1e902df0510a..66a1e4fe2df1 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 a1dfe523893e..60e66aeaf579 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 60d0c21ccceb..4a23ef3cdcaf 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 c819f3aae995..99e84e744d57 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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202308171835.37HIZBXD047108>