diff options
author | Yaniv Rosner <yanivr@broadcom.com> | 2011-07-04 21:06:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-05 07:21:39 -0400 |
commit | b8d6d0824d064ad447e6aacbce90f3a340d93d65 (patch) | |
tree | 5b535f45cd7b8e4ff8b9f91ef23b5285b2ca4b74 /drivers/net/bnx2x | |
parent | d4d2d288972233fc054f3b3341c2a15865fba7c6 (diff) |
bnx2x: PFC fixes
Set the source MAC address for PFC packets and update its status during PMF migration.
Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_hsi.h | 2 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_link.c | 87 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_reg.h | 12 |
3 files changed, 64 insertions, 37 deletions
diff --git a/drivers/net/bnx2x/bnx2x_hsi.h b/drivers/net/bnx2x/bnx2x_hsi.h index df5355818c30..d6a7aa95d968 100644 --- a/drivers/net/bnx2x/bnx2x_hsi.h +++ b/drivers/net/bnx2x/bnx2x_hsi.h | |||
@@ -1196,6 +1196,8 @@ struct drv_port_mb { | |||
1196 | #define LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE 0x00800000 | 1196 | #define LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE 0x00800000 |
1197 | #define LINK_STATUS_LINK_PARTNER_20GXFD_CAPABLE 0x10000000 | 1197 | #define LINK_STATUS_LINK_PARTNER_20GXFD_CAPABLE 0x10000000 |
1198 | 1198 | ||
1199 | #define LINK_STATUS_PFC_ENABLED 0x20000000 | ||
1200 | |||
1199 | u32 port_stx; | 1201 | u32 port_stx; |
1200 | 1202 | ||
1201 | u32 stat_nig_timer; | 1203 | u32 stat_nig_timer; |
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c index 836363645daf..57ba8110aa5f 100644 --- a/drivers/net/bnx2x/bnx2x_link.c +++ b/drivers/net/bnx2x/bnx2x_link.c | |||
@@ -1344,28 +1344,21 @@ static void bnx2x_update_pfc_xmac(struct link_params *params, | |||
1344 | REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL, pfc0_val); | 1344 | REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL, pfc0_val); |
1345 | REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI, pfc1_val); | 1345 | REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI, pfc1_val); |
1346 | 1346 | ||
1347 | udelay(30); | ||
1348 | } | ||
1349 | 1347 | ||
1348 | /* Set MAC address for source TX Pause/PFC frames */ | ||
1349 | REG_WR(bp, xmac_base + XMAC_REG_CTRL_SA_LO, | ||
1350 | ((params->mac_addr[2] << 24) | | ||
1351 | (params->mac_addr[3] << 16) | | ||
1352 | (params->mac_addr[4] << 8) | | ||
1353 | (params->mac_addr[5]))); | ||
1354 | REG_WR(bp, xmac_base + XMAC_REG_CTRL_SA_HI, | ||
1355 | ((params->mac_addr[0] << 8) | | ||
1356 | (params->mac_addr[1]))); | ||
1350 | 1357 | ||
1351 | static void bnx2x_bmac2_get_pfc_stat(struct link_params *params, | 1358 | udelay(30); |
1352 | u32 pfc_frames_sent[2], | 1359 | } |
1353 | u32 pfc_frames_received[2]) | ||
1354 | { | ||
1355 | /* Read pfc statistic */ | ||
1356 | struct bnx2x *bp = params->bp; | ||
1357 | u32 bmac_addr = params->port ? NIG_REG_INGRESS_BMAC1_MEM : | ||
1358 | NIG_REG_INGRESS_BMAC0_MEM; | ||
1359 | |||
1360 | DP(NETIF_MSG_LINK, "pfc statistic read from BMAC\n"); | ||
1361 | |||
1362 | REG_RD_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_TX_STAT_GTPP, | ||
1363 | pfc_frames_sent, 2); | ||
1364 | 1360 | ||
1365 | REG_RD_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_RX_STAT_GRPP, | ||
1366 | pfc_frames_received, 2); | ||
1367 | 1361 | ||
1368 | } | ||
1369 | static void bnx2x_emac_get_pfc_stat(struct link_params *params, | 1362 | static void bnx2x_emac_get_pfc_stat(struct link_params *params, |
1370 | u32 pfc_frames_sent[2], | 1363 | u32 pfc_frames_sent[2], |
1371 | u32 pfc_frames_received[2]) | 1364 | u32 pfc_frames_received[2]) |
@@ -1397,28 +1390,23 @@ static void bnx2x_emac_get_pfc_stat(struct link_params *params, | |||
1397 | pfc_frames_sent[0] = val_xon + val_xoff; | 1390 | pfc_frames_sent[0] = val_xon + val_xoff; |
1398 | } | 1391 | } |
1399 | 1392 | ||
1393 | /* Read pfc statistic*/ | ||
1400 | void bnx2x_pfc_statistic(struct link_params *params, struct link_vars *vars, | 1394 | void bnx2x_pfc_statistic(struct link_params *params, struct link_vars *vars, |
1401 | u32 pfc_frames_sent[2], | 1395 | u32 pfc_frames_sent[2], |
1402 | u32 pfc_frames_received[2]) | 1396 | u32 pfc_frames_received[2]) |
1403 | { | 1397 | { |
1404 | /* Read pfc statistic */ | 1398 | /* Read pfc statistic */ |
1405 | struct bnx2x *bp = params->bp; | 1399 | struct bnx2x *bp = params->bp; |
1406 | u32 val = 0; | 1400 | |
1407 | DP(NETIF_MSG_LINK, "pfc statistic\n"); | 1401 | DP(NETIF_MSG_LINK, "pfc statistic\n"); |
1408 | 1402 | ||
1409 | if (!vars->link_up) | 1403 | if (!vars->link_up) |
1410 | return; | 1404 | return; |
1411 | 1405 | ||
1412 | val = REG_RD(bp, MISC_REG_RESET_REG_2); | 1406 | if (MAC_TYPE_EMAC == vars->mac_type) { |
1413 | if ((val & (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << params->port)) | 1407 | DP(NETIF_MSG_LINK, "About to read PFC stats from EMAC\n"); |
1414 | == 0) { | ||
1415 | DP(NETIF_MSG_LINK, "About to read stats from EMAC\n"); | ||
1416 | bnx2x_emac_get_pfc_stat(params, pfc_frames_sent, | 1408 | bnx2x_emac_get_pfc_stat(params, pfc_frames_sent, |
1417 | pfc_frames_received); | 1409 | pfc_frames_received); |
1418 | } else { | ||
1419 | DP(NETIF_MSG_LINK, "About to read stats from BMAC\n"); | ||
1420 | bnx2x_bmac2_get_pfc_stat(params, pfc_frames_sent, | ||
1421 | pfc_frames_received); | ||
1422 | } | 1410 | } |
1423 | } | 1411 | } |
1424 | /******************************************************************/ | 1412 | /******************************************************************/ |
@@ -1561,6 +1549,16 @@ static void bnx2x_umac_enable(struct link_params *params, | |||
1561 | REG_WR(bp, umac_base + UMAC_REG_COMMAND_CONFIG, val); | 1549 | REG_WR(bp, umac_base + UMAC_REG_COMMAND_CONFIG, val); |
1562 | udelay(50); | 1550 | udelay(50); |
1563 | 1551 | ||
1552 | /* Set MAC address for source TX Pause/PFC frames (under SW reset) */ | ||
1553 | REG_WR(bp, umac_base + UMAC_REG_MAC_ADDR0, | ||
1554 | ((params->mac_addr[2] << 24) | | ||
1555 | (params->mac_addr[3] << 16) | | ||
1556 | (params->mac_addr[4] << 8) | | ||
1557 | (params->mac_addr[5]))); | ||
1558 | REG_WR(bp, umac_base + UMAC_REG_MAC_ADDR1, | ||
1559 | ((params->mac_addr[0] << 8) | | ||
1560 | (params->mac_addr[1]))); | ||
1561 | |||
1564 | /* Enable RX and TX */ | 1562 | /* Enable RX and TX */ |
1565 | val &= ~UMAC_COMMAND_CONFIG_REG_PAD_EN; | 1563 | val &= ~UMAC_COMMAND_CONFIG_REG_PAD_EN; |
1566 | val |= UMAC_COMMAND_CONFIG_REG_TX_ENA | | 1564 | val |= UMAC_COMMAND_CONFIG_REG_TX_ENA | |
@@ -2358,6 +2356,15 @@ int bnx2x_pfc_nig_rx_priority_mask(struct bnx2x *bp, | |||
2358 | 2356 | ||
2359 | return 0; | 2357 | return 0; |
2360 | } | 2358 | } |
2359 | static void bnx2x_update_mng(struct link_params *params, u32 link_status) | ||
2360 | { | ||
2361 | struct bnx2x *bp = params->bp; | ||
2362 | |||
2363 | REG_WR(bp, params->shmem_base + | ||
2364 | offsetof(struct shmem_region, | ||
2365 | port_mb[params->port].link_status), link_status); | ||
2366 | } | ||
2367 | |||
2361 | static void bnx2x_update_pfc_nig(struct link_params *params, | 2368 | static void bnx2x_update_pfc_nig(struct link_params *params, |
2362 | struct link_vars *vars, | 2369 | struct link_vars *vars, |
2363 | struct bnx2x_nig_brb_pfc_port_params *nig_params) | 2370 | struct bnx2x_nig_brb_pfc_port_params *nig_params) |
@@ -2467,6 +2474,14 @@ int bnx2x_update_pfc(struct link_params *params, | |||
2467 | struct bnx2x *bp = params->bp; | 2474 | struct bnx2x *bp = params->bp; |
2468 | int bnx2x_status = 0; | 2475 | int bnx2x_status = 0; |
2469 | u8 bmac_loopback = (params->loopback_mode == LOOPBACK_BMAC); | 2476 | u8 bmac_loopback = (params->loopback_mode == LOOPBACK_BMAC); |
2477 | |||
2478 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) | ||
2479 | vars->link_status |= LINK_STATUS_PFC_ENABLED; | ||
2480 | else | ||
2481 | vars->link_status &= ~LINK_STATUS_PFC_ENABLED; | ||
2482 | |||
2483 | bnx2x_update_mng(params, vars->link_status); | ||
2484 | |||
2470 | /* update NIG params */ | 2485 | /* update NIG params */ |
2471 | bnx2x_update_pfc_nig(params, vars, pfc_params); | 2486 | bnx2x_update_pfc_nig(params, vars, pfc_params); |
2472 | 2487 | ||
@@ -2695,16 +2710,6 @@ static int bnx2x_bmac_enable(struct link_params *params, | |||
2695 | return rc; | 2710 | return rc; |
2696 | } | 2711 | } |
2697 | 2712 | ||
2698 | |||
2699 | static void bnx2x_update_mng(struct link_params *params, u32 link_status) | ||
2700 | { | ||
2701 | struct bnx2x *bp = params->bp; | ||
2702 | |||
2703 | REG_WR(bp, params->shmem_base + | ||
2704 | offsetof(struct shmem_region, | ||
2705 | port_mb[params->port].link_status), link_status); | ||
2706 | } | ||
2707 | |||
2708 | static void bnx2x_bmac_rx_disable(struct bnx2x *bp, u8 port) | 2713 | static void bnx2x_bmac_rx_disable(struct bnx2x *bp, u8 port) |
2709 | { | 2714 | { |
2710 | u32 bmac_addr = port ? NIG_REG_INGRESS_BMAC1_MEM : | 2715 | u32 bmac_addr = port ? NIG_REG_INGRESS_BMAC1_MEM : |
@@ -4453,6 +4458,14 @@ void bnx2x_link_status_update(struct link_params *params, | |||
4453 | 4458 | ||
4454 | vars->aeu_int_mask = REG_RD(bp, sync_offset); | 4459 | vars->aeu_int_mask = REG_RD(bp, sync_offset); |
4455 | 4460 | ||
4461 | /* Sync PFC status */ | ||
4462 | if (vars->link_status & LINK_STATUS_PFC_ENABLED) | ||
4463 | params->feature_config_flags |= | ||
4464 | FEATURE_CONFIG_PFC_ENABLED; | ||
4465 | else | ||
4466 | params->feature_config_flags &= | ||
4467 | ~FEATURE_CONFIG_PFC_ENABLED; | ||
4468 | |||
4456 | DP(NETIF_MSG_LINK, "link_status 0x%x phy_link_up %x int_mask 0x%x\n", | 4469 | DP(NETIF_MSG_LINK, "link_status 0x%x phy_link_up %x int_mask 0x%x\n", |
4457 | vars->link_status, vars->phy_link_up, vars->aeu_int_mask); | 4470 | vars->link_status, vars->phy_link_up, vars->aeu_int_mask); |
4458 | DP(NETIF_MSG_LINK, "line_speed %x duplex %x flow_ctrl 0x%x\n", | 4471 | DP(NETIF_MSG_LINK, "line_speed %x duplex %x flow_ctrl 0x%x\n", |
diff --git a/drivers/net/bnx2x/bnx2x_reg.h b/drivers/net/bnx2x/bnx2x_reg.h index 53da4ef19928..064b4452664b 100644 --- a/drivers/net/bnx2x/bnx2x_reg.h +++ b/drivers/net/bnx2x/bnx2x_reg.h | |||
@@ -4771,6 +4771,12 @@ | |||
4771 | #define UMAC_COMMAND_CONFIG_REG_SW_RESET (0x1<<13) | 4771 | #define UMAC_COMMAND_CONFIG_REG_SW_RESET (0x1<<13) |
4772 | #define UMAC_COMMAND_CONFIG_REG_TX_ENA (0x1<<0) | 4772 | #define UMAC_COMMAND_CONFIG_REG_TX_ENA (0x1<<0) |
4773 | #define UMAC_REG_COMMAND_CONFIG 0x8 | 4773 | #define UMAC_REG_COMMAND_CONFIG 0x8 |
4774 | /* [RW 32] Register Bit 0 refers to Bit 16 of the MAC address; Bit 1 refers | ||
4775 | * to bit 17 of the MAC address etc. */ | ||
4776 | #define UMAC_REG_MAC_ADDR0 0xc | ||
4777 | /* [RW 16] Register Bit 0 refers to Bit 0 of the MAC address; Register Bit 1 | ||
4778 | * refers to Bit 1 of the MAC address etc. Bits 16 to 31 are reserved. */ | ||
4779 | #define UMAC_REG_MAC_ADDR1 0x10 | ||
4774 | /* [RW 14] Defines a 14-Bit maximum frame length used by the MAC receive | 4780 | /* [RW 14] Defines a 14-Bit maximum frame length used by the MAC receive |
4775 | * logic to check frames. */ | 4781 | * logic to check frames. */ |
4776 | #define UMAC_REG_MAXFR 0x14 | 4782 | #define UMAC_REG_MAXFR 0x14 |
@@ -5300,6 +5306,12 @@ | |||
5300 | #define XMAC_PFC_CTRL_HI_REG_TX_PFC_EN (0x1<<5) | 5306 | #define XMAC_PFC_CTRL_HI_REG_TX_PFC_EN (0x1<<5) |
5301 | #define XMAC_REG_CLEAR_RX_LSS_STATUS 0x60 | 5307 | #define XMAC_REG_CLEAR_RX_LSS_STATUS 0x60 |
5302 | #define XMAC_REG_CTRL 0 | 5308 | #define XMAC_REG_CTRL 0 |
5309 | /* [RW 16] Upper 48 bits of ctrl_sa register. Used as the SA in PAUSE/PFC | ||
5310 | * packets transmitted by the MAC */ | ||
5311 | #define XMAC_REG_CTRL_SA_HI 0x2c | ||
5312 | /* [RW 32] Lower 48 bits of ctrl_sa register. Used as the SA in PAUSE/PFC | ||
5313 | * packets transmitted by the MAC */ | ||
5314 | #define XMAC_REG_CTRL_SA_LO 0x28 | ||
5303 | #define XMAC_REG_PAUSE_CTRL 0x68 | 5315 | #define XMAC_REG_PAUSE_CTRL 0x68 |
5304 | #define XMAC_REG_PFC_CTRL 0x70 | 5316 | #define XMAC_REG_PFC_CTRL 0x70 |
5305 | #define XMAC_REG_PFC_CTRL_HI 0x74 | 5317 | #define XMAC_REG_PFC_CTRL_HI 0x74 |