Commit b23c0cc5 authored by Alexander Duyck's avatar Alexander Duyck Committed by Jeff Kirsher

igb: Make arrays on stack static const to avoid reallocation

While addressing the pin problem I noticed that all of the pin register
values where having to be pushed onto the stack each time the function was
called.  To avoid that I am making them static const so that they should
only need to be allocated once and we can avoid all the instructions to get
them onto the stack..

size before:
   text	   data	    bss	    dec	    hex	filename
 161477	  10512	      8	 171997	  29fdd	drivers/net/ethernet/intel/igb/igb.ko

size after:
   text	   data	    bss	    dec	    hex	filename
 161205	  10512	      8	 171725	  29ecd	drivers/net/ethernet/intel/igb/igb.ko
Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@redhat.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent e357f0aa
...@@ -358,7 +358,7 @@ static int igb_ptp_settime_i210(struct ptp_clock_info *ptp, ...@@ -358,7 +358,7 @@ static int igb_ptp_settime_i210(struct ptp_clock_info *ptp,
static void igb_pin_direction(int pin, int input, u32 *ctrl, u32 *ctrl_ext) static void igb_pin_direction(int pin, int input, u32 *ctrl, u32 *ctrl_ext)
{ {
u32 *ptr = pin < 2 ? ctrl : ctrl_ext; u32 *ptr = pin < 2 ? ctrl : ctrl_ext;
u32 mask[IGB_N_SDP] = { static const u32 mask[IGB_N_SDP] = {
E1000_CTRL_SDP0_DIR, E1000_CTRL_SDP0_DIR,
E1000_CTRL_SDP1_DIR, E1000_CTRL_SDP1_DIR,
E1000_CTRL_EXT_SDP2_DIR, E1000_CTRL_EXT_SDP2_DIR,
...@@ -373,16 +373,16 @@ static void igb_pin_direction(int pin, int input, u32 *ctrl, u32 *ctrl_ext) ...@@ -373,16 +373,16 @@ static void igb_pin_direction(int pin, int input, u32 *ctrl, u32 *ctrl_ext)
static void igb_pin_extts(struct igb_adapter *igb, int chan, int pin) static void igb_pin_extts(struct igb_adapter *igb, int chan, int pin)
{ {
struct e1000_hw *hw = &igb->hw; static const u32 aux0_sel_sdp[IGB_N_SDP] = {
u32 aux0_sel_sdp[IGB_N_SDP] = {
AUX0_SEL_SDP0, AUX0_SEL_SDP1, AUX0_SEL_SDP2, AUX0_SEL_SDP3, AUX0_SEL_SDP0, AUX0_SEL_SDP1, AUX0_SEL_SDP2, AUX0_SEL_SDP3,
}; };
u32 aux1_sel_sdp[IGB_N_SDP] = { static const u32 aux1_sel_sdp[IGB_N_SDP] = {
AUX1_SEL_SDP0, AUX1_SEL_SDP1, AUX1_SEL_SDP2, AUX1_SEL_SDP3, AUX1_SEL_SDP0, AUX1_SEL_SDP1, AUX1_SEL_SDP2, AUX1_SEL_SDP3,
}; };
u32 ts_sdp_en[IGB_N_SDP] = { static const u32 ts_sdp_en[IGB_N_SDP] = {
TS_SDP0_EN, TS_SDP1_EN, TS_SDP2_EN, TS_SDP3_EN, TS_SDP0_EN, TS_SDP1_EN, TS_SDP2_EN, TS_SDP3_EN,
}; };
struct e1000_hw *hw = &igb->hw;
u32 ctrl, ctrl_ext, tssdp = 0; u32 ctrl, ctrl_ext, tssdp = 0;
ctrl = rd32(E1000_CTRL); ctrl = rd32(E1000_CTRL);
...@@ -409,28 +409,28 @@ static void igb_pin_extts(struct igb_adapter *igb, int chan, int pin) ...@@ -409,28 +409,28 @@ static void igb_pin_extts(struct igb_adapter *igb, int chan, int pin)
static void igb_pin_perout(struct igb_adapter *igb, int chan, int pin) static void igb_pin_perout(struct igb_adapter *igb, int chan, int pin)
{ {
struct e1000_hw *hw = &igb->hw; static const u32 aux0_sel_sdp[IGB_N_SDP] = {
u32 aux0_sel_sdp[IGB_N_SDP] = {
AUX0_SEL_SDP0, AUX0_SEL_SDP1, AUX0_SEL_SDP2, AUX0_SEL_SDP3, AUX0_SEL_SDP0, AUX0_SEL_SDP1, AUX0_SEL_SDP2, AUX0_SEL_SDP3,
}; };
u32 aux1_sel_sdp[IGB_N_SDP] = { static const u32 aux1_sel_sdp[IGB_N_SDP] = {
AUX1_SEL_SDP0, AUX1_SEL_SDP1, AUX1_SEL_SDP2, AUX1_SEL_SDP3, AUX1_SEL_SDP0, AUX1_SEL_SDP1, AUX1_SEL_SDP2, AUX1_SEL_SDP3,
}; };
u32 ts_sdp_en[IGB_N_SDP] = { static const u32 ts_sdp_en[IGB_N_SDP] = {
TS_SDP0_EN, TS_SDP1_EN, TS_SDP2_EN, TS_SDP3_EN, TS_SDP0_EN, TS_SDP1_EN, TS_SDP2_EN, TS_SDP3_EN,
}; };
u32 ts_sdp_sel_tt0[IGB_N_SDP] = { static const u32 ts_sdp_sel_tt0[IGB_N_SDP] = {
TS_SDP0_SEL_TT0, TS_SDP1_SEL_TT0, TS_SDP0_SEL_TT0, TS_SDP1_SEL_TT0,
TS_SDP2_SEL_TT0, TS_SDP3_SEL_TT0, TS_SDP2_SEL_TT0, TS_SDP3_SEL_TT0,
}; };
u32 ts_sdp_sel_tt1[IGB_N_SDP] = { static const u32 ts_sdp_sel_tt1[IGB_N_SDP] = {
TS_SDP0_SEL_TT1, TS_SDP1_SEL_TT1, TS_SDP0_SEL_TT1, TS_SDP1_SEL_TT1,
TS_SDP2_SEL_TT1, TS_SDP3_SEL_TT1, TS_SDP2_SEL_TT1, TS_SDP3_SEL_TT1,
}; };
u32 ts_sdp_sel_clr[IGB_N_SDP] = { static const u32 ts_sdp_sel_clr[IGB_N_SDP] = {
TS_SDP0_SEL_FC1, TS_SDP1_SEL_FC1, TS_SDP0_SEL_FC1, TS_SDP1_SEL_FC1,
TS_SDP2_SEL_FC1, TS_SDP3_SEL_FC1, TS_SDP2_SEL_FC1, TS_SDP3_SEL_FC1,
}; };
struct e1000_hw *hw = &igb->hw;
u32 ctrl, ctrl_ext, tssdp = 0; u32 ctrl, ctrl_ext, tssdp = 0;
ctrl = rd32(E1000_CTRL); ctrl = rd32(E1000_CTRL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment