Skip to contentSkip to conversation

net/ixgbevf: make array api static const, makes object smaller

PATCH In review Colin King 2 participants 2 messages Sep 6, 2019 – Sep 9, 2019

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 net/ixgbevf: make array api static const, makes object smaller

From: Colin Ian King <[email protected]>

Don't populate the array api on the stack but instead make it static const. Makes the object code smaller by 58 bytes.

Before:

   text	   data	    bss	    dec	    hex	filename
  82969	   9763	    256	  92988	  16b3c	ixgbevf/ixgbevf_main.o

After:

   text	   data	    bss	    dec	    hex	filename
  82815	   9859	    256	  92930	  16b02	ixgbevf/ixgbevf_main.o

(gcc version 9.2.1, amd64)

---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +8 -6
index 8c011d4ce7a9..46c8e2501084 100644
@@ -2261,12 +2261,14 @@ static void ixgbevf_init_last_counter_stats(struct ixgbevf_adapter *adapter)
 static void ixgbevf_negotiate_api(struct ixgbevf_adapter *adapter)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	int api[] = { ixgbe_mbox_api_14,
-		      ixgbe_mbox_api_13,
-		      ixgbe_mbox_api_12,
-		      ixgbe_mbox_api_11,
-		      ixgbe_mbox_api_10,
-		      ixgbe_mbox_api_unknown };
+	static const int api[] = {
+		ixgbe_mbox_api_14,
+		ixgbe_mbox_api_13,
+		ixgbe_mbox_api_12,
+		ixgbe_mbox_api_11,
+		ixgbe_mbox_api_10,
+		ixgbe_mbox_api_unknown
+	};
 	int err, idx = 0;
 
 	spin_lock_bh(&adapter->mbx_lock);
Signature · 1 line
2.20.1
Tested-by on v1 1/1
#1 lore raw
Quoted 24 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Colin King
Sent: Friday, September 6, 2019 4:34 AM
To: Kirsher, Jeffrey T <[email protected]>; David S . Miller <[email protected]>; intel-wired-lan at lists.osuosl.org; netdev at vger.kernel.org
Cc: kernel-janitors at vger.kernel.org; linux-kernel at vger.kernel.org
Subject: [Intel-wired-lan] [PATCH] net/ixgbevf: make array api static const, makes object smaller

From: Colin Ian King <[email protected]>

Don't populate the array api on the stack but instead make it static const. Makes the object code smaller by 58 bytes.

Before:

   text	   data	    bss	    dec	    hex	filename
  82969	   9763	    256	  92988	  16b3c	ixgbevf/ixgbevf_main.o

After:

   text	   data	    bss	    dec	    hex	filename
  82815	   9859	    256	  92930	  16b02	ixgbevf/ixgbevf_main.o
Quoted 6 lines

(gcc version 9.2.1, amd64)

---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)