Skip to content

Commit

Permalink
cxgb4 : dcb open-lldp interop fixes
Browse files Browse the repository at this point in the history
* In LLD_MANAGED mode, traffic classes were being returned in reverse order to
  lldp agent.
* Priotype of strict is no longer the default returned.
* Change behaviour of getdcbx() based on discussions on lldp-devel

These were missed as there was no working fetch interface for open-lldp when
running in LLD_MANAGED mode till now.

Fixes: 76bcb31 ("cxgb4 : Add DCBx support codebase and dcbnl_ops")

Signed-off-by: Anish Bhatt <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
anish authored and davem330 committed Nov 12, 2014
1 parent fbf8e72 commit ee7bc3c
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ void cxgb4_dcb_state_fsm(struct net_device *dev,
case CXGB4_DCB_INPUT_FW_ENABLED: {
/* we're going to use Firmware DCB */
dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE;
dcb->supported = CXGB4_DCBX_FW_SUPPORT;
dcb->supported = DCB_CAP_DCBX_LLD_MANAGED;
if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE)
dcb->supported |= DCB_CAP_DCBX_VER_IEEE;
else
dcb->supported |= DCB_CAP_DCBX_VER_CEE;
break;
}

Expand Down Expand Up @@ -437,22 +441,27 @@ static void cxgb4_getpgtccfg(struct net_device *dev, int tc,
*up_tc_map = (1 << tc);

/* prio_type is link strict */
*prio_type = 0x2;
if (*pgid != 0xF)
*prio_type = 0x2;
}

static void cxgb4_getpgtccfg_tx(struct net_device *dev, int tc,
u8 *prio_type, u8 *pgid, u8 *bw_per,
u8 *up_tc_map)
{
return cxgb4_getpgtccfg(dev, tc, prio_type, pgid, bw_per, up_tc_map, 1);
/* tc 0 is written at MSB position */
return cxgb4_getpgtccfg(dev, (7 - tc), prio_type, pgid, bw_per,
up_tc_map, 1);
}


static void cxgb4_getpgtccfg_rx(struct net_device *dev, int tc,
u8 *prio_type, u8 *pgid, u8 *bw_per,
u8 *up_tc_map)
{
return cxgb4_getpgtccfg(dev, tc, prio_type, pgid, bw_per, up_tc_map, 0);
/* tc 0 is written at MSB position */
return cxgb4_getpgtccfg(dev, (7 - tc), prio_type, pgid, bw_per,
up_tc_map, 0);
}

static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc,
Expand All @@ -462,6 +471,7 @@ static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc,
struct fw_port_cmd pcmd;
struct port_info *pi = netdev2pinfo(dev);
struct adapter *adap = pi->adapter;
int fw_tc = 7 - tc;
u32 _pgid;
int err;

Expand All @@ -480,8 +490,8 @@ static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc,
}

_pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid);
_pgid &= ~(0xF << (tc * 4));
_pgid |= pgid << (tc * 4);
_pgid &= ~(0xF << (fw_tc * 4));
_pgid |= pgid << (fw_tc * 4);
pcmd.u.dcb.pgid.pgid = cpu_to_be32(_pgid);

INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id);
Expand Down Expand Up @@ -594,7 +604,7 @@ static void cxgb4_getpfccfg(struct net_device *dev, int priority, u8 *pfccfg)
priority >= CXGB4_MAX_PRIORITY)
*pfccfg = 0;
else
*pfccfg = (pi->dcb.pfcen >> priority) & 1;
*pfccfg = (pi->dcb.pfcen >> (7 - priority)) & 1;
}

/* Enable/disable Priority Pause Frames for the specified Traffic Class
Expand All @@ -619,9 +629,9 @@ static void cxgb4_setpfccfg(struct net_device *dev, int priority, u8 pfccfg)
pcmd.u.dcb.pfc.pfcen = pi->dcb.pfcen;

if (pfccfg)
pcmd.u.dcb.pfc.pfcen |= (1 << priority);
pcmd.u.dcb.pfc.pfcen |= (1 << (7 - priority));
else
pcmd.u.dcb.pfc.pfcen &= (~(1 << priority));
pcmd.u.dcb.pfc.pfcen &= (~(1 << (7 - priority)));

err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd);
if (err != FW_PORT_DCB_CFG_SUCCESS) {
Expand Down

0 comments on commit ee7bc3c

Please sign in to comment.