aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
diff options
context:
space:
mode:
authorMerav Sicron <meravs@broadcom.com>2012-03-18 06:33:38 -0400
committerDavid S. Miller <davem@davemloft.net>2012-03-19 16:52:48 -0400
commit51c1a580b1e07d58eb063f9f4a70aea8ad32fe23 (patch)
tree83243fae1f89d3b705117a8f609bc427eb389c98 /drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
parentd8290ae54c88cab9f199a84125bd5fda9f48b032 (diff)
bnx2x: revised driver prints
We've revised driver prints, changing the mask of existing prints to allow better control over the debug messages, added prints to error scenarios, removed unnecessary prints and corrected some spelling. Please note that this patch contains lines with over 80 characters, as string messages were kept in a single line. Signed-off-by: Merav Sicron <meravs@broadcom.com> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c189
1 files changed, 116 insertions, 73 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 858d1b5433de..3618a00a8144 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -280,7 +280,7 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
280 cmd->maxtxpkt = 0; 280 cmd->maxtxpkt = 0;
281 cmd->maxrxpkt = 0; 281 cmd->maxrxpkt = 0;
282 282
283 DP(NETIF_MSG_LINK, "ethtool_cmd: cmd %d\n" 283 DP(BNX2X_MSG_ETHTOOL, "ethtool_cmd: cmd %d\n"
284 " supported 0x%x advertising 0x%x speed %u\n" 284 " supported 0x%x advertising 0x%x speed %u\n"
285 " duplex %d port %d phy_address %d transceiver %d\n" 285 " duplex %d port %d phy_address %d transceiver %d\n"
286 " autoneg %d maxtxpkt %d maxrxpkt %d\n", 286 " autoneg %d maxtxpkt %d maxrxpkt %d\n",
@@ -301,7 +301,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
301 if (IS_MF_SD(bp)) 301 if (IS_MF_SD(bp))
302 return 0; 302 return 0;
303 303
304 DP(NETIF_MSG_LINK, "ethtool_cmd: cmd %d\n" 304 DP(BNX2X_MSG_ETHTOOL, "ethtool_cmd: cmd %d\n"
305 " supported 0x%x advertising 0x%x speed %u\n" 305 " supported 0x%x advertising 0x%x speed %u\n"
306 " duplex %d port %d phy_address %d transceiver %d\n" 306 " duplex %d port %d phy_address %d transceiver %d\n"
307 " autoneg %d maxtxpkt %d maxrxpkt %d\n", 307 " autoneg %d maxtxpkt %d maxrxpkt %d\n",
@@ -325,18 +325,17 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
325 line_speed = 10000; 325 line_speed = 10000;
326 326
327 if (bp->common.bc_ver < REQ_BC_VER_4_SET_MF_BW) { 327 if (bp->common.bc_ver < REQ_BC_VER_4_SET_MF_BW) {
328 BNX2X_DEV_INFO("To set speed BC %X or higher " 328 DP(BNX2X_MSG_ETHTOOL,
329 "is required, please upgrade BC\n", 329 "To set speed BC %X or higher is required, please upgrade BC\n",
330 REQ_BC_VER_4_SET_MF_BW); 330 REQ_BC_VER_4_SET_MF_BW);
331 return -EINVAL; 331 return -EINVAL;
332 } 332 }
333 333
334 part = (speed * 100) / line_speed; 334 part = (speed * 100) / line_speed;
335 335
336 if (line_speed < speed || !part) { 336 if (line_speed < speed || !part) {
337 BNX2X_DEV_INFO("Speed setting should be in a range " 337 DP(BNX2X_MSG_ETHTOOL,
338 "from 1%% to 100%% " 338 "Speed setting should be in a range from 1%% to 100%% of actual line speed\n");
339 "of actual line speed\n");
340 return -EINVAL; 339 return -EINVAL;
341 } 340 }
342 341
@@ -358,7 +357,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
358 357
359 if (!(bp->port.supported[0] & SUPPORTED_TP || 358 if (!(bp->port.supported[0] & SUPPORTED_TP ||
360 bp->port.supported[1] & SUPPORTED_TP)) { 359 bp->port.supported[1] & SUPPORTED_TP)) {
361 DP(NETIF_MSG_LINK, "Unsupported port type\n"); 360 DP(BNX2X_MSG_ETHTOOL, "Unsupported port type\n");
362 return -EINVAL; 361 return -EINVAL;
363 } 362 }
364 bp->link_params.multi_phy_config &= 363 bp->link_params.multi_phy_config &=
@@ -378,7 +377,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
378 377
379 if (!(bp->port.supported[0] & SUPPORTED_FIBRE || 378 if (!(bp->port.supported[0] & SUPPORTED_FIBRE ||
380 bp->port.supported[1] & SUPPORTED_FIBRE)) { 379 bp->port.supported[1] & SUPPORTED_FIBRE)) {
381 DP(NETIF_MSG_LINK, "Unsupported port type\n"); 380 DP(BNX2X_MSG_ETHTOOL, "Unsupported port type\n");
382 return -EINVAL; 381 return -EINVAL;
383 } 382 }
384 bp->link_params.multi_phy_config &= 383 bp->link_params.multi_phy_config &=
@@ -392,7 +391,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
392 PORT_HW_CFG_PHY_SELECTION_SECOND_PHY; 391 PORT_HW_CFG_PHY_SELECTION_SECOND_PHY;
393 break; 392 break;
394 default: 393 default:
395 DP(NETIF_MSG_LINK, "Unsupported port type\n"); 394 DP(BNX2X_MSG_ETHTOOL, "Unsupported port type\n");
396 return -EINVAL; 395 return -EINVAL;
397 } 396 }
398 /* Save new config in case command complete successully */ 397 /* Save new config in case command complete successully */
@@ -401,7 +400,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
401 cfg_idx = bnx2x_get_link_cfg_idx(bp); 400 cfg_idx = bnx2x_get_link_cfg_idx(bp);
402 /* Restore old config in case command failed */ 401 /* Restore old config in case command failed */
403 bp->link_params.multi_phy_config = old_multi_phy_config; 402 bp->link_params.multi_phy_config = old_multi_phy_config;
404 DP(NETIF_MSG_LINK, "cfg_idx = %x\n", cfg_idx); 403 DP(BNX2X_MSG_ETHTOOL, "cfg_idx = %x\n", cfg_idx);
405 404
406 if (cmd->autoneg == AUTONEG_ENABLE) { 405 if (cmd->autoneg == AUTONEG_ENABLE) {
407 u32 an_supported_speed = bp->port.supported[cfg_idx]; 406 u32 an_supported_speed = bp->port.supported[cfg_idx];
@@ -410,14 +409,14 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
410 an_supported_speed |= (SUPPORTED_100baseT_Half | 409 an_supported_speed |= (SUPPORTED_100baseT_Half |
411 SUPPORTED_100baseT_Full); 410 SUPPORTED_100baseT_Full);
412 if (!(bp->port.supported[cfg_idx] & SUPPORTED_Autoneg)) { 411 if (!(bp->port.supported[cfg_idx] & SUPPORTED_Autoneg)) {
413 DP(NETIF_MSG_LINK, "Autoneg not supported\n"); 412 DP(BNX2X_MSG_ETHTOOL, "Autoneg not supported\n");
414 return -EINVAL; 413 return -EINVAL;
415 } 414 }
416 415
417 /* advertise the requested speed and duplex if supported */ 416 /* advertise the requested speed and duplex if supported */
418 if (cmd->advertising & ~an_supported_speed) { 417 if (cmd->advertising & ~an_supported_speed) {
419 DP(NETIF_MSG_LINK, "Advertisement parameters " 418 DP(BNX2X_MSG_ETHTOOL,
420 "are not supported\n"); 419 "Advertisement parameters are not supported\n");
421 return -EINVAL; 420 return -EINVAL;
422 } 421 }
423 422
@@ -466,7 +465,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
466 if (cmd->duplex == DUPLEX_FULL) { 465 if (cmd->duplex == DUPLEX_FULL) {
467 if (!(bp->port.supported[cfg_idx] & 466 if (!(bp->port.supported[cfg_idx] &
468 SUPPORTED_10baseT_Full)) { 467 SUPPORTED_10baseT_Full)) {
469 DP(NETIF_MSG_LINK, 468 DP(BNX2X_MSG_ETHTOOL,
470 "10M full not supported\n"); 469 "10M full not supported\n");
471 return -EINVAL; 470 return -EINVAL;
472 } 471 }
@@ -476,7 +475,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
476 } else { 475 } else {
477 if (!(bp->port.supported[cfg_idx] & 476 if (!(bp->port.supported[cfg_idx] &
478 SUPPORTED_10baseT_Half)) { 477 SUPPORTED_10baseT_Half)) {
479 DP(NETIF_MSG_LINK, 478 DP(BNX2X_MSG_ETHTOOL,
480 "10M half not supported\n"); 479 "10M half not supported\n");
481 return -EINVAL; 480 return -EINVAL;
482 } 481 }
@@ -490,7 +489,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
490 if (cmd->duplex == DUPLEX_FULL) { 489 if (cmd->duplex == DUPLEX_FULL) {
491 if (!(bp->port.supported[cfg_idx] & 490 if (!(bp->port.supported[cfg_idx] &
492 SUPPORTED_100baseT_Full)) { 491 SUPPORTED_100baseT_Full)) {
493 DP(NETIF_MSG_LINK, 492 DP(BNX2X_MSG_ETHTOOL,
494 "100M full not supported\n"); 493 "100M full not supported\n");
495 return -EINVAL; 494 return -EINVAL;
496 } 495 }
@@ -500,7 +499,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
500 } else { 499 } else {
501 if (!(bp->port.supported[cfg_idx] & 500 if (!(bp->port.supported[cfg_idx] &
502 SUPPORTED_100baseT_Half)) { 501 SUPPORTED_100baseT_Half)) {
503 DP(NETIF_MSG_LINK, 502 DP(BNX2X_MSG_ETHTOOL,
504 "100M half not supported\n"); 503 "100M half not supported\n");
505 return -EINVAL; 504 return -EINVAL;
506 } 505 }
@@ -512,13 +511,15 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
512 511
513 case SPEED_1000: 512 case SPEED_1000:
514 if (cmd->duplex != DUPLEX_FULL) { 513 if (cmd->duplex != DUPLEX_FULL) {
515 DP(NETIF_MSG_LINK, "1G half not supported\n"); 514 DP(BNX2X_MSG_ETHTOOL,
515 "1G half not supported\n");
516 return -EINVAL; 516 return -EINVAL;
517 } 517 }
518 518
519 if (!(bp->port.supported[cfg_idx] & 519 if (!(bp->port.supported[cfg_idx] &
520 SUPPORTED_1000baseT_Full)) { 520 SUPPORTED_1000baseT_Full)) {
521 DP(NETIF_MSG_LINK, "1G full not supported\n"); 521 DP(BNX2X_MSG_ETHTOOL,
522 "1G full not supported\n");
522 return -EINVAL; 523 return -EINVAL;
523 } 524 }
524 525
@@ -528,14 +529,14 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
528 529
529 case SPEED_2500: 530 case SPEED_2500:
530 if (cmd->duplex != DUPLEX_FULL) { 531 if (cmd->duplex != DUPLEX_FULL) {
531 DP(NETIF_MSG_LINK, 532 DP(BNX2X_MSG_ETHTOOL,
532 "2.5G half not supported\n"); 533 "2.5G half not supported\n");
533 return -EINVAL; 534 return -EINVAL;
534 } 535 }
535 536
536 if (!(bp->port.supported[cfg_idx] 537 if (!(bp->port.supported[cfg_idx]
537 & SUPPORTED_2500baseX_Full)) { 538 & SUPPORTED_2500baseX_Full)) {
538 DP(NETIF_MSG_LINK, 539 DP(BNX2X_MSG_ETHTOOL,
539 "2.5G full not supported\n"); 540 "2.5G full not supported\n");
540 return -EINVAL; 541 return -EINVAL;
541 } 542 }
@@ -546,13 +547,15 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
546 547
547 case SPEED_10000: 548 case SPEED_10000:
548 if (cmd->duplex != DUPLEX_FULL) { 549 if (cmd->duplex != DUPLEX_FULL) {
549 DP(NETIF_MSG_LINK, "10G half not supported\n"); 550 DP(BNX2X_MSG_ETHTOOL,
551 "10G half not supported\n");
550 return -EINVAL; 552 return -EINVAL;
551 } 553 }
552 554
553 if (!(bp->port.supported[cfg_idx] 555 if (!(bp->port.supported[cfg_idx]
554 & SUPPORTED_10000baseT_Full)) { 556 & SUPPORTED_10000baseT_Full)) {
555 DP(NETIF_MSG_LINK, "10G full not supported\n"); 557 DP(BNX2X_MSG_ETHTOOL,
558 "10G full not supported\n");
556 return -EINVAL; 559 return -EINVAL;
557 } 560 }
558 561
@@ -561,7 +564,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
561 break; 564 break;
562 565
563 default: 566 default:
564 DP(NETIF_MSG_LINK, "Unsupported speed %u\n", speed); 567 DP(BNX2X_MSG_ETHTOOL, "Unsupported speed %u\n", speed);
565 return -EINVAL; 568 return -EINVAL;
566 } 569 }
567 570
@@ -570,7 +573,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
570 bp->port.advertising[cfg_idx] = advertising; 573 bp->port.advertising[cfg_idx] = advertising;
571 } 574 }
572 575
573 DP(NETIF_MSG_LINK, "req_line_speed %d\n" 576 DP(BNX2X_MSG_ETHTOOL, "req_line_speed %d\n"
574 " req_duplex %d advertising 0x%x\n", 577 " req_duplex %d advertising 0x%x\n",
575 bp->link_params.req_line_speed[cfg_idx], 578 bp->link_params.req_line_speed[cfg_idx],
576 bp->link_params.req_duplex[cfg_idx], 579 bp->link_params.req_duplex[cfg_idx],
@@ -850,13 +853,16 @@ static int bnx2x_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
850{ 853{
851 struct bnx2x *bp = netdev_priv(dev); 854 struct bnx2x *bp = netdev_priv(dev);
852 855
853 if (wol->wolopts & ~WAKE_MAGIC) 856 if (wol->wolopts & ~WAKE_MAGIC) {
857 DP(BNX2X_MSG_ETHTOOL, "WOL not supproted\n");
854 return -EINVAL; 858 return -EINVAL;
859 }
855 860
856 if (wol->wolopts & WAKE_MAGIC) { 861 if (wol->wolopts & WAKE_MAGIC) {
857 if (bp->flags & NO_WOL_FLAG) 862 if (bp->flags & NO_WOL_FLAG) {
863 DP(BNX2X_MSG_ETHTOOL, "WOL not supproted\n");
858 return -EINVAL; 864 return -EINVAL;
859 865 }
860 bp->wol = 1; 866 bp->wol = 1;
861 } else 867 } else
862 bp->wol = 0; 868 bp->wol = 0;
@@ -955,7 +961,8 @@ static int bnx2x_acquire_nvram_lock(struct bnx2x *bp)
955 } 961 }
956 962
957 if (!(val & (MCPR_NVM_SW_ARB_ARB_ARB1 << port))) { 963 if (!(val & (MCPR_NVM_SW_ARB_ARB_ARB1 << port))) {
958 DP(BNX2X_MSG_NVM, "cannot get access to nvram interface\n"); 964 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
965 "cannot get access to nvram interface\n");
959 return -EBUSY; 966 return -EBUSY;
960 } 967 }
961 968
@@ -986,7 +993,8 @@ static int bnx2x_release_nvram_lock(struct bnx2x *bp)
986 } 993 }
987 994
988 if (val & (MCPR_NVM_SW_ARB_ARB_ARB1 << port)) { 995 if (val & (MCPR_NVM_SW_ARB_ARB_ARB1 << port)) {
989 DP(BNX2X_MSG_NVM, "cannot free access to nvram interface\n"); 996 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
997 "cannot free access to nvram interface\n");
990 return -EBUSY; 998 return -EBUSY;
991 } 999 }
992 1000
@@ -1060,7 +1068,9 @@ static int bnx2x_nvram_read_dword(struct bnx2x *bp, u32 offset, __be32 *ret_val,
1060 break; 1068 break;
1061 } 1069 }
1062 } 1070 }
1063 1071 if (rc == -EBUSY)
1072 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1073 "nvram read timeout expired\n");
1064 return rc; 1074 return rc;
1065} 1075}
1066 1076
@@ -1072,15 +1082,15 @@ static int bnx2x_nvram_read(struct bnx2x *bp, u32 offset, u8 *ret_buf,
1072 __be32 val; 1082 __be32 val;
1073 1083
1074 if ((offset & 0x03) || (buf_size & 0x03) || (buf_size == 0)) { 1084 if ((offset & 0x03) || (buf_size & 0x03) || (buf_size == 0)) {
1075 DP(BNX2X_MSG_NVM, 1085 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1076 "Invalid parameter: offset 0x%x buf_size 0x%x\n", 1086 "Invalid parameter: offset 0x%x buf_size 0x%x\n",
1077 offset, buf_size); 1087 offset, buf_size);
1078 return -EINVAL; 1088 return -EINVAL;
1079 } 1089 }
1080 1090
1081 if (offset + buf_size > bp->common.flash_size) { 1091 if (offset + buf_size > bp->common.flash_size) {
1082 DP(BNX2X_MSG_NVM, "Invalid parameter: offset (0x%x) +" 1092 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1083 " buf_size (0x%x) > flash_size (0x%x)\n", 1093 "Invalid parameter: offset (0x%x) + buf_size (0x%x) > flash_size (0x%x)\n",
1084 offset, buf_size, bp->common.flash_size); 1094 offset, buf_size, bp->common.flash_size);
1085 return -EINVAL; 1095 return -EINVAL;
1086 } 1096 }
@@ -1125,10 +1135,13 @@ static int bnx2x_get_eeprom(struct net_device *dev,
1125 struct bnx2x *bp = netdev_priv(dev); 1135 struct bnx2x *bp = netdev_priv(dev);
1126 int rc; 1136 int rc;
1127 1137
1128 if (!netif_running(dev)) 1138 if (!netif_running(dev)) {
1139 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1140 "cannot access eeprom when the interface is down\n");
1129 return -EAGAIN; 1141 return -EAGAIN;
1142 }
1130 1143
1131 DP(BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n" 1144 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n"
1132 " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n", 1145 " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n",
1133 eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset, 1146 eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset,
1134 eeprom->len, eeprom->len); 1147 eeprom->len, eeprom->len);
@@ -1177,6 +1190,9 @@ static int bnx2x_nvram_write_dword(struct bnx2x *bp, u32 offset, u32 val,
1177 } 1190 }
1178 } 1191 }
1179 1192
1193 if (rc == -EBUSY)
1194 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1195 "nvram write timeout expired\n");
1180 return rc; 1196 return rc;
1181} 1197}
1182 1198
@@ -1191,8 +1207,8 @@ static int bnx2x_nvram_write1(struct bnx2x *bp, u32 offset, u8 *data_buf,
1191 __be32 val; 1207 __be32 val;
1192 1208
1193 if (offset + buf_size > bp->common.flash_size) { 1209 if (offset + buf_size > bp->common.flash_size) {
1194 DP(BNX2X_MSG_NVM, "Invalid parameter: offset (0x%x) +" 1210 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1195 " buf_size (0x%x) > flash_size (0x%x)\n", 1211 "Invalid parameter: offset (0x%x) + buf_size (0x%x) > flash_size (0x%x)\n",
1196 offset, buf_size, bp->common.flash_size); 1212 offset, buf_size, bp->common.flash_size);
1197 return -EINVAL; 1213 return -EINVAL;
1198 } 1214 }
@@ -1240,15 +1256,15 @@ static int bnx2x_nvram_write(struct bnx2x *bp, u32 offset, u8 *data_buf,
1240 return bnx2x_nvram_write1(bp, offset, data_buf, buf_size); 1256 return bnx2x_nvram_write1(bp, offset, data_buf, buf_size);
1241 1257
1242 if ((offset & 0x03) || (buf_size & 0x03) || (buf_size == 0)) { 1258 if ((offset & 0x03) || (buf_size & 0x03) || (buf_size == 0)) {
1243 DP(BNX2X_MSG_NVM, 1259 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1244 "Invalid parameter: offset 0x%x buf_size 0x%x\n", 1260 "Invalid parameter: offset 0x%x buf_size 0x%x\n",
1245 offset, buf_size); 1261 offset, buf_size);
1246 return -EINVAL; 1262 return -EINVAL;
1247 } 1263 }
1248 1264
1249 if (offset + buf_size > bp->common.flash_size) { 1265 if (offset + buf_size > bp->common.flash_size) {
1250 DP(BNX2X_MSG_NVM, "Invalid parameter: offset (0x%x) +" 1266 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1251 " buf_size (0x%x) > flash_size (0x%x)\n", 1267 "Invalid parameter: offset (0x%x) + buf_size (0x%x) > flash_size (0x%x)\n",
1252 offset, buf_size, bp->common.flash_size); 1268 offset, buf_size, bp->common.flash_size);
1253 return -EINVAL; 1269 return -EINVAL;
1254 } 1270 }
@@ -1296,10 +1312,13 @@ static int bnx2x_set_eeprom(struct net_device *dev,
1296 int port = BP_PORT(bp); 1312 int port = BP_PORT(bp);
1297 int rc = 0; 1313 int rc = 0;
1298 u32 ext_phy_config; 1314 u32 ext_phy_config;
1299 if (!netif_running(dev)) 1315 if (!netif_running(dev)) {
1316 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1317 "cannot access eeprom when the interface is down\n");
1300 return -EAGAIN; 1318 return -EAGAIN;
1319 }
1301 1320
1302 DP(BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n" 1321 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n"
1303 " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n", 1322 " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n",
1304 eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset, 1323 eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset,
1305 eeprom->len, eeprom->len); 1324 eeprom->len, eeprom->len);
@@ -1308,8 +1327,11 @@ static int bnx2x_set_eeprom(struct net_device *dev,
1308 1327
1309 /* PHY eeprom can be accessed only by the PMF */ 1328 /* PHY eeprom can be accessed only by the PMF */
1310 if ((eeprom->magic >= 0x50485900) && (eeprom->magic <= 0x504859FF) && 1329 if ((eeprom->magic >= 0x50485900) && (eeprom->magic <= 0x504859FF) &&
1311 !bp->port.pmf) 1330 !bp->port.pmf) {
1331 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1332 "wrong magic or interface is not pmf\n");
1312 return -EINVAL; 1333 return -EINVAL;
1334 }
1313 1335
1314 ext_phy_config = 1336 ext_phy_config =
1315 SHMEM_RD(bp, 1337 SHMEM_RD(bp,
@@ -1421,8 +1443,8 @@ static int bnx2x_set_ringparam(struct net_device *dev,
1421 struct bnx2x *bp = netdev_priv(dev); 1443 struct bnx2x *bp = netdev_priv(dev);
1422 1444
1423 if (bp->recovery_state != BNX2X_RECOVERY_DONE) { 1445 if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
1424 netdev_err(dev, "Handling parity error recovery. " 1446 DP(BNX2X_MSG_ETHTOOL,
1425 "Try again later\n"); 1447 "Handling parity error recovery. Try again later\n");
1426 return -EAGAIN; 1448 return -EAGAIN;
1427 } 1449 }
1428 1450
@@ -1430,8 +1452,10 @@ static int bnx2x_set_ringparam(struct net_device *dev,
1430 (ering->rx_pending < (bp->disable_tpa ? MIN_RX_SIZE_NONTPA : 1452 (ering->rx_pending < (bp->disable_tpa ? MIN_RX_SIZE_NONTPA :
1431 MIN_RX_SIZE_TPA)) || 1453 MIN_RX_SIZE_TPA)) ||
1432 (ering->tx_pending > MAX_TX_AVAIL) || 1454 (ering->tx_pending > MAX_TX_AVAIL) ||
1433 (ering->tx_pending <= MAX_SKB_FRAGS + 4)) 1455 (ering->tx_pending <= MAX_SKB_FRAGS + 4)) {
1456 DP(BNX2X_MSG_ETHTOOL, "Command parameters not supported\n");
1434 return -EINVAL; 1457 return -EINVAL;
1458 }
1435 1459
1436 bp->rx_ring_size = ering->rx_pending; 1460 bp->rx_ring_size = ering->rx_pending;
1437 bp->tx_ring_size = ering->tx_pending; 1461 bp->tx_ring_size = ering->tx_pending;
@@ -1459,7 +1483,7 @@ static void bnx2x_get_pauseparam(struct net_device *dev,
1459 epause->tx_pause = ((cfg_reg & BNX2X_FLOW_CTRL_TX) == 1483 epause->tx_pause = ((cfg_reg & BNX2X_FLOW_CTRL_TX) ==
1460 BNX2X_FLOW_CTRL_TX); 1484 BNX2X_FLOW_CTRL_TX);
1461 1485
1462 DP(NETIF_MSG_LINK, "ethtool_pauseparam: cmd %d\n" 1486 DP(BNX2X_MSG_ETHTOOL, "ethtool_pauseparam: cmd %d\n"
1463 " autoneg %d rx_pause %d tx_pause %d\n", 1487 " autoneg %d rx_pause %d tx_pause %d\n",
1464 epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause); 1488 epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause);
1465} 1489}
@@ -1472,7 +1496,7 @@ static int bnx2x_set_pauseparam(struct net_device *dev,
1472 if (IS_MF(bp)) 1496 if (IS_MF(bp))
1473 return 0; 1497 return 0;
1474 1498
1475 DP(NETIF_MSG_LINK, "ethtool_pauseparam: cmd %d\n" 1499 DP(BNX2X_MSG_ETHTOOL, "ethtool_pauseparam: cmd %d\n"
1476 " autoneg %d rx_pause %d tx_pause %d\n", 1500 " autoneg %d rx_pause %d tx_pause %d\n",
1477 epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause); 1501 epause->cmd, epause->autoneg, epause->rx_pause, epause->tx_pause);
1478 1502
@@ -1489,7 +1513,7 @@ static int bnx2x_set_pauseparam(struct net_device *dev,
1489 1513
1490 if (epause->autoneg) { 1514 if (epause->autoneg) {
1491 if (!(bp->port.supported[cfg_idx] & SUPPORTED_Autoneg)) { 1515 if (!(bp->port.supported[cfg_idx] & SUPPORTED_Autoneg)) {
1492 DP(NETIF_MSG_LINK, "autoneg not supported\n"); 1516 DP(BNX2X_MSG_ETHTOOL, "autoneg not supported\n");
1493 return -EINVAL; 1517 return -EINVAL;
1494 } 1518 }
1495 1519
@@ -1499,7 +1523,7 @@ static int bnx2x_set_pauseparam(struct net_device *dev,
1499 } 1523 }
1500 } 1524 }
1501 1525
1502 DP(NETIF_MSG_LINK, 1526 DP(BNX2X_MSG_ETHTOOL,
1503 "req_flow_ctrl 0x%x\n", bp->link_params.req_flow_ctrl[cfg_idx]); 1527 "req_flow_ctrl 0x%x\n", bp->link_params.req_flow_ctrl[cfg_idx]);
1504 1528
1505 if (netif_running(dev)) { 1529 if (netif_running(dev)) {
@@ -1631,8 +1655,11 @@ static int bnx2x_test_registers(struct bnx2x *bp)
1631 { BNX2X_CHIP_MASK_ALL, 0xffffffff, 0, 0x00000000 } 1655 { BNX2X_CHIP_MASK_ALL, 0xffffffff, 0, 0x00000000 }
1632 }; 1656 };
1633 1657
1634 if (!netif_running(bp->dev)) 1658 if (!netif_running(bp->dev)) {
1659 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1660 "cannot access eeprom when the interface is down\n");
1635 return rc; 1661 return rc;
1662 }
1636 1663
1637 if (CHIP_IS_E1(bp)) 1664 if (CHIP_IS_E1(bp))
1638 hw = BNX2X_CHIP_MASK_E1; 1665 hw = BNX2X_CHIP_MASK_E1;
@@ -1677,7 +1704,7 @@ static int bnx2x_test_registers(struct bnx2x *bp)
1677 1704
1678 /* verify value is as expected */ 1705 /* verify value is as expected */
1679 if ((val & mask) != (wr_val & mask)) { 1706 if ((val & mask) != (wr_val & mask)) {
1680 DP(NETIF_MSG_HW, 1707 DP(BNX2X_MSG_ETHTOOL,
1681 "offset 0x%x: val 0x%x != 0x%x mask 0x%x\n", 1708 "offset 0x%x: val 0x%x != 0x%x mask 0x%x\n",
1682 offset, val, wr_val, mask); 1709 offset, val, wr_val, mask);
1683 goto test_reg_exit; 1710 goto test_reg_exit;
@@ -1731,8 +1758,11 @@ static int bnx2x_test_memory(struct bnx2x *bp)
1731 { NULL, 0xffffffff, {0, 0, 0, 0} } 1758 { NULL, 0xffffffff, {0, 0, 0, 0} }
1732 }; 1759 };
1733 1760
1734 if (!netif_running(bp->dev)) 1761 if (!netif_running(bp->dev)) {
1762 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1763 "cannot access eeprom when the interface is down\n");
1735 return rc; 1764 return rc;
1765 }
1736 1766
1737 if (CHIP_IS_E1(bp)) 1767 if (CHIP_IS_E1(bp))
1738 index = BNX2X_CHIP_E1_OFST; 1768 index = BNX2X_CHIP_E1_OFST;
@@ -1747,7 +1777,7 @@ static int bnx2x_test_memory(struct bnx2x *bp)
1747 for (i = 0; prty_tbl[i].offset != 0xffffffff; i++) { 1777 for (i = 0; prty_tbl[i].offset != 0xffffffff; i++) {
1748 val = REG_RD(bp, prty_tbl[i].offset); 1778 val = REG_RD(bp, prty_tbl[i].offset);
1749 if (val & ~(prty_tbl[i].hw_mask[index])) { 1779 if (val & ~(prty_tbl[i].hw_mask[index])) {
1750 DP(NETIF_MSG_HW, 1780 DP(BNX2X_MSG_ETHTOOL,
1751 "%s is 0x%x\n", prty_tbl[i].name, val); 1781 "%s is 0x%x\n", prty_tbl[i].name, val);
1752 goto test_mem_exit; 1782 goto test_mem_exit;
1753 } 1783 }
@@ -1762,7 +1792,7 @@ static int bnx2x_test_memory(struct bnx2x *bp)
1762 for (i = 0; prty_tbl[i].offset != 0xffffffff; i++) { 1792 for (i = 0; prty_tbl[i].offset != 0xffffffff; i++) {
1763 val = REG_RD(bp, prty_tbl[i].offset); 1793 val = REG_RD(bp, prty_tbl[i].offset);
1764 if (val & ~(prty_tbl[i].hw_mask[index])) { 1794 if (val & ~(prty_tbl[i].hw_mask[index])) {
1765 DP(NETIF_MSG_HW, 1795 DP(BNX2X_MSG_ETHTOOL,
1766 "%s is 0x%x\n", prty_tbl[i].name, val); 1796 "%s is 0x%x\n", prty_tbl[i].name, val);
1767 goto test_mem_exit; 1797 goto test_mem_exit;
1768 } 1798 }
@@ -1783,7 +1813,7 @@ static void bnx2x_wait_for_link(struct bnx2x *bp, u8 link_up, u8 is_serdes)
1783 msleep(20); 1813 msleep(20);
1784 1814
1785 if (cnt <= 0 && bnx2x_link_test(bp, is_serdes)) 1815 if (cnt <= 0 && bnx2x_link_test(bp, is_serdes))
1786 DP(NETIF_MSG_LINK, "Timeout waiting for link up\n"); 1816 DP(BNX2X_MSG_ETHTOOL, "Timeout waiting for link up\n");
1787 } 1817 }
1788} 1818}
1789 1819
@@ -1833,6 +1863,7 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode)
1833 bnx2x_phy_init(&bp->link_params, &bp->link_vars); 1863 bnx2x_phy_init(&bp->link_params, &bp->link_vars);
1834 break; 1864 break;
1835 default: 1865 default:
1866 DP(BNX2X_MSG_ETHTOOL, "Command parameters not supported\n");
1836 return -EINVAL; 1867 return -EINVAL;
1837 } 1868 }
1838 1869
@@ -1841,6 +1872,7 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode)
1841 bp->dev->mtu : ETH_MAX_PACKET_SIZE) + ETH_HLEN); 1872 bp->dev->mtu : ETH_MAX_PACKET_SIZE) + ETH_HLEN);
1842 skb = netdev_alloc_skb(bp->dev, fp_rx->rx_buf_size); 1873 skb = netdev_alloc_skb(bp->dev, fp_rx->rx_buf_size);
1843 if (!skb) { 1874 if (!skb) {
1875 DP(BNX2X_MSG_ETHTOOL, "Can't allocate skb\n");
1844 rc = -ENOMEM; 1876 rc = -ENOMEM;
1845 goto test_loopback_exit; 1877 goto test_loopback_exit;
1846 } 1878 }
@@ -1855,7 +1887,7 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode)
1855 if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { 1887 if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) {
1856 rc = -ENOMEM; 1888 rc = -ENOMEM;
1857 dev_kfree_skb(skb); 1889 dev_kfree_skb(skb);
1858 BNX2X_ERR("Unable to map SKB\n"); 1890 DP(BNX2X_MSG_ETHTOOL, "Unable to map SKB\n");
1859 goto test_loopback_exit; 1891 goto test_loopback_exit;
1860 } 1892 }
1861 1893
@@ -1985,13 +2017,13 @@ static int bnx2x_test_loopback(struct bnx2x *bp)
1985 2017
1986 res = bnx2x_run_loopback(bp, BNX2X_PHY_LOOPBACK); 2018 res = bnx2x_run_loopback(bp, BNX2X_PHY_LOOPBACK);
1987 if (res) { 2019 if (res) {
1988 DP(NETIF_MSG_PROBE, " PHY loopback failed (res %d)\n", res); 2020 DP(BNX2X_MSG_ETHTOOL, " PHY loopback failed (res %d)\n", res);
1989 rc |= BNX2X_PHY_LOOPBACK_FAILED; 2021 rc |= BNX2X_PHY_LOOPBACK_FAILED;
1990 } 2022 }
1991 2023
1992 res = bnx2x_run_loopback(bp, BNX2X_MAC_LOOPBACK); 2024 res = bnx2x_run_loopback(bp, BNX2X_MAC_LOOPBACK);
1993 if (res) { 2025 if (res) {
1994 DP(NETIF_MSG_PROBE, " MAC loopback failed (res %d)\n", res); 2026 DP(BNX2X_MSG_ETHTOOL, " MAC loopback failed (res %d)\n", res);
1995 rc |= BNX2X_MAC_LOOPBACK_FAILED; 2027 rc |= BNX2X_MAC_LOOPBACK_FAILED;
1996 } 2028 }
1997 2029
@@ -2027,7 +2059,7 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
2027 2059
2028 buf = kmalloc(0x350, GFP_KERNEL); 2060 buf = kmalloc(0x350, GFP_KERNEL);
2029 if (!buf) { 2061 if (!buf) {
2030 DP(NETIF_MSG_PROBE, "kmalloc failed\n"); 2062 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM, "kmalloc failed\n");
2031 rc = -ENOMEM; 2063 rc = -ENOMEM;
2032 goto test_nvram_exit; 2064 goto test_nvram_exit;
2033 } 2065 }
@@ -2035,13 +2067,15 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
2035 2067
2036 rc = bnx2x_nvram_read(bp, 0, data, 4); 2068 rc = bnx2x_nvram_read(bp, 0, data, 4);
2037 if (rc) { 2069 if (rc) {
2038 DP(NETIF_MSG_PROBE, "magic value read (rc %d)\n", rc); 2070 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
2071 "magic value read (rc %d)\n", rc);
2039 goto test_nvram_exit; 2072 goto test_nvram_exit;
2040 } 2073 }
2041 2074
2042 magic = be32_to_cpu(buf[0]); 2075 magic = be32_to_cpu(buf[0]);
2043 if (magic != 0x669955aa) { 2076 if (magic != 0x669955aa) {
2044 DP(NETIF_MSG_PROBE, "magic value (0x%08x)\n", magic); 2077 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
2078 "wrong magic value (0x%08x)\n", magic);
2045 rc = -ENODEV; 2079 rc = -ENODEV;
2046 goto test_nvram_exit; 2080 goto test_nvram_exit;
2047 } 2081 }
@@ -2051,15 +2085,15 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
2051 rc = bnx2x_nvram_read(bp, nvram_tbl[i].offset, data, 2085 rc = bnx2x_nvram_read(bp, nvram_tbl[i].offset, data,
2052 nvram_tbl[i].size); 2086 nvram_tbl[i].size);
2053 if (rc) { 2087 if (rc) {
2054 DP(NETIF_MSG_PROBE, 2088 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
2055 "nvram_tbl[%d] read data (rc %d)\n", i, rc); 2089 "nvram_tbl[%d] read data (rc %d)\n", i, rc);
2056 goto test_nvram_exit; 2090 goto test_nvram_exit;
2057 } 2091 }
2058 2092
2059 crc = ether_crc_le(nvram_tbl[i].size, data); 2093 crc = ether_crc_le(nvram_tbl[i].size, data);
2060 if (crc != CRC32_RESIDUAL) { 2094 if (crc != CRC32_RESIDUAL) {
2061 DP(NETIF_MSG_PROBE, 2095 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
2062 "nvram_tbl[%d] crc value (0x%08x)\n", i, crc); 2096 "nvram_tbl[%d] wrong crc value (0x%08x)\n", i, crc);
2063 rc = -ENODEV; 2097 rc = -ENODEV;
2064 goto test_nvram_exit; 2098 goto test_nvram_exit;
2065 } 2099 }
@@ -2075,8 +2109,11 @@ static int bnx2x_test_intr(struct bnx2x *bp)
2075{ 2109{
2076 struct bnx2x_queue_state_params params = {0}; 2110 struct bnx2x_queue_state_params params = {0};
2077 2111
2078 if (!netif_running(bp->dev)) 2112 if (!netif_running(bp->dev)) {
2113 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
2114 "cannot access eeprom when the interface is down\n");
2079 return -ENODEV; 2115 return -ENODEV;
2116 }
2080 2117
2081 params.q_obj = &bp->fp->q_obj; 2118 params.q_obj = &bp->fp->q_obj;
2082 params.cmd = BNX2X_Q_CMD_EMPTY; 2119 params.cmd = BNX2X_Q_CMD_EMPTY;
@@ -2092,8 +2129,8 @@ static void bnx2x_self_test(struct net_device *dev,
2092 struct bnx2x *bp = netdev_priv(dev); 2129 struct bnx2x *bp = netdev_priv(dev);
2093 u8 is_serdes; 2130 u8 is_serdes;
2094 if (bp->recovery_state != BNX2X_RECOVERY_DONE) { 2131 if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
2095 netdev_err(bp->dev, "Handling parity error recovery. " 2132 netdev_err(bp->dev,
2096 "Try again later\n"); 2133 "Handling parity error recovery. Try again later\n");
2097 etest->flags |= ETH_TEST_FL_FAILED; 2134 etest->flags |= ETH_TEST_FL_FAILED;
2098 return; 2135 return;
2099 } 2136 }
@@ -2306,11 +2343,16 @@ static int bnx2x_set_phys_id(struct net_device *dev,
2306{ 2343{
2307 struct bnx2x *bp = netdev_priv(dev); 2344 struct bnx2x *bp = netdev_priv(dev);
2308 2345
2309 if (!netif_running(dev)) 2346 if (!netif_running(dev)) {
2347 DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
2348 "cannot access eeprom when the interface is down\n");
2310 return -EAGAIN; 2349 return -EAGAIN;
2350 }
2311 2351
2312 if (!bp->port.pmf) 2352 if (!bp->port.pmf) {
2353 DP(BNX2X_MSG_ETHTOOL, "Interface is not pmf\n");
2313 return -EOPNOTSUPP; 2354 return -EOPNOTSUPP;
2355 }
2314 2356
2315 switch (state) { 2357 switch (state) {
2316 case ETHTOOL_ID_ACTIVE: 2358 case ETHTOOL_ID_ACTIVE:
@@ -2347,6 +2389,7 @@ static int bnx2x_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
2347 return 0; 2389 return 0;
2348 2390
2349 default: 2391 default:
2392 DP(BNX2X_MSG_ETHTOOL, "Command parameters not supported\n");
2350 return -EOPNOTSUPP; 2393 return -EOPNOTSUPP;
2351 } 2394 }
2352} 2395}