diff options
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r-- | drivers/net/s2io.c | 299 |
1 files changed, 243 insertions, 56 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index fd85648d98d1..44bb2395af84 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -42,6 +42,14 @@ | |||
42 | * Possible values '1' for enable '0' for disable. Default is '0' | 42 | * Possible values '1' for enable '0' for disable. Default is '0' |
43 | * lro_max_pkts: This parameter defines maximum number of packets can be | 43 | * lro_max_pkts: This parameter defines maximum number of packets can be |
44 | * aggregated as a single large packet | 44 | * aggregated as a single large packet |
45 | * napi: This parameter used to enable/disable NAPI (polling Rx) | ||
46 | * Possible values '1' for enable and '0' for disable. Default is '1' | ||
47 | * ufo: This parameter used to enable/disable UDP Fragmentation Offload(UFO) | ||
48 | * Possible values '1' for enable and '0' for disable. Default is '0' | ||
49 | * vlan_tag_strip: This can be used to enable or disable vlan stripping. | ||
50 | * Possible values '1' for enable , '0' for disable. | ||
51 | * Default is '2' - which means disable in promisc mode | ||
52 | * and enable in non-promiscuous mode. | ||
45 | ************************************************************************/ | 53 | ************************************************************************/ |
46 | 54 | ||
47 | #include <linux/module.h> | 55 | #include <linux/module.h> |
@@ -76,7 +84,7 @@ | |||
76 | #include "s2io.h" | 84 | #include "s2io.h" |
77 | #include "s2io-regs.h" | 85 | #include "s2io-regs.h" |
78 | 86 | ||
79 | #define DRV_VERSION "2.0.16.1" | 87 | #define DRV_VERSION "2.0.17.1" |
80 | 88 | ||
81 | /* S2io Driver name & version. */ | 89 | /* S2io Driver name & version. */ |
82 | static char s2io_driver_name[] = "Neterion"; | 90 | static char s2io_driver_name[] = "Neterion"; |
@@ -131,7 +139,7 @@ static char s2io_gstrings[][ETH_GSTRING_LEN] = { | |||
131 | "BIST Test\t(offline)" | 139 | "BIST Test\t(offline)" |
132 | }; | 140 | }; |
133 | 141 | ||
134 | static char ethtool_stats_keys[][ETH_GSTRING_LEN] = { | 142 | static char ethtool_xena_stats_keys[][ETH_GSTRING_LEN] = { |
135 | {"tmac_frms"}, | 143 | {"tmac_frms"}, |
136 | {"tmac_data_octets"}, | 144 | {"tmac_data_octets"}, |
137 | {"tmac_drop_frms"}, | 145 | {"tmac_drop_frms"}, |
@@ -225,7 +233,10 @@ static char ethtool_stats_keys[][ETH_GSTRING_LEN] = { | |||
225 | {"rxd_rd_cnt"}, | 233 | {"rxd_rd_cnt"}, |
226 | {"rxd_wr_cnt"}, | 234 | {"rxd_wr_cnt"}, |
227 | {"txf_rd_cnt"}, | 235 | {"txf_rd_cnt"}, |
228 | {"rxf_wr_cnt"}, | 236 | {"rxf_wr_cnt"} |
237 | }; | ||
238 | |||
239 | static char ethtool_enhanced_stats_keys[][ETH_GSTRING_LEN] = { | ||
229 | {"rmac_ttl_1519_4095_frms"}, | 240 | {"rmac_ttl_1519_4095_frms"}, |
230 | {"rmac_ttl_4096_8191_frms"}, | 241 | {"rmac_ttl_4096_8191_frms"}, |
231 | {"rmac_ttl_8192_max_frms"}, | 242 | {"rmac_ttl_8192_max_frms"}, |
@@ -241,7 +252,10 @@ static char ethtool_stats_keys[][ETH_GSTRING_LEN] = { | |||
241 | {"rmac_red_discard"}, | 252 | {"rmac_red_discard"}, |
242 | {"rmac_rts_discard"}, | 253 | {"rmac_rts_discard"}, |
243 | {"rmac_ingm_full_discard"}, | 254 | {"rmac_ingm_full_discard"}, |
244 | {"link_fault_cnt"}, | 255 | {"link_fault_cnt"} |
256 | }; | ||
257 | |||
258 | static char ethtool_driver_stats_keys[][ETH_GSTRING_LEN] = { | ||
245 | {"\n DRIVER STATISTICS"}, | 259 | {"\n DRIVER STATISTICS"}, |
246 | {"single_bit_ecc_errs"}, | 260 | {"single_bit_ecc_errs"}, |
247 | {"double_bit_ecc_errs"}, | 261 | {"double_bit_ecc_errs"}, |
@@ -269,8 +283,16 @@ static char ethtool_stats_keys[][ETH_GSTRING_LEN] = { | |||
269 | ("lro_avg_aggr_pkts"), | 283 | ("lro_avg_aggr_pkts"), |
270 | }; | 284 | }; |
271 | 285 | ||
272 | #define S2IO_STAT_LEN sizeof(ethtool_stats_keys)/ ETH_GSTRING_LEN | 286 | #define S2IO_XENA_STAT_LEN sizeof(ethtool_xena_stats_keys)/ ETH_GSTRING_LEN |
273 | #define S2IO_STAT_STRINGS_LEN S2IO_STAT_LEN * ETH_GSTRING_LEN | 287 | #define S2IO_ENHANCED_STAT_LEN sizeof(ethtool_enhanced_stats_keys)/ \ |
288 | ETH_GSTRING_LEN | ||
289 | #define S2IO_DRIVER_STAT_LEN sizeof(ethtool_driver_stats_keys)/ ETH_GSTRING_LEN | ||
290 | |||
291 | #define XFRAME_I_STAT_LEN (S2IO_XENA_STAT_LEN + S2IO_DRIVER_STAT_LEN ) | ||
292 | #define XFRAME_II_STAT_LEN (XFRAME_I_STAT_LEN + S2IO_ENHANCED_STAT_LEN ) | ||
293 | |||
294 | #define XFRAME_I_STAT_STRINGS_LEN ( XFRAME_I_STAT_LEN * ETH_GSTRING_LEN ) | ||
295 | #define XFRAME_II_STAT_STRINGS_LEN ( XFRAME_II_STAT_LEN * ETH_GSTRING_LEN ) | ||
274 | 296 | ||
275 | #define S2IO_TEST_LEN sizeof(s2io_gstrings) / ETH_GSTRING_LEN | 297 | #define S2IO_TEST_LEN sizeof(s2io_gstrings) / ETH_GSTRING_LEN |
276 | #define S2IO_STRINGS_LEN S2IO_TEST_LEN * ETH_GSTRING_LEN | 298 | #define S2IO_STRINGS_LEN S2IO_TEST_LEN * ETH_GSTRING_LEN |
@@ -293,6 +315,9 @@ static void s2io_vlan_rx_register(struct net_device *dev, | |||
293 | spin_unlock_irqrestore(&nic->tx_lock, flags); | 315 | spin_unlock_irqrestore(&nic->tx_lock, flags); |
294 | } | 316 | } |
295 | 317 | ||
318 | /* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */ | ||
319 | int vlan_strip_flag; | ||
320 | |||
296 | /* Unregister the vlan */ | 321 | /* Unregister the vlan */ |
297 | static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid) | 322 | static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid) |
298 | { | 323 | { |
@@ -404,6 +429,7 @@ S2IO_PARM_INT(indicate_max_pkts, 0); | |||
404 | 429 | ||
405 | S2IO_PARM_INT(napi, 1); | 430 | S2IO_PARM_INT(napi, 1); |
406 | S2IO_PARM_INT(ufo, 0); | 431 | S2IO_PARM_INT(ufo, 0); |
432 | S2IO_PARM_INT(vlan_tag_strip, NO_STRIP_IN_PROMISC); | ||
407 | 433 | ||
408 | static unsigned int tx_fifo_len[MAX_TX_FIFOS] = | 434 | static unsigned int tx_fifo_len[MAX_TX_FIFOS] = |
409 | {DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN}; | 435 | {DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN}; |
@@ -1371,6 +1397,16 @@ static int init_nic(struct s2io_nic *nic) | |||
1371 | &bar0->rts_frm_len_n[i]); | 1397 | &bar0->rts_frm_len_n[i]); |
1372 | } | 1398 | } |
1373 | } | 1399 | } |
1400 | |||
1401 | /* Disable differentiated services steering logic */ | ||
1402 | for (i = 0; i < 64; i++) { | ||
1403 | if (rts_ds_steer(nic, i, 0) == FAILURE) { | ||
1404 | DBG_PRINT(ERR_DBG, "%s: failed rts ds steering", | ||
1405 | dev->name); | ||
1406 | DBG_PRINT(ERR_DBG, "set on codepoint %d\n", i); | ||
1407 | return FAILURE; | ||
1408 | } | ||
1409 | } | ||
1374 | 1410 | ||
1375 | /* Program statistics memory */ | 1411 | /* Program statistics memory */ |
1376 | writeq(mac_control->stats_mem_phy, &bar0->stat_addr); | 1412 | writeq(mac_control->stats_mem_phy, &bar0->stat_addr); |
@@ -1943,6 +1979,13 @@ static int start_nic(struct s2io_nic *nic) | |||
1943 | writeq(val64, &bar0->rx_pa_cfg); | 1979 | writeq(val64, &bar0->rx_pa_cfg); |
1944 | } | 1980 | } |
1945 | 1981 | ||
1982 | if (vlan_tag_strip == 0) { | ||
1983 | val64 = readq(&bar0->rx_pa_cfg); | ||
1984 | val64 &= ~RX_PA_CFG_STRIP_VLAN_TAG; | ||
1985 | writeq(val64, &bar0->rx_pa_cfg); | ||
1986 | vlan_strip_flag = 0; | ||
1987 | } | ||
1988 | |||
1946 | /* | 1989 | /* |
1947 | * Enabling MC-RLDRAM. After enabling the device, we timeout | 1990 | * Enabling MC-RLDRAM. After enabling the device, we timeout |
1948 | * for around 100ms, which is approximately the time required | 1991 | * for around 100ms, which is approximately the time required |
@@ -3195,26 +3238,37 @@ static void alarm_intr_handler(struct s2io_nic *nic) | |||
3195 | * SUCCESS on success and FAILURE on failure. | 3238 | * SUCCESS on success and FAILURE on failure. |
3196 | */ | 3239 | */ |
3197 | 3240 | ||
3198 | static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit) | 3241 | static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit, |
3242 | int bit_state) | ||
3199 | { | 3243 | { |
3200 | int ret = FAILURE, cnt = 0; | 3244 | int ret = FAILURE, cnt = 0, delay = 1; |
3201 | u64 val64; | 3245 | u64 val64; |
3202 | 3246 | ||
3203 | while (TRUE) { | 3247 | if ((bit_state != S2IO_BIT_RESET) && (bit_state != S2IO_BIT_SET)) |
3248 | return FAILURE; | ||
3249 | |||
3250 | do { | ||
3204 | val64 = readq(addr); | 3251 | val64 = readq(addr); |
3205 | if (!(val64 & busy_bit)) { | 3252 | if (bit_state == S2IO_BIT_RESET) { |
3206 | ret = SUCCESS; | 3253 | if (!(val64 & busy_bit)) { |
3207 | break; | 3254 | ret = SUCCESS; |
3255 | break; | ||
3256 | } | ||
3257 | } else { | ||
3258 | if (!(val64 & busy_bit)) { | ||
3259 | ret = SUCCESS; | ||
3260 | break; | ||
3261 | } | ||
3208 | } | 3262 | } |
3209 | 3263 | ||
3210 | if(in_interrupt()) | 3264 | if(in_interrupt()) |
3211 | mdelay(50); | 3265 | mdelay(delay); |
3212 | else | 3266 | else |
3213 | msleep(50); | 3267 | msleep(delay); |
3214 | 3268 | ||
3215 | if (cnt++ > 10) | 3269 | if (++cnt >= 10) |
3216 | break; | 3270 | delay = 50; |
3217 | } | 3271 | } while (cnt < 20); |
3218 | return ret; | 3272 | return ret; |
3219 | } | 3273 | } |
3220 | /* | 3274 | /* |
@@ -3340,6 +3394,9 @@ new_way: | |||
3340 | writeq(val64, &bar0->pcc_err_reg); | 3394 | writeq(val64, &bar0->pcc_err_reg); |
3341 | } | 3395 | } |
3342 | 3396 | ||
3397 | /* restore the previously assigned mac address */ | ||
3398 | s2io_set_mac_addr(sp->dev, (u8 *)&sp->def_mac_addr[0].mac_addr); | ||
3399 | |||
3343 | sp->device_enabled_once = FALSE; | 3400 | sp->device_enabled_once = FALSE; |
3344 | } | 3401 | } |
3345 | 3402 | ||
@@ -4087,6 +4144,11 @@ static void s2io_txpic_intr_handle(struct s2io_nic *sp) | |||
4087 | val64 &= ~GPIO_INT_MASK_LINK_UP; | 4144 | val64 &= ~GPIO_INT_MASK_LINK_UP; |
4088 | val64 |= GPIO_INT_MASK_LINK_DOWN; | 4145 | val64 |= GPIO_INT_MASK_LINK_DOWN; |
4089 | writeq(val64, &bar0->gpio_int_mask); | 4146 | writeq(val64, &bar0->gpio_int_mask); |
4147 | |||
4148 | /* turn off LED */ | ||
4149 | val64 = readq(&bar0->adapter_control); | ||
4150 | val64 = val64 &(~ADAPTER_LED_ON); | ||
4151 | writeq(val64, &bar0->adapter_control); | ||
4090 | } | 4152 | } |
4091 | } | 4153 | } |
4092 | val64 = readq(&bar0->gpio_int_mask); | 4154 | val64 = readq(&bar0->gpio_int_mask); |
@@ -4296,7 +4358,8 @@ static void s2io_set_multicast(struct net_device *dev) | |||
4296 | writeq(val64, &bar0->rmac_addr_cmd_mem); | 4358 | writeq(val64, &bar0->rmac_addr_cmd_mem); |
4297 | /* Wait till command completes */ | 4359 | /* Wait till command completes */ |
4298 | wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem, | 4360 | wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem, |
4299 | RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING); | 4361 | RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING, |
4362 | S2IO_BIT_RESET); | ||
4300 | 4363 | ||
4301 | sp->m_cast_flg = 1; | 4364 | sp->m_cast_flg = 1; |
4302 | sp->all_multi_pos = MAC_MC_ALL_MC_ADDR_OFFSET; | 4365 | sp->all_multi_pos = MAC_MC_ALL_MC_ADDR_OFFSET; |
@@ -4312,7 +4375,8 @@ static void s2io_set_multicast(struct net_device *dev) | |||
4312 | writeq(val64, &bar0->rmac_addr_cmd_mem); | 4375 | writeq(val64, &bar0->rmac_addr_cmd_mem); |
4313 | /* Wait till command completes */ | 4376 | /* Wait till command completes */ |
4314 | wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem, | 4377 | wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem, |
4315 | RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING); | 4378 | RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING, |
4379 | S2IO_BIT_RESET); | ||
4316 | 4380 | ||
4317 | sp->m_cast_flg = 0; | 4381 | sp->m_cast_flg = 0; |
4318 | sp->all_multi_pos = 0; | 4382 | sp->all_multi_pos = 0; |
@@ -4329,6 +4393,13 @@ static void s2io_set_multicast(struct net_device *dev) | |||
4329 | writeq(RMAC_CFG_KEY(0x4C0D), &bar0->rmac_cfg_key); | 4393 | writeq(RMAC_CFG_KEY(0x4C0D), &bar0->rmac_cfg_key); |
4330 | writel((u32) (val64 >> 32), (add + 4)); | 4394 | writel((u32) (val64 >> 32), (add + 4)); |
4331 | 4395 | ||
4396 | if (vlan_tag_strip != 1) { | ||
4397 | val64 = readq(&bar0->rx_pa_cfg); | ||
4398 | val64 &= ~RX_PA_CFG_STRIP_VLAN_TAG; | ||
4399 | writeq(val64, &bar0->rx_pa_cfg); | ||
4400 | vlan_strip_flag = 0; | ||
4401 | } | ||
4402 | |||
4332 | val64 = readq(&bar0->mac_cfg); | 4403 | val64 = readq(&bar0->mac_cfg); |
4333 | sp->promisc_flg = 1; | 4404 | sp->promisc_flg = 1; |
4334 | DBG_PRINT(INFO_DBG, "%s: entered promiscuous mode\n", | 4405 | DBG_PRINT(INFO_DBG, "%s: entered promiscuous mode\n", |
@@ -4344,6 +4415,13 @@ static void s2io_set_multicast(struct net_device *dev) | |||
4344 | writeq(RMAC_CFG_KEY(0x4C0D), &bar0->rmac_cfg_key); | 4415 | writeq(RMAC_CFG_KEY(0x4C0D), &bar0->rmac_cfg_key); |
4345 | writel((u32) (val64 >> 32), (add + 4)); | 4416 | writel((u32) (val64 >> 32), (add + 4)); |
4346 | 4417 | ||
4418 | if (vlan_tag_strip != 0) { | ||
4419 | val64 = readq(&bar0->rx_pa_cfg); | ||
4420 | val64 |= RX_PA_CFG_STRIP_VLAN_TAG; | ||
4421 | writeq(val64, &bar0->rx_pa_cfg); | ||
4422 | vlan_strip_flag = 1; | ||
4423 | } | ||
4424 | |||
4347 | val64 = readq(&bar0->mac_cfg); | 4425 | val64 = readq(&bar0->mac_cfg); |
4348 | sp->promisc_flg = 0; | 4426 | sp->promisc_flg = 0; |
4349 | DBG_PRINT(INFO_DBG, "%s: left promiscuous mode\n", | 4427 | DBG_PRINT(INFO_DBG, "%s: left promiscuous mode\n", |
@@ -4378,7 +4456,8 @@ static void s2io_set_multicast(struct net_device *dev) | |||
4378 | 4456 | ||
4379 | /* Wait for command completes */ | 4457 | /* Wait for command completes */ |
4380 | if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem, | 4458 | if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem, |
4381 | RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING)) { | 4459 | RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING, |
4460 | S2IO_BIT_RESET)) { | ||
4382 | DBG_PRINT(ERR_DBG, "%s: Adding ", | 4461 | DBG_PRINT(ERR_DBG, "%s: Adding ", |
4383 | dev->name); | 4462 | dev->name); |
4384 | DBG_PRINT(ERR_DBG, "Multicasts failed\n"); | 4463 | DBG_PRINT(ERR_DBG, "Multicasts failed\n"); |
@@ -4409,7 +4488,8 @@ static void s2io_set_multicast(struct net_device *dev) | |||
4409 | 4488 | ||
4410 | /* Wait for command completes */ | 4489 | /* Wait for command completes */ |
4411 | if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem, | 4490 | if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem, |
4412 | RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING)) { | 4491 | RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING, |
4492 | S2IO_BIT_RESET)) { | ||
4413 | DBG_PRINT(ERR_DBG, "%s: Adding ", | 4493 | DBG_PRINT(ERR_DBG, "%s: Adding ", |
4414 | dev->name); | 4494 | dev->name); |
4415 | DBG_PRINT(ERR_DBG, "Multicasts failed\n"); | 4495 | DBG_PRINT(ERR_DBG, "Multicasts failed\n"); |
@@ -4435,6 +4515,7 @@ static int s2io_set_mac_addr(struct net_device *dev, u8 * addr) | |||
4435 | struct XENA_dev_config __iomem *bar0 = sp->bar0; | 4515 | struct XENA_dev_config __iomem *bar0 = sp->bar0; |
4436 | register u64 val64, mac_addr = 0; | 4516 | register u64 val64, mac_addr = 0; |
4437 | int i; | 4517 | int i; |
4518 | u64 old_mac_addr = 0; | ||
4438 | 4519 | ||
4439 | /* | 4520 | /* |
4440 | * Set the new MAC address as the new unicast filter and reflect this | 4521 | * Set the new MAC address as the new unicast filter and reflect this |
@@ -4444,6 +4525,22 @@ static int s2io_set_mac_addr(struct net_device *dev, u8 * addr) | |||
4444 | for (i = 0; i < ETH_ALEN; i++) { | 4525 | for (i = 0; i < ETH_ALEN; i++) { |
4445 | mac_addr <<= 8; | 4526 | mac_addr <<= 8; |
4446 | mac_addr |= addr[i]; | 4527 | mac_addr |= addr[i]; |
4528 | old_mac_addr <<= 8; | ||
4529 | old_mac_addr |= sp->def_mac_addr[0].mac_addr[i]; | ||
4530 | } | ||
4531 | |||
4532 | if(0 == mac_addr) | ||
4533 | return SUCCESS; | ||
4534 | |||
4535 | /* Update the internal structure with this new mac address */ | ||
4536 | if(mac_addr != old_mac_addr) { | ||
4537 | memset(sp->def_mac_addr[0].mac_addr, 0, sizeof(ETH_ALEN)); | ||
4538 | sp->def_mac_addr[0].mac_addr[5] = (u8) (mac_addr); | ||
4539 | sp->def_mac_addr[0].mac_addr[4] = (u8) (mac_addr >> 8); | ||
4540 | sp->def_mac_addr[0].mac_addr[3] = (u8) (mac_addr >> 16); | ||
4541 | sp->def_mac_addr[0].mac_addr[2] = (u8) (mac_addr >> 24); | ||
4542 | sp->def_mac_addr[0].mac_addr[1] = (u8) (mac_addr >> 32); | ||
4543 | sp->def_mac_addr[0].mac_addr[0] = (u8) (mac_addr >> 40); | ||
4447 | } | 4544 | } |
4448 | 4545 | ||
4449 | writeq(RMAC_ADDR_DATA0_MEM_ADDR(mac_addr), | 4546 | writeq(RMAC_ADDR_DATA0_MEM_ADDR(mac_addr), |
@@ -4455,7 +4552,7 @@ static int s2io_set_mac_addr(struct net_device *dev, u8 * addr) | |||
4455 | writeq(val64, &bar0->rmac_addr_cmd_mem); | 4552 | writeq(val64, &bar0->rmac_addr_cmd_mem); |
4456 | /* Wait till command completes */ | 4553 | /* Wait till command completes */ |
4457 | if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem, | 4554 | if (wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem, |
4458 | RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING)) { | 4555 | RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING, S2IO_BIT_RESET)) { |
4459 | DBG_PRINT(ERR_DBG, "%s: set_mac_addr failed\n", dev->name); | 4556 | DBG_PRINT(ERR_DBG, "%s: set_mac_addr failed\n", dev->name); |
4460 | return FAILURE; | 4557 | return FAILURE; |
4461 | } | 4558 | } |
@@ -4546,7 +4643,11 @@ static void s2io_ethtool_gdrvinfo(struct net_device *dev, | |||
4546 | info->regdump_len = XENA_REG_SPACE; | 4643 | info->regdump_len = XENA_REG_SPACE; |
4547 | info->eedump_len = XENA_EEPROM_SPACE; | 4644 | info->eedump_len = XENA_EEPROM_SPACE; |
4548 | info->testinfo_len = S2IO_TEST_LEN; | 4645 | info->testinfo_len = S2IO_TEST_LEN; |
4549 | info->n_stats = S2IO_STAT_LEN; | 4646 | |
4647 | if (sp->device_type == XFRAME_I_DEVICE) | ||
4648 | info->n_stats = XFRAME_I_STAT_LEN; | ||
4649 | else | ||
4650 | info->n_stats = XFRAME_II_STAT_LEN; | ||
4550 | } | 4651 | } |
4551 | 4652 | ||
4552 | /** | 4653 | /** |
@@ -5568,22 +5669,30 @@ static void s2io_get_ethtool_stats(struct net_device *dev, | |||
5568 | tmp_stats[i++] = le32_to_cpu(stat_info->rxd_wr_cnt); | 5669 | tmp_stats[i++] = le32_to_cpu(stat_info->rxd_wr_cnt); |
5569 | tmp_stats[i++] = le32_to_cpu(stat_info->txf_rd_cnt); | 5670 | tmp_stats[i++] = le32_to_cpu(stat_info->txf_rd_cnt); |
5570 | tmp_stats[i++] = le32_to_cpu(stat_info->rxf_wr_cnt); | 5671 | tmp_stats[i++] = le32_to_cpu(stat_info->rxf_wr_cnt); |
5571 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_1519_4095_frms); | 5672 | |
5572 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_4096_8191_frms); | 5673 | /* Enhanced statistics exist only for Hercules */ |
5573 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_8192_max_frms); | 5674 | if(sp->device_type == XFRAME_II_DEVICE) { |
5574 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_gt_max_frms); | 5675 | tmp_stats[i++] = |
5575 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_osized_alt_frms); | 5676 | le64_to_cpu(stat_info->rmac_ttl_1519_4095_frms); |
5576 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_jabber_alt_frms); | 5677 | tmp_stats[i++] = |
5577 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_gt_max_alt_frms); | 5678 | le64_to_cpu(stat_info->rmac_ttl_4096_8191_frms); |
5578 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_vlan_frms); | 5679 | tmp_stats[i++] = |
5579 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_len_discard); | 5680 | le64_to_cpu(stat_info->rmac_ttl_8192_max_frms); |
5580 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_fcs_discard); | 5681 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_ttl_gt_max_frms); |
5581 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_pf_discard); | 5682 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_osized_alt_frms); |
5582 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_da_discard); | 5683 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_jabber_alt_frms); |
5583 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_red_discard); | 5684 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_gt_max_alt_frms); |
5584 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_rts_discard); | 5685 | tmp_stats[i++] = le64_to_cpu(stat_info->rmac_vlan_frms); |
5585 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_ingm_full_discard); | 5686 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_len_discard); |
5586 | tmp_stats[i++] = le32_to_cpu(stat_info->link_fault_cnt); | 5687 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_fcs_discard); |
5688 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_pf_discard); | ||
5689 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_da_discard); | ||
5690 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_red_discard); | ||
5691 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_rts_discard); | ||
5692 | tmp_stats[i++] = le32_to_cpu(stat_info->rmac_ingm_full_discard); | ||
5693 | tmp_stats[i++] = le32_to_cpu(stat_info->link_fault_cnt); | ||
5694 | } | ||
5695 | |||
5587 | tmp_stats[i++] = 0; | 5696 | tmp_stats[i++] = 0; |
5588 | tmp_stats[i++] = stat_info->sw_stat.single_ecc_errs; | 5697 | tmp_stats[i++] = stat_info->sw_stat.single_ecc_errs; |
5589 | tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs; | 5698 | tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs; |
@@ -5663,18 +5772,42 @@ static int s2io_ethtool_self_test_count(struct net_device *dev) | |||
5663 | static void s2io_ethtool_get_strings(struct net_device *dev, | 5772 | static void s2io_ethtool_get_strings(struct net_device *dev, |
5664 | u32 stringset, u8 * data) | 5773 | u32 stringset, u8 * data) |
5665 | { | 5774 | { |
5775 | int stat_size = 0; | ||
5776 | struct s2io_nic *sp = dev->priv; | ||
5777 | |||
5666 | switch (stringset) { | 5778 | switch (stringset) { |
5667 | case ETH_SS_TEST: | 5779 | case ETH_SS_TEST: |
5668 | memcpy(data, s2io_gstrings, S2IO_STRINGS_LEN); | 5780 | memcpy(data, s2io_gstrings, S2IO_STRINGS_LEN); |
5669 | break; | 5781 | break; |
5670 | case ETH_SS_STATS: | 5782 | case ETH_SS_STATS: |
5671 | memcpy(data, ðtool_stats_keys, | 5783 | stat_size = sizeof(ethtool_xena_stats_keys); |
5672 | sizeof(ethtool_stats_keys)); | 5784 | memcpy(data, ðtool_xena_stats_keys,stat_size); |
5785 | if(sp->device_type == XFRAME_II_DEVICE) { | ||
5786 | memcpy(data + stat_size, | ||
5787 | ðtool_enhanced_stats_keys, | ||
5788 | sizeof(ethtool_enhanced_stats_keys)); | ||
5789 | stat_size += sizeof(ethtool_enhanced_stats_keys); | ||
5790 | } | ||
5791 | |||
5792 | memcpy(data + stat_size, ðtool_driver_stats_keys, | ||
5793 | sizeof(ethtool_driver_stats_keys)); | ||
5673 | } | 5794 | } |
5674 | } | 5795 | } |
5675 | static int s2io_ethtool_get_stats_count(struct net_device *dev) | 5796 | static int s2io_ethtool_get_stats_count(struct net_device *dev) |
5676 | { | 5797 | { |
5677 | return (S2IO_STAT_LEN); | 5798 | struct s2io_nic *sp = dev->priv; |
5799 | int stat_count = 0; | ||
5800 | switch(sp->device_type) { | ||
5801 | case XFRAME_I_DEVICE: | ||
5802 | stat_count = XFRAME_I_STAT_LEN; | ||
5803 | break; | ||
5804 | |||
5805 | case XFRAME_II_DEVICE: | ||
5806 | stat_count = XFRAME_II_STAT_LEN; | ||
5807 | break; | ||
5808 | } | ||
5809 | |||
5810 | return stat_count; | ||
5678 | } | 5811 | } |
5679 | 5812 | ||
5680 | static int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) | 5813 | static int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) |
@@ -5909,7 +6042,7 @@ static void s2io_set_link(struct work_struct *work) | |||
5909 | clear_bit(0, &(nic->link_state)); | 6042 | clear_bit(0, &(nic->link_state)); |
5910 | 6043 | ||
5911 | out_unlock: | 6044 | out_unlock: |
5912 | rtnl_lock(); | 6045 | rtnl_unlock(); |
5913 | } | 6046 | } |
5914 | 6047 | ||
5915 | static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp, | 6048 | static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp, |
@@ -6066,10 +6199,13 @@ static int rxd_owner_bit_reset(struct s2io_nic *sp) | |||
6066 | rx_blocks[j].rxds[k].virt_addr; | 6199 | rx_blocks[j].rxds[k].virt_addr; |
6067 | if(sp->rxd_mode >= RXD_MODE_3A) | 6200 | if(sp->rxd_mode >= RXD_MODE_3A) |
6068 | ba = &mac_control->rings[i].ba[j][k]; | 6201 | ba = &mac_control->rings[i].ba[j][k]; |
6069 | set_rxd_buffer_pointer(sp, rxdp, ba, | 6202 | if (set_rxd_buffer_pointer(sp, rxdp, ba, |
6070 | &skb,(u64 *)&temp0_64, | 6203 | &skb,(u64 *)&temp0_64, |
6071 | (u64 *)&temp1_64, | 6204 | (u64 *)&temp1_64, |
6072 | (u64 *)&temp2_64, size); | 6205 | (u64 *)&temp2_64, |
6206 | size) == ENOMEM) { | ||
6207 | return 0; | ||
6208 | } | ||
6073 | 6209 | ||
6074 | set_rxd_buffer_size(sp, rxdp, size); | 6210 | set_rxd_buffer_size(sp, rxdp, size); |
6075 | wmb(); | 6211 | wmb(); |
@@ -6112,7 +6248,7 @@ static int s2io_add_isr(struct s2io_nic * sp) | |||
6112 | } | 6248 | } |
6113 | } | 6249 | } |
6114 | if (sp->intr_type == MSI_X) { | 6250 | if (sp->intr_type == MSI_X) { |
6115 | int i; | 6251 | int i, msix_tx_cnt=0,msix_rx_cnt=0; |
6116 | 6252 | ||
6117 | for (i=1; (sp->s2io_entries[i].in_use == MSIX_FLG); i++) { | 6253 | for (i=1; (sp->s2io_entries[i].in_use == MSIX_FLG); i++) { |
6118 | if (sp->s2io_entries[i].type == MSIX_FIFO_TYPE) { | 6254 | if (sp->s2io_entries[i].type == MSIX_FIFO_TYPE) { |
@@ -6121,16 +6257,36 @@ static int s2io_add_isr(struct s2io_nic * sp) | |||
6121 | err = request_irq(sp->entries[i].vector, | 6257 | err = request_irq(sp->entries[i].vector, |
6122 | s2io_msix_fifo_handle, 0, sp->desc[i], | 6258 | s2io_msix_fifo_handle, 0, sp->desc[i], |
6123 | sp->s2io_entries[i].arg); | 6259 | sp->s2io_entries[i].arg); |
6124 | DBG_PRINT(ERR_DBG, "%s @ 0x%llx\n", sp->desc[i], | 6260 | /* If either data or addr is zero print it */ |
6125 | (unsigned long long)sp->msix_info[i].addr); | 6261 | if(!(sp->msix_info[i].addr && |
6262 | sp->msix_info[i].data)) { | ||
6263 | DBG_PRINT(ERR_DBG, "%s @ Addr:0x%llx" | ||
6264 | "Data:0x%lx\n",sp->desc[i], | ||
6265 | (unsigned long long) | ||
6266 | sp->msix_info[i].addr, | ||
6267 | (unsigned long) | ||
6268 | ntohl(sp->msix_info[i].data)); | ||
6269 | } else { | ||
6270 | msix_tx_cnt++; | ||
6271 | } | ||
6126 | } else { | 6272 | } else { |
6127 | sprintf(sp->desc[i], "%s:MSI-X-%d-RX", | 6273 | sprintf(sp->desc[i], "%s:MSI-X-%d-RX", |
6128 | dev->name, i); | 6274 | dev->name, i); |
6129 | err = request_irq(sp->entries[i].vector, | 6275 | err = request_irq(sp->entries[i].vector, |
6130 | s2io_msix_ring_handle, 0, sp->desc[i], | 6276 | s2io_msix_ring_handle, 0, sp->desc[i], |
6131 | sp->s2io_entries[i].arg); | 6277 | sp->s2io_entries[i].arg); |
6132 | DBG_PRINT(ERR_DBG, "%s @ 0x%llx\n", sp->desc[i], | 6278 | /* If either data or addr is zero print it */ |
6133 | (unsigned long long)sp->msix_info[i].addr); | 6279 | if(!(sp->msix_info[i].addr && |
6280 | sp->msix_info[i].data)) { | ||
6281 | DBG_PRINT(ERR_DBG, "%s @ Addr:0x%llx" | ||
6282 | "Data:0x%lx\n",sp->desc[i], | ||
6283 | (unsigned long long) | ||
6284 | sp->msix_info[i].addr, | ||
6285 | (unsigned long) | ||
6286 | ntohl(sp->msix_info[i].data)); | ||
6287 | } else { | ||
6288 | msix_rx_cnt++; | ||
6289 | } | ||
6134 | } | 6290 | } |
6135 | if (err) { | 6291 | if (err) { |
6136 | DBG_PRINT(ERR_DBG,"%s:MSI-X-%d registration " | 6292 | DBG_PRINT(ERR_DBG,"%s:MSI-X-%d registration " |
@@ -6140,6 +6296,8 @@ static int s2io_add_isr(struct s2io_nic * sp) | |||
6140 | } | 6296 | } |
6141 | sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS; | 6297 | sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS; |
6142 | } | 6298 | } |
6299 | printk("MSI-X-TX %d entries enabled\n",msix_tx_cnt); | ||
6300 | printk("MSI-X-RX %d entries enabled\n",msix_rx_cnt); | ||
6143 | } | 6301 | } |
6144 | if (sp->intr_type == INTA) { | 6302 | if (sp->intr_type == INTA) { |
6145 | err = request_irq((int) sp->pdev->irq, s2io_isr, IRQF_SHARED, | 6303 | err = request_irq((int) sp->pdev->irq, s2io_isr, IRQF_SHARED, |
@@ -6567,7 +6725,8 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) | |||
6567 | 6725 | ||
6568 | if (!sp->lro) { | 6726 | if (!sp->lro) { |
6569 | skb->protocol = eth_type_trans(skb, dev); | 6727 | skb->protocol = eth_type_trans(skb, dev); |
6570 | if (sp->vlgrp && RXD_GET_VLAN_TAG(rxdp->Control_2)) { | 6728 | if ((sp->vlgrp && RXD_GET_VLAN_TAG(rxdp->Control_2) && |
6729 | vlan_strip_flag)) { | ||
6571 | /* Queueing the vlan frame to the upper layer */ | 6730 | /* Queueing the vlan frame to the upper layer */ |
6572 | if (napi) | 6731 | if (napi) |
6573 | vlan_hwaccel_receive_skb(skb, sp->vlgrp, | 6732 | vlan_hwaccel_receive_skb(skb, sp->vlgrp, |
@@ -6704,8 +6863,7 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type) | |||
6704 | "Defaulting to INTA\n"); | 6863 | "Defaulting to INTA\n"); |
6705 | *dev_intr_type = INTA; | 6864 | *dev_intr_type = INTA; |
6706 | } | 6865 | } |
6707 | if ( (rx_ring_num > 1) && (*dev_intr_type != INTA) ) | 6866 | |
6708 | napi = 0; | ||
6709 | if (rx_ring_mode > 3) { | 6867 | if (rx_ring_mode > 3) { |
6710 | DBG_PRINT(ERR_DBG, "s2io: Requested ring mode not supported\n"); | 6868 | DBG_PRINT(ERR_DBG, "s2io: Requested ring mode not supported\n"); |
6711 | DBG_PRINT(ERR_DBG, "s2io: Defaulting to 3-buffer mode\n"); | 6869 | DBG_PRINT(ERR_DBG, "s2io: Defaulting to 3-buffer mode\n"); |
@@ -6715,6 +6873,37 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type) | |||
6715 | } | 6873 | } |
6716 | 6874 | ||
6717 | /** | 6875 | /** |
6876 | * rts_ds_steer - Receive traffic steering based on IPv4 or IPv6 TOS | ||
6877 | * or Traffic class respectively. | ||
6878 | * @nic: device peivate variable | ||
6879 | * Description: The function configures the receive steering to | ||
6880 | * desired receive ring. | ||
6881 | * Return Value: SUCCESS on success and | ||
6882 | * '-1' on failure (endian settings incorrect). | ||
6883 | */ | ||
6884 | static int rts_ds_steer(struct s2io_nic *nic, u8 ds_codepoint, u8 ring) | ||
6885 | { | ||
6886 | struct XENA_dev_config __iomem *bar0 = nic->bar0; | ||
6887 | register u64 val64 = 0; | ||
6888 | |||
6889 | if (ds_codepoint > 63) | ||
6890 | return FAILURE; | ||
6891 | |||
6892 | val64 = RTS_DS_MEM_DATA(ring); | ||
6893 | writeq(val64, &bar0->rts_ds_mem_data); | ||
6894 | |||
6895 | val64 = RTS_DS_MEM_CTRL_WE | | ||
6896 | RTS_DS_MEM_CTRL_STROBE_NEW_CMD | | ||
6897 | RTS_DS_MEM_CTRL_OFFSET(ds_codepoint); | ||
6898 | |||
6899 | writeq(val64, &bar0->rts_ds_mem_ctrl); | ||
6900 | |||
6901 | return wait_for_cmd_complete(&bar0->rts_ds_mem_ctrl, | ||
6902 | RTS_DS_MEM_CTRL_STROBE_CMD_BEING_EXECUTED, | ||
6903 | S2IO_BIT_RESET); | ||
6904 | } | ||
6905 | |||
6906 | /** | ||
6718 | * s2io_init_nic - Initialization of the adapter . | 6907 | * s2io_init_nic - Initialization of the adapter . |
6719 | * @pdev : structure containing the PCI related information of the device. | 6908 | * @pdev : structure containing the PCI related information of the device. |
6720 | * @pre: List of PCI devices supported by the driver listed in s2io_tbl. | 6909 | * @pre: List of PCI devices supported by the driver listed in s2io_tbl. |
@@ -7008,13 +7197,11 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
7008 | RMAC_ADDR_CMD_MEM_OFFSET(0 + MAC_MAC_ADDR_START_OFFSET); | 7197 | RMAC_ADDR_CMD_MEM_OFFSET(0 + MAC_MAC_ADDR_START_OFFSET); |
7009 | writeq(val64, &bar0->rmac_addr_cmd_mem); | 7198 | writeq(val64, &bar0->rmac_addr_cmd_mem); |
7010 | wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem, | 7199 | wait_for_cmd_complete(&bar0->rmac_addr_cmd_mem, |
7011 | RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING); | 7200 | RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING, S2IO_BIT_RESET); |
7012 | tmp64 = readq(&bar0->rmac_addr_data0_mem); | 7201 | tmp64 = readq(&bar0->rmac_addr_data0_mem); |
7013 | mac_down = (u32) tmp64; | 7202 | mac_down = (u32) tmp64; |
7014 | mac_up = (u32) (tmp64 >> 32); | 7203 | mac_up = (u32) (tmp64 >> 32); |
7015 | 7204 | ||
7016 | memset(sp->def_mac_addr[0].mac_addr, 0, sizeof(ETH_ALEN)); | ||
7017 | |||
7018 | sp->def_mac_addr[0].mac_addr[3] = (u8) (mac_up); | 7205 | sp->def_mac_addr[0].mac_addr[3] = (u8) (mac_up); |
7019 | sp->def_mac_addr[0].mac_addr[2] = (u8) (mac_up >> 8); | 7206 | sp->def_mac_addr[0].mac_addr[2] = (u8) (mac_up >> 8); |
7020 | sp->def_mac_addr[0].mac_addr[1] = (u8) (mac_up >> 16); | 7207 | sp->def_mac_addr[0].mac_addr[1] = (u8) (mac_up >> 16); |