aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJesse Brandeburg <jesse.brandeburg@intel.com>2011-09-22 22:11:29 -0400
committerDavid S. Miller <davem@davemloft.net>2011-09-23 13:55:25 -0400
commitac5ac789ebcf5b27e9edc231f6d33c92d722c607 (patch)
treed4d43ce8f4f194f48ddc253d6f8941e0053e51e8 /drivers
parent120deefa0bef266d4e01e986f272de2f0f5d3ef3 (diff)
ixgb: eliminate checkstack warnings
Really trivial fix, use kmalloc/kfree instead of stack space. use static const instead of const to further reduce stack usage. V2: reflect changes suggested by Joe Perches before: [jbrandeb@jbrandeb-mobl2 linux-2.6]$ make checkstack|grep '\[ixgb\]' 0x00000fc1 ixgb_set_multi [ixgb]: 768 0x00001031 ixgb_set_multi [ixgb]: 768 0x000010f2 ixgb_set_multi [ixgb]: 768 0x061c ixgb_check_options [ixgb]: 448 0x09c3 ixgb_check_options [ixgb]: 448 0x0000649e ixgb_set_ringparam [ixgb]: 192 0x0000130d ixgb_xmit_frame [ixgb]: 184 0x000019e0 ixgb_xmit_frame [ixgb]: 184 0x00002267 ixgb_clean [ixgb]: 152 0x00002673 ixgb_clean [ixgb]: 152 after: 0x000064ee ixgb_set_ringparam [ixgb]: 192 0x0000135d ixgb_xmit_frame [ixgb]: 184 0x00001a30 ixgb_xmit_frame [ixgb]: 184 0x000022b7 ixgb_clean [ixgb]: 152 0x000026c3 ixgb_clean [ixgb]: 152 Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_ee.c2
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_ee.h4
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_hw.c2
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_hw.h4
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_main.c21
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_osdep.h1
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_param.c18
7 files changed, 28 insertions, 24 deletions
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_ee.c b/drivers/net/ethernet/intel/ixgb/ixgb_ee.c
index 38b362b6785..2ed925f3881 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_ee.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_ee.c
@@ -559,7 +559,7 @@ ixgb_get_ee_mac_addr(struct ixgb_hw *hw,
559 ENTER(); 559 ENTER();
560 560
561 if (ixgb_check_and_get_eeprom_data(hw) == true) { 561 if (ixgb_check_and_get_eeprom_data(hw) == true) {
562 for (i = 0; i < IXGB_ETH_LENGTH_OF_ADDRESS; i++) { 562 for (i = 0; i < ETH_ALEN; i++) {
563 mac_addr[i] = ee_map->mac_addr[i]; 563 mac_addr[i] = ee_map->mac_addr[i];
564 } 564 }
565 pr_debug("eeprom mac address = %pM\n", mac_addr); 565 pr_debug("eeprom mac address = %pM\n", mac_addr);
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_ee.h b/drivers/net/ethernet/intel/ixgb/ixgb_ee.h
index 7ea12652f47..5680f64314b 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_ee.h
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_ee.h
@@ -31,8 +31,6 @@
31 31
32#define IXGB_EEPROM_SIZE 64 /* Size in words */ 32#define IXGB_EEPROM_SIZE 64 /* Size in words */
33 33
34#define IXGB_ETH_LENGTH_OF_ADDRESS 6
35
36/* EEPROM Commands */ 34/* EEPROM Commands */
37#define EEPROM_READ_OPCODE 0x6 /* EEPROM read opcode */ 35#define EEPROM_READ_OPCODE 0x6 /* EEPROM read opcode */
38#define EEPROM_WRITE_OPCODE 0x5 /* EEPROM write opcode */ 36#define EEPROM_WRITE_OPCODE 0x5 /* EEPROM write opcode */
@@ -75,7 +73,7 @@
75 73
76/* EEPROM structure */ 74/* EEPROM structure */
77struct ixgb_ee_map_type { 75struct ixgb_ee_map_type {
78 u8 mac_addr[IXGB_ETH_LENGTH_OF_ADDRESS]; 76 u8 mac_addr[ETH_ALEN];
79 __le16 compatibility; 77 __le16 compatibility;
80 __le16 reserved1[4]; 78 __le16 reserved1[4];
81 __le32 pba_number; 79 __le32 pba_number;
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_hw.c b/drivers/net/ethernet/intel/ixgb/ixgb_hw.c
index 3d61a9e4faf..99b69adb4a0 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_hw.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_hw.c
@@ -478,7 +478,7 @@ ixgb_mc_addr_list_update(struct ixgb_hw *hw,
478 ixgb_mta_set(hw, hash_value); 478 ixgb_mta_set(hw, hash_value);
479 } 479 }
480 480
481 mca += IXGB_ETH_LENGTH_OF_ADDRESS + pad; 481 mca += ETH_ALEN + pad;
482 } 482 }
483 483
484 pr_debug("MC Update Complete\n"); 484 pr_debug("MC Update Complete\n");
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_hw.h b/drivers/net/ethernet/intel/ixgb/ixgb_hw.h
index 873d32b89fb..2a99a35c33a 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_hw.h
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_hw.h
@@ -97,8 +97,6 @@ typedef enum {
97 ixgb_bus_width_64 97 ixgb_bus_width_64
98} ixgb_bus_width; 98} ixgb_bus_width;
99 99
100#define IXGB_ETH_LENGTH_OF_ADDRESS 6
101
102#define IXGB_EEPROM_SIZE 64 /* Size in words */ 100#define IXGB_EEPROM_SIZE 64 /* Size in words */
103 101
104#define SPEED_10000 10000 102#define SPEED_10000 10000
@@ -674,7 +672,7 @@ struct ixgb_hw {
674 u32 max_frame_size; /* Maximum frame size supported */ 672 u32 max_frame_size; /* Maximum frame size supported */
675 u32 mc_filter_type; /* Multicast filter hash type */ 673 u32 mc_filter_type; /* Multicast filter hash type */
676 u32 num_mc_addrs; /* Number of current Multicast addrs */ 674 u32 num_mc_addrs; /* Number of current Multicast addrs */
677 u8 curr_mac_addr[IXGB_ETH_LENGTH_OF_ADDRESS]; /* Individual address currently programmed in MAC */ 675 u8 curr_mac_addr[ETH_ALEN]; /* Individual address currently programmed in MAC */
678 u32 num_tx_desc; /* Number of Transmit descriptors */ 676 u32 num_tx_desc; /* Number of Transmit descriptors */
679 u32 num_rx_desc; /* Number of Receive descriptors */ 677 u32 num_rx_desc; /* Number of Receive descriptors */
680 u32 rx_buffer_size; /* Size of Receive buffer */ 678 u32 rx_buffer_size; /* Size of Receive buffer */
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index b8fb1630459..ca3ab4a29ac 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -1093,7 +1093,6 @@ ixgb_set_multi(struct net_device *netdev)
1093 struct ixgb_hw *hw = &adapter->hw; 1093 struct ixgb_hw *hw = &adapter->hw;
1094 struct netdev_hw_addr *ha; 1094 struct netdev_hw_addr *ha;
1095 u32 rctl; 1095 u32 rctl;
1096 int i;
1097 1096
1098 /* Check for Promiscuous and All Multicast modes */ 1097 /* Check for Promiscuous and All Multicast modes */
1099 1098
@@ -1120,19 +1119,27 @@ ixgb_set_multi(struct net_device *netdev)
1120 rctl |= IXGB_RCTL_MPE; 1119 rctl |= IXGB_RCTL_MPE;
1121 IXGB_WRITE_REG(hw, RCTL, rctl); 1120 IXGB_WRITE_REG(hw, RCTL, rctl);
1122 } else { 1121 } else {
1123 u8 mta[IXGB_MAX_NUM_MULTICAST_ADDRESSES * 1122 u8 *mta = kmalloc(IXGB_MAX_NUM_MULTICAST_ADDRESSES *
1124 IXGB_ETH_LENGTH_OF_ADDRESS]; 1123 ETH_ALEN, GFP_ATOMIC);
1124 u8 *addr;
1125 if (!mta) {
1126 pr_err("allocation of multicast memory failed\n");
1127 goto alloc_failed;
1128 }
1125 1129
1126 IXGB_WRITE_REG(hw, RCTL, rctl); 1130 IXGB_WRITE_REG(hw, RCTL, rctl);
1127 1131
1128 i = 0; 1132 addr = mta;
1129 netdev_for_each_mc_addr(ha, netdev) 1133 netdev_for_each_mc_addr(ha, netdev) {
1130 memcpy(&mta[i++ * IXGB_ETH_LENGTH_OF_ADDRESS], 1134 memcpy(addr, ha->addr, ETH_ALEN);
1131 ha->addr, IXGB_ETH_LENGTH_OF_ADDRESS); 1135 addr += ETH_ALEN;
1136 }
1132 1137
1133 ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0); 1138 ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0);
1139 kfree(mta);
1134 } 1140 }
1135 1141
1142alloc_failed:
1136 if (netdev->features & NETIF_F_HW_VLAN_RX) 1143 if (netdev->features & NETIF_F_HW_VLAN_RX)
1137 ixgb_vlan_strip_enable(adapter); 1144 ixgb_vlan_strip_enable(adapter);
1138 else 1145 else
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_osdep.h b/drivers/net/ethernet/intel/ixgb/ixgb_osdep.h
index e361185920e..8fc90519223 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_osdep.h
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_osdep.h
@@ -38,6 +38,7 @@
38#include <asm/io.h> 38#include <asm/io.h>
39#include <linux/interrupt.h> 39#include <linux/interrupt.h>
40#include <linux/sched.h> 40#include <linux/sched.h>
41#include <linux/if_ether.h>
41 42
42#undef ASSERT 43#undef ASSERT
43#define ASSERT(x) BUG_ON(!(x)) 44#define ASSERT(x) BUG_ON(!(x))
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_param.c b/drivers/net/ethernet/intel/ixgb/ixgb_param.c
index dd7fbeb1f7d..07d83ab46e2 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_param.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_param.c
@@ -267,7 +267,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
267 } 267 }
268 268
269 { /* Transmit Descriptor Count */ 269 { /* Transmit Descriptor Count */
270 const struct ixgb_option opt = { 270 static const struct ixgb_option opt = {
271 .type = range_option, 271 .type = range_option,
272 .name = "Transmit Descriptors", 272 .name = "Transmit Descriptors",
273 .err = "using default of " __MODULE_STRING(DEFAULT_TXD), 273 .err = "using default of " __MODULE_STRING(DEFAULT_TXD),
@@ -286,7 +286,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
286 tx_ring->count = ALIGN(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); 286 tx_ring->count = ALIGN(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE);
287 } 287 }
288 { /* Receive Descriptor Count */ 288 { /* Receive Descriptor Count */
289 const struct ixgb_option opt = { 289 static const struct ixgb_option opt = {
290 .type = range_option, 290 .type = range_option,
291 .name = "Receive Descriptors", 291 .name = "Receive Descriptors",
292 .err = "using default of " __MODULE_STRING(DEFAULT_RXD), 292 .err = "using default of " __MODULE_STRING(DEFAULT_RXD),
@@ -305,7 +305,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
305 rx_ring->count = ALIGN(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); 305 rx_ring->count = ALIGN(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE);
306 } 306 }
307 { /* Receive Checksum Offload Enable */ 307 { /* Receive Checksum Offload Enable */
308 const struct ixgb_option opt = { 308 static const struct ixgb_option opt = {
309 .type = enable_option, 309 .type = enable_option,
310 .name = "Receive Checksum Offload", 310 .name = "Receive Checksum Offload",
311 .err = "defaulting to Enabled", 311 .err = "defaulting to Enabled",
@@ -348,7 +348,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
348 } 348 }
349 } 349 }
350 { /* Receive Flow Control High Threshold */ 350 { /* Receive Flow Control High Threshold */
351 const struct ixgb_option opt = { 351 static const struct ixgb_option opt = {
352 .type = range_option, 352 .type = range_option,
353 .name = "Rx Flow Control High Threshold", 353 .name = "Rx Flow Control High Threshold",
354 .err = "using default of " __MODULE_STRING(DEFAULT_FCRTH), 354 .err = "using default of " __MODULE_STRING(DEFAULT_FCRTH),
@@ -367,7 +367,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
367 pr_info("Ignoring RxFCHighThresh when no RxFC\n"); 367 pr_info("Ignoring RxFCHighThresh when no RxFC\n");
368 } 368 }
369 { /* Receive Flow Control Low Threshold */ 369 { /* Receive Flow Control Low Threshold */
370 const struct ixgb_option opt = { 370 static const struct ixgb_option opt = {
371 .type = range_option, 371 .type = range_option,
372 .name = "Rx Flow Control Low Threshold", 372 .name = "Rx Flow Control Low Threshold",
373 .err = "using default of " __MODULE_STRING(DEFAULT_FCRTL), 373 .err = "using default of " __MODULE_STRING(DEFAULT_FCRTL),
@@ -386,7 +386,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
386 pr_info("Ignoring RxFCLowThresh when no RxFC\n"); 386 pr_info("Ignoring RxFCLowThresh when no RxFC\n");
387 } 387 }
388 { /* Flow Control Pause Time Request*/ 388 { /* Flow Control Pause Time Request*/
389 const struct ixgb_option opt = { 389 static const struct ixgb_option opt = {
390 .type = range_option, 390 .type = range_option,
391 .name = "Flow Control Pause Time Request", 391 .name = "Flow Control Pause Time Request",
392 .err = "using default of "__MODULE_STRING(DEFAULT_FCPAUSE), 392 .err = "using default of "__MODULE_STRING(DEFAULT_FCPAUSE),
@@ -416,7 +416,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
416 } 416 }
417 } 417 }
418 { /* Receive Interrupt Delay */ 418 { /* Receive Interrupt Delay */
419 const struct ixgb_option opt = { 419 static const struct ixgb_option opt = {
420 .type = range_option, 420 .type = range_option,
421 .name = "Receive Interrupt Delay", 421 .name = "Receive Interrupt Delay",
422 .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), 422 .err = "using default of " __MODULE_STRING(DEFAULT_RDTR),
@@ -433,7 +433,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
433 } 433 }
434 } 434 }
435 { /* Transmit Interrupt Delay */ 435 { /* Transmit Interrupt Delay */
436 const struct ixgb_option opt = { 436 static const struct ixgb_option opt = {
437 .type = range_option, 437 .type = range_option,
438 .name = "Transmit Interrupt Delay", 438 .name = "Transmit Interrupt Delay",
439 .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), 439 .err = "using default of " __MODULE_STRING(DEFAULT_TIDV),
@@ -451,7 +451,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
451 } 451 }
452 452
453 { /* Transmit Interrupt Delay Enable */ 453 { /* Transmit Interrupt Delay Enable */
454 const struct ixgb_option opt = { 454 static const struct ixgb_option opt = {
455 .type = enable_option, 455 .type = enable_option,
456 .name = "Tx Interrupt Delay Enable", 456 .name = "Tx Interrupt Delay Enable",
457 .err = "defaulting to Enabled", 457 .err = "defaulting to Enabled",