aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x
diff options
context:
space:
mode:
authorDmitry Kravkov <dmitry@broadcom.com>2011-07-24 00:09:43 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-24 16:11:40 -0400
commit09b775e7ec08ae92b8d976b7e34ba7f83b904c97 (patch)
treec2f892fcf6f1f1b4feeeb8728500f8bcdfe98e43 /drivers/net/bnx2x
parent262931339805ce8a7d25c5f75d5b2402013fc55d (diff)
bnx2x: dcb - send all unmapped priorities to same COS as L2
As a result of DCBX negotiation some priorities maybe untouched and still unmapped to any COS; instead of sending them to COS0 we assign them to the same COS as L2 traffic - to avoid collisions with storage class of service. Signed-off-by: Dmitry Kravkov <dmitry@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_dcb.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/drivers/net/bnx2x/bnx2x_dcb.c b/drivers/net/bnx2x/bnx2x_dcb.c
index d028794a2298..a4ea35f6a456 100644
--- a/drivers/net/bnx2x/bnx2x_dcb.c
+++ b/drivers/net/bnx2x/bnx2x_dcb.c
@@ -19,15 +19,13 @@
19#include <linux/netdevice.h> 19#include <linux/netdevice.h>
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <linux/rtnetlink.h>
23#include <net/dcbnl.h>
22 24
23#include "bnx2x.h" 25#include "bnx2x.h"
24#include "bnx2x_cmn.h" 26#include "bnx2x_cmn.h"
25#include "bnx2x_dcb.h" 27#include "bnx2x_dcb.h"
26 28
27#ifdef BCM_DCBNL
28#include <linux/rtnetlink.h>
29#endif
30
31/* forward declarations of dcbx related functions */ 29/* forward declarations of dcbx related functions */
32static int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp); 30static int bnx2x_dcbx_stop_hw_tx(struct bnx2x *bp);
33static void bnx2x_pfc_set_pfc(struct bnx2x *bp); 31static void bnx2x_pfc_set_pfc(struct bnx2x *bp);
@@ -333,6 +331,32 @@ static void bnx2x_dcbx_get_pfc_feature(struct bnx2x *bp,
333 } 331 }
334} 332}
335 333
334/* maps unmapped priorities to to the same COS as L2 */
335static void bnx2x_dcbx_map_nw(struct bnx2x *bp)
336{
337 int i;
338 u32 unmapped = (1 << MAX_PFC_PRIORITIES) - 1; /* all ones */
339 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority;
340 u32 nw_prio = 1 << ttp[LLFC_TRAFFIC_TYPE_NW];
341 struct bnx2x_dcbx_cos_params *cos_params =
342 bp->dcbx_port_params.ets.cos_params;
343
344 /* get unmapped priorities by clearing mapped bits */
345 for (i = 0; i < LLFC_DRIVER_TRAFFIC_TYPE_MAX; i++)
346 unmapped &= ~(1 << ttp[i]);
347
348 /* find cos for nw prio and extend it with unmapped */
349 for (i = 0; i < ARRAY_SIZE(bp->dcbx_port_params.ets.cos_params); i++) {
350 if (cos_params[i].pri_bitmask & nw_prio) {
351 /* extend the bitmask with unmapped */
352 DP(NETIF_MSG_LINK,
353 "cos %d extended with 0x%08x", i, unmapped);
354 cos_params[i].pri_bitmask |= unmapped;
355 break;
356 }
357 }
358}
359
336static void bnx2x_get_dcbx_drv_param(struct bnx2x *bp, 360static void bnx2x_get_dcbx_drv_param(struct bnx2x *bp,
337 struct dcbx_features *features, 361 struct dcbx_features *features,
338 u32 error) 362 u32 error)
@@ -342,6 +366,8 @@ static void bnx2x_get_dcbx_drv_param(struct bnx2x *bp,
342 bnx2x_dcbx_get_pfc_feature(bp, &features->pfc, error); 366 bnx2x_dcbx_get_pfc_feature(bp, &features->pfc, error);
343 367
344 bnx2x_dcbx_get_ets_feature(bp, &features->ets, error); 368 bnx2x_dcbx_get_ets_feature(bp, &features->ets, error);
369
370 bnx2x_dcbx_map_nw(bp);
345} 371}
346 372
347#define DCBX_LOCAL_MIB_MAX_TRY_READ (100) 373#define DCBX_LOCAL_MIB_MAX_TRY_READ (100)
@@ -682,6 +708,8 @@ static inline void bnx2x_dcbx_update_tc_mapping(struct bnx2x *bp)
682 if (bp->dcbx_port_params.ets.cos_params[cos].pri_bitmask 708 if (bp->dcbx_port_params.ets.cos_params[cos].pri_bitmask
683 & (1 << prio)) { 709 & (1 << prio)) {
684 bp->prio_to_cos[prio] = cos; 710 bp->prio_to_cos[prio] = cos;
711 DP(NETIF_MSG_LINK,
712 "tx_mapping %d --> %d\n", prio, cos);
685 } 713 }
686 } 714 }
687 } 715 }
@@ -749,7 +777,7 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state)
749 DP(NETIF_MSG_LINK, "BNX2X_DCBX_STATE_TX_RELEASED\n"); 777 DP(NETIF_MSG_LINK, "BNX2X_DCBX_STATE_TX_RELEASED\n");
750 bnx2x_fw_command(bp, DRV_MSG_CODE_DCBX_PMF_DRV_OK, 0); 778 bnx2x_fw_command(bp, DRV_MSG_CODE_DCBX_PMF_DRV_OK, 0);
751#ifdef BCM_DCBNL 779#ifdef BCM_DCBNL
752 /** 780 /*
753 * Send a notification for the new negotiated parameters 781 * Send a notification for the new negotiated parameters
754 */ 782 */
755 dcbnl_cee_notify(bp->dev, RTM_GETDCB, DCB_CMD_CEE_GET, 0, 0); 783 dcbnl_cee_notify(bp->dev, RTM_GETDCB, DCB_CMD_CEE_GET, 0, 0);
@@ -1732,7 +1760,6 @@ static void bnx2x_dcbx_fill_cos_params(struct bnx2x *bp,
1732 pri_join_mask, 1760 pri_join_mask,
1733 num_of_dif_pri); 1761 num_of_dif_pri);
1734 1762
1735
1736 for (i = 0; i < cos_data.num_of_cos ; i++) { 1763 for (i = 0; i < cos_data.num_of_cos ; i++) {
1737 struct bnx2x_dcbx_cos_params *p = 1764 struct bnx2x_dcbx_cos_params *p =
1738 &bp->dcbx_port_params.ets.cos_params[i]; 1765 &bp->dcbx_port_params.ets.cos_params[i];