diff options
author | Prarit Bhargava <prarit@redhat.com> | 2010-06-02 08:51:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-02 08:51:19 -0400 |
commit | 7dad171c39dc83bd267c4f98d8b02d38e0d65596 (patch) | |
tree | fa2d2808359069aaef576852cee7443323d78134 /drivers/net/vxge/vxge-main.c | |
parent | c2d9ba9bce8d7323ca96f239e1f505c14d6244fb (diff) |
vxge: Fix checkstack warning in vxge_probe()
Linux 2.6.33 reports this checkstack warning:
drivers/net/vxge/vxge-main.c: In function 'vxge_probe':
drivers/net/vxge/vxge-main.c:4409: warning: the frame size of 1028 bytes is larger than 1024 bytes
This warning does not occur in the latest linux-2.6 or linux-next, however,
when I do a 'make -j32 CONFIG_FRAME_WARN=512' instead of 1024 I see
drivers/net/vxge/vxge-main.c: In function ‘vxge_probe’:
drivers/net/vxge/vxge-main.c:4423: warning: the frame size of 1024 bytes is larger than 512 bytes
This patch moves the large vxge_config struct off the stack.
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxge/vxge-main.c')
-rw-r--r-- | drivers/net/vxge/vxge-main.c | 93 |
1 files changed, 51 insertions, 42 deletions
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c index b504bd561362..45c5dc225631 100644 --- a/drivers/net/vxge/vxge-main.c +++ b/drivers/net/vxge/vxge-main.c | |||
@@ -4012,7 +4012,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4012 | int high_dma = 0; | 4012 | int high_dma = 0; |
4013 | u64 vpath_mask = 0; | 4013 | u64 vpath_mask = 0; |
4014 | struct vxgedev *vdev; | 4014 | struct vxgedev *vdev; |
4015 | struct vxge_config ll_config; | 4015 | struct vxge_config *ll_config = NULL; |
4016 | struct vxge_hw_device_config *device_config = NULL; | 4016 | struct vxge_hw_device_config *device_config = NULL; |
4017 | struct vxge_hw_device_attr attr; | 4017 | struct vxge_hw_device_attr attr; |
4018 | int i, j, no_of_vpath = 0, max_vpath_supported = 0; | 4018 | int i, j, no_of_vpath = 0, max_vpath_supported = 0; |
@@ -4071,17 +4071,24 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4071 | goto _exit0; | 4071 | goto _exit0; |
4072 | } | 4072 | } |
4073 | 4073 | ||
4074 | memset(&ll_config, 0, sizeof(struct vxge_config)); | 4074 | ll_config = kzalloc(sizeof(*ll_config), GFP_KERNEL); |
4075 | ll_config.tx_steering_type = TX_MULTIQ_STEERING; | 4075 | if (!ll_config) { |
4076 | ll_config.intr_type = MSI_X; | 4076 | ret = -ENOMEM; |
4077 | ll_config.napi_weight = NEW_NAPI_WEIGHT; | 4077 | vxge_debug_init(VXGE_ERR, |
4078 | ll_config.rth_steering = RTH_STEERING; | 4078 | "ll_config : malloc failed %s %d", |
4079 | __FILE__, __LINE__); | ||
4080 | goto _exit0; | ||
4081 | } | ||
4082 | ll_config->tx_steering_type = TX_MULTIQ_STEERING; | ||
4083 | ll_config->intr_type = MSI_X; | ||
4084 | ll_config->napi_weight = NEW_NAPI_WEIGHT; | ||
4085 | ll_config->rth_steering = RTH_STEERING; | ||
4079 | 4086 | ||
4080 | /* get the default configuration parameters */ | 4087 | /* get the default configuration parameters */ |
4081 | vxge_hw_device_config_default_get(device_config); | 4088 | vxge_hw_device_config_default_get(device_config); |
4082 | 4089 | ||
4083 | /* initialize configuration parameters */ | 4090 | /* initialize configuration parameters */ |
4084 | vxge_device_config_init(device_config, &ll_config.intr_type); | 4091 | vxge_device_config_init(device_config, &ll_config->intr_type); |
4085 | 4092 | ||
4086 | ret = pci_enable_device(pdev); | 4093 | ret = pci_enable_device(pdev); |
4087 | if (ret) { | 4094 | if (ret) { |
@@ -4134,7 +4141,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4134 | (unsigned long long)pci_resource_start(pdev, 0)); | 4141 | (unsigned long long)pci_resource_start(pdev, 0)); |
4135 | 4142 | ||
4136 | status = vxge_hw_device_hw_info_get(attr.bar0, | 4143 | status = vxge_hw_device_hw_info_get(attr.bar0, |
4137 | &ll_config.device_hw_info); | 4144 | &ll_config->device_hw_info); |
4138 | if (status != VXGE_HW_OK) { | 4145 | if (status != VXGE_HW_OK) { |
4139 | vxge_debug_init(VXGE_ERR, | 4146 | vxge_debug_init(VXGE_ERR, |
4140 | "%s: Reading of hardware info failed." | 4147 | "%s: Reading of hardware info failed." |
@@ -4143,7 +4150,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4143 | goto _exit3; | 4150 | goto _exit3; |
4144 | } | 4151 | } |
4145 | 4152 | ||
4146 | if (ll_config.device_hw_info.fw_version.major != | 4153 | if (ll_config->device_hw_info.fw_version.major != |
4147 | VXGE_DRIVER_FW_VERSION_MAJOR) { | 4154 | VXGE_DRIVER_FW_VERSION_MAJOR) { |
4148 | vxge_debug_init(VXGE_ERR, | 4155 | vxge_debug_init(VXGE_ERR, |
4149 | "%s: Incorrect firmware version." | 4156 | "%s: Incorrect firmware version." |
@@ -4153,7 +4160,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4153 | goto _exit3; | 4160 | goto _exit3; |
4154 | } | 4161 | } |
4155 | 4162 | ||
4156 | vpath_mask = ll_config.device_hw_info.vpath_mask; | 4163 | vpath_mask = ll_config->device_hw_info.vpath_mask; |
4157 | if (vpath_mask == 0) { | 4164 | if (vpath_mask == 0) { |
4158 | vxge_debug_ll_config(VXGE_TRACE, | 4165 | vxge_debug_ll_config(VXGE_TRACE, |
4159 | "%s: No vpaths available in device", VXGE_DRIVER_NAME); | 4166 | "%s: No vpaths available in device", VXGE_DRIVER_NAME); |
@@ -4165,10 +4172,10 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4165 | "%s:%d Vpath mask = %llx", __func__, __LINE__, | 4172 | "%s:%d Vpath mask = %llx", __func__, __LINE__, |
4166 | (unsigned long long)vpath_mask); | 4173 | (unsigned long long)vpath_mask); |
4167 | 4174 | ||
4168 | function_mode = ll_config.device_hw_info.function_mode; | 4175 | function_mode = ll_config->device_hw_info.function_mode; |
4169 | host_type = ll_config.device_hw_info.host_type; | 4176 | host_type = ll_config->device_hw_info.host_type; |
4170 | is_privileged = __vxge_hw_device_is_privilaged(host_type, | 4177 | is_privileged = __vxge_hw_device_is_privilaged(host_type, |
4171 | ll_config.device_hw_info.func_id); | 4178 | ll_config->device_hw_info.func_id); |
4172 | 4179 | ||
4173 | /* Check how many vpaths are available */ | 4180 | /* Check how many vpaths are available */ |
4174 | for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) { | 4181 | for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) { |
@@ -4182,7 +4189,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4182 | 4189 | ||
4183 | /* Enable SRIOV mode, if firmware has SRIOV support and if it is a PF */ | 4190 | /* Enable SRIOV mode, if firmware has SRIOV support and if it is a PF */ |
4184 | if (is_sriov(function_mode) && (max_config_dev > 1) && | 4191 | if (is_sriov(function_mode) && (max_config_dev > 1) && |
4185 | (ll_config.intr_type != INTA) && | 4192 | (ll_config->intr_type != INTA) && |
4186 | (is_privileged == VXGE_HW_OK)) { | 4193 | (is_privileged == VXGE_HW_OK)) { |
4187 | ret = pci_enable_sriov(pdev, ((max_config_dev - 1) < num_vfs) | 4194 | ret = pci_enable_sriov(pdev, ((max_config_dev - 1) < num_vfs) |
4188 | ? (max_config_dev - 1) : num_vfs); | 4195 | ? (max_config_dev - 1) : num_vfs); |
@@ -4195,7 +4202,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4195 | * Configure vpaths and get driver configured number of vpaths | 4202 | * Configure vpaths and get driver configured number of vpaths |
4196 | * which is less than or equal to the maximum vpaths per function. | 4203 | * which is less than or equal to the maximum vpaths per function. |
4197 | */ | 4204 | */ |
4198 | no_of_vpath = vxge_config_vpaths(device_config, vpath_mask, &ll_config); | 4205 | no_of_vpath = vxge_config_vpaths(device_config, vpath_mask, ll_config); |
4199 | if (!no_of_vpath) { | 4206 | if (!no_of_vpath) { |
4200 | vxge_debug_ll_config(VXGE_ERR, | 4207 | vxge_debug_ll_config(VXGE_ERR, |
4201 | "%s: No more vpaths to configure", VXGE_DRIVER_NAME); | 4208 | "%s: No more vpaths to configure", VXGE_DRIVER_NAME); |
@@ -4230,21 +4237,21 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4230 | /* set private device info */ | 4237 | /* set private device info */ |
4231 | pci_set_drvdata(pdev, hldev); | 4238 | pci_set_drvdata(pdev, hldev); |
4232 | 4239 | ||
4233 | ll_config.gro_enable = VXGE_GRO_ALWAYS_AGGREGATE; | 4240 | ll_config->gro_enable = VXGE_GRO_ALWAYS_AGGREGATE; |
4234 | ll_config.fifo_indicate_max_pkts = VXGE_FIFO_INDICATE_MAX_PKTS; | 4241 | ll_config->fifo_indicate_max_pkts = VXGE_FIFO_INDICATE_MAX_PKTS; |
4235 | ll_config.addr_learn_en = addr_learn_en; | 4242 | ll_config->addr_learn_en = addr_learn_en; |
4236 | ll_config.rth_algorithm = RTH_ALG_JENKINS; | 4243 | ll_config->rth_algorithm = RTH_ALG_JENKINS; |
4237 | ll_config.rth_hash_type_tcpipv4 = VXGE_HW_RING_HASH_TYPE_TCP_IPV4; | 4244 | ll_config->rth_hash_type_tcpipv4 = VXGE_HW_RING_HASH_TYPE_TCP_IPV4; |
4238 | ll_config.rth_hash_type_ipv4 = VXGE_HW_RING_HASH_TYPE_NONE; | 4245 | ll_config->rth_hash_type_ipv4 = VXGE_HW_RING_HASH_TYPE_NONE; |
4239 | ll_config.rth_hash_type_tcpipv6 = VXGE_HW_RING_HASH_TYPE_NONE; | 4246 | ll_config->rth_hash_type_tcpipv6 = VXGE_HW_RING_HASH_TYPE_NONE; |
4240 | ll_config.rth_hash_type_ipv6 = VXGE_HW_RING_HASH_TYPE_NONE; | 4247 | ll_config->rth_hash_type_ipv6 = VXGE_HW_RING_HASH_TYPE_NONE; |
4241 | ll_config.rth_hash_type_tcpipv6ex = VXGE_HW_RING_HASH_TYPE_NONE; | 4248 | ll_config->rth_hash_type_tcpipv6ex = VXGE_HW_RING_HASH_TYPE_NONE; |
4242 | ll_config.rth_hash_type_ipv6ex = VXGE_HW_RING_HASH_TYPE_NONE; | 4249 | ll_config->rth_hash_type_ipv6ex = VXGE_HW_RING_HASH_TYPE_NONE; |
4243 | ll_config.rth_bkt_sz = RTH_BUCKET_SIZE; | 4250 | ll_config->rth_bkt_sz = RTH_BUCKET_SIZE; |
4244 | ll_config.tx_pause_enable = VXGE_PAUSE_CTRL_ENABLE; | 4251 | ll_config->tx_pause_enable = VXGE_PAUSE_CTRL_ENABLE; |
4245 | ll_config.rx_pause_enable = VXGE_PAUSE_CTRL_ENABLE; | 4252 | ll_config->rx_pause_enable = VXGE_PAUSE_CTRL_ENABLE; |
4246 | 4253 | ||
4247 | if (vxge_device_register(hldev, &ll_config, high_dma, no_of_vpath, | 4254 | if (vxge_device_register(hldev, ll_config, high_dma, no_of_vpath, |
4248 | &vdev)) { | 4255 | &vdev)) { |
4249 | ret = -EINVAL; | 4256 | ret = -EINVAL; |
4250 | goto _exit4; | 4257 | goto _exit4; |
@@ -4275,7 +4282,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4275 | vdev->vpaths[j].vdev = vdev; | 4282 | vdev->vpaths[j].vdev = vdev; |
4276 | vdev->vpaths[j].max_mac_addr_cnt = max_mac_vpath; | 4283 | vdev->vpaths[j].max_mac_addr_cnt = max_mac_vpath; |
4277 | memcpy((u8 *)vdev->vpaths[j].macaddr, | 4284 | memcpy((u8 *)vdev->vpaths[j].macaddr, |
4278 | (u8 *)ll_config.device_hw_info.mac_addrs[i], | 4285 | ll_config->device_hw_info.mac_addrs[i], |
4279 | ETH_ALEN); | 4286 | ETH_ALEN); |
4280 | 4287 | ||
4281 | /* Initialize the mac address list header */ | 4288 | /* Initialize the mac address list header */ |
@@ -4296,18 +4303,18 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4296 | 4303 | ||
4297 | macaddr = (u8 *)vdev->vpaths[0].macaddr; | 4304 | macaddr = (u8 *)vdev->vpaths[0].macaddr; |
4298 | 4305 | ||
4299 | ll_config.device_hw_info.serial_number[VXGE_HW_INFO_LEN - 1] = '\0'; | 4306 | ll_config->device_hw_info.serial_number[VXGE_HW_INFO_LEN - 1] = '\0'; |
4300 | ll_config.device_hw_info.product_desc[VXGE_HW_INFO_LEN - 1] = '\0'; | 4307 | ll_config->device_hw_info.product_desc[VXGE_HW_INFO_LEN - 1] = '\0'; |
4301 | ll_config.device_hw_info.part_number[VXGE_HW_INFO_LEN - 1] = '\0'; | 4308 | ll_config->device_hw_info.part_number[VXGE_HW_INFO_LEN - 1] = '\0'; |
4302 | 4309 | ||
4303 | vxge_debug_init(VXGE_TRACE, "%s: SERIAL NUMBER: %s", | 4310 | vxge_debug_init(VXGE_TRACE, "%s: SERIAL NUMBER: %s", |
4304 | vdev->ndev->name, ll_config.device_hw_info.serial_number); | 4311 | vdev->ndev->name, ll_config->device_hw_info.serial_number); |
4305 | 4312 | ||
4306 | vxge_debug_init(VXGE_TRACE, "%s: PART NUMBER: %s", | 4313 | vxge_debug_init(VXGE_TRACE, "%s: PART NUMBER: %s", |
4307 | vdev->ndev->name, ll_config.device_hw_info.part_number); | 4314 | vdev->ndev->name, ll_config->device_hw_info.part_number); |
4308 | 4315 | ||
4309 | vxge_debug_init(VXGE_TRACE, "%s: Neterion %s Server Adapter", | 4316 | vxge_debug_init(VXGE_TRACE, "%s: Neterion %s Server Adapter", |
4310 | vdev->ndev->name, ll_config.device_hw_info.product_desc); | 4317 | vdev->ndev->name, ll_config->device_hw_info.product_desc); |
4311 | 4318 | ||
4312 | vxge_debug_init(VXGE_TRACE, "%s: MAC ADDR: %pM", | 4319 | vxge_debug_init(VXGE_TRACE, "%s: MAC ADDR: %pM", |
4313 | vdev->ndev->name, macaddr); | 4320 | vdev->ndev->name, macaddr); |
@@ -4317,11 +4324,11 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4317 | 4324 | ||
4318 | vxge_debug_init(VXGE_TRACE, | 4325 | vxge_debug_init(VXGE_TRACE, |
4319 | "%s: Firmware version : %s Date : %s", vdev->ndev->name, | 4326 | "%s: Firmware version : %s Date : %s", vdev->ndev->name, |
4320 | ll_config.device_hw_info.fw_version.version, | 4327 | ll_config->device_hw_info.fw_version.version, |
4321 | ll_config.device_hw_info.fw_date.date); | 4328 | ll_config->device_hw_info.fw_date.date); |
4322 | 4329 | ||
4323 | if (new_device) { | 4330 | if (new_device) { |
4324 | switch (ll_config.device_hw_info.function_mode) { | 4331 | switch (ll_config->device_hw_info.function_mode) { |
4325 | case VXGE_HW_FUNCTION_MODE_SINGLE_FUNCTION: | 4332 | case VXGE_HW_FUNCTION_MODE_SINGLE_FUNCTION: |
4326 | vxge_debug_init(VXGE_TRACE, | 4333 | vxge_debug_init(VXGE_TRACE, |
4327 | "%s: Single Function Mode Enabled", vdev->ndev->name); | 4334 | "%s: Single Function Mode Enabled", vdev->ndev->name); |
@@ -4344,7 +4351,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4344 | vxge_print_parm(vdev, vpath_mask); | 4351 | vxge_print_parm(vdev, vpath_mask); |
4345 | 4352 | ||
4346 | /* Store the fw version for ethttool option */ | 4353 | /* Store the fw version for ethttool option */ |
4347 | strcpy(vdev->fw_version, ll_config.device_hw_info.fw_version.version); | 4354 | strcpy(vdev->fw_version, ll_config->device_hw_info.fw_version.version); |
4348 | memcpy(vdev->ndev->dev_addr, (u8 *)vdev->vpaths[0].macaddr, ETH_ALEN); | 4355 | memcpy(vdev->ndev->dev_addr, (u8 *)vdev->vpaths[0].macaddr, ETH_ALEN); |
4349 | memcpy(vdev->ndev->perm_addr, vdev->ndev->dev_addr, ETH_ALEN); | 4356 | memcpy(vdev->ndev->perm_addr, vdev->ndev->dev_addr, ETH_ALEN); |
4350 | 4357 | ||
@@ -4383,7 +4390,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4383 | * present to prevent such a failure. | 4390 | * present to prevent such a failure. |
4384 | */ | 4391 | */ |
4385 | 4392 | ||
4386 | if (ll_config.device_hw_info.function_mode == | 4393 | if (ll_config->device_hw_info.function_mode == |
4387 | VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION) | 4394 | VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION) |
4388 | if (vdev->config.intr_type == INTA) | 4395 | if (vdev->config.intr_type == INTA) |
4389 | vxge_hw_device_unmask_all(hldev); | 4396 | vxge_hw_device_unmask_all(hldev); |
@@ -4395,6 +4402,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
4395 | VXGE_COPY_DEBUG_INFO_TO_LL(vdev, vxge_hw_device_error_level_get(hldev), | 4402 | VXGE_COPY_DEBUG_INFO_TO_LL(vdev, vxge_hw_device_error_level_get(hldev), |
4396 | vxge_hw_device_trace_level_get(hldev)); | 4403 | vxge_hw_device_trace_level_get(hldev)); |
4397 | 4404 | ||
4405 | kfree(ll_config); | ||
4398 | return 0; | 4406 | return 0; |
4399 | 4407 | ||
4400 | _exit5: | 4408 | _exit5: |
@@ -4412,6 +4420,7 @@ _exit2: | |||
4412 | _exit1: | 4420 | _exit1: |
4413 | pci_disable_device(pdev); | 4421 | pci_disable_device(pdev); |
4414 | _exit0: | 4422 | _exit0: |
4423 | kfree(ll_config); | ||
4415 | kfree(device_config); | 4424 | kfree(device_config); |
4416 | driver_config->config_dev_cnt--; | 4425 | driver_config->config_dev_cnt--; |
4417 | pci_set_drvdata(pdev, NULL); | 4426 | pci_set_drvdata(pdev, NULL); |