Commit 2b5fb1f2 authored by Hariprasad Shenai's avatar Hariprasad Shenai Committed by David S. Miller

cxgb4/cxgb4vf/csiostor: Cleanup macros/register defines related to port and VI

This patch cleanups all port and VI related macros/register defines that are
defined in t4fw_api.h and the affected files.
Signed-off-by: default avatarHariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6e4b51a6
...@@ -243,7 +243,7 @@ void cxgb4_dcb_handle_fw_update(struct adapter *adap, ...@@ -243,7 +243,7 @@ void cxgb4_dcb_handle_fw_update(struct adapter *adap,
const struct fw_port_cmd *pcmd) const struct fw_port_cmd *pcmd)
{ {
const union fw_port_dcb *fwdcb = &pcmd->u.dcb; const union fw_port_dcb *fwdcb = &pcmd->u.dcb;
int port = FW_PORT_CMD_PORTID_GET(be32_to_cpu(pcmd->op_to_portid)); int port = FW_PORT_CMD_PORTID_G(be32_to_cpu(pcmd->op_to_portid));
struct net_device *dev = adap->port[port]; struct net_device *dev = adap->port[port];
struct port_info *pi = netdev_priv(dev); struct port_info *pi = netdev_priv(dev);
struct port_dcb_info *dcb = &pi->dcb; struct port_dcb_info *dcb = &pi->dcb;
...@@ -256,12 +256,12 @@ void cxgb4_dcb_handle_fw_update(struct adapter *adap, ...@@ -256,12 +256,12 @@ void cxgb4_dcb_handle_fw_update(struct adapter *adap,
if (dcb_type == FW_PORT_DCB_TYPE_CONTROL) { if (dcb_type == FW_PORT_DCB_TYPE_CONTROL) {
enum cxgb4_dcb_state_input input = enum cxgb4_dcb_state_input input =
((pcmd->u.dcb.control.all_syncd_pkd & ((pcmd->u.dcb.control.all_syncd_pkd &
FW_PORT_CMD_ALL_SYNCD) FW_PORT_CMD_ALL_SYNCD_F)
? CXGB4_DCB_STATE_FW_ALLSYNCED ? CXGB4_DCB_STATE_FW_ALLSYNCED
: CXGB4_DCB_STATE_FW_INCOMPLETE); : CXGB4_DCB_STATE_FW_INCOMPLETE);
if (dcb->dcb_version != FW_PORT_DCB_VER_UNKNOWN) { if (dcb->dcb_version != FW_PORT_DCB_VER_UNKNOWN) {
dcb_running_version = FW_PORT_CMD_DCB_VERSION_GET( dcb_running_version = FW_PORT_CMD_DCB_VERSION_G(
be16_to_cpu( be16_to_cpu(
pcmd->u.dcb.control.dcb_version_to_app_state)); pcmd->u.dcb.control.dcb_version_to_app_state));
if (dcb_running_version == FW_PORT_DCB_VER_CEE1D01 || if (dcb_running_version == FW_PORT_DCB_VER_CEE1D01 ||
...@@ -519,7 +519,7 @@ static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc, ...@@ -519,7 +519,7 @@ static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc,
INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id);
if (pi->dcb.state == CXGB4_DCB_STATE_HOST) if (pi->dcb.state == CXGB4_DCB_STATE_HOST)
pcmd.op_to_portid |= cpu_to_be32(FW_PORT_CMD_APPLY); pcmd.op_to_portid |= cpu_to_be32(FW_PORT_CMD_APPLY_F);
err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd);
if (err != FW_PORT_DCB_CFG_SUCCESS) if (err != FW_PORT_DCB_CFG_SUCCESS)
...@@ -583,7 +583,7 @@ static void cxgb4_setpgbwgcfg_tx(struct net_device *dev, int pgid, ...@@ -583,7 +583,7 @@ static void cxgb4_setpgbwgcfg_tx(struct net_device *dev, int pgid,
INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id);
if (pi->dcb.state == CXGB4_DCB_STATE_HOST) if (pi->dcb.state == CXGB4_DCB_STATE_HOST)
pcmd.op_to_portid |= cpu_to_be32(FW_PORT_CMD_APPLY); pcmd.op_to_portid |= cpu_to_be32(FW_PORT_CMD_APPLY_F);
err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd);
...@@ -623,7 +623,7 @@ static void cxgb4_setpfccfg(struct net_device *dev, int priority, u8 pfccfg) ...@@ -623,7 +623,7 @@ static void cxgb4_setpfccfg(struct net_device *dev, int priority, u8 pfccfg)
INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id);
if (pi->dcb.state == CXGB4_DCB_STATE_HOST) if (pi->dcb.state == CXGB4_DCB_STATE_HOST)
pcmd.op_to_portid |= cpu_to_be32(FW_PORT_CMD_APPLY); pcmd.op_to_portid |= cpu_to_be32(FW_PORT_CMD_APPLY_F);
pcmd.u.dcb.pfc.type = FW_PORT_DCB_TYPE_PFC; pcmd.u.dcb.pfc.type = FW_PORT_DCB_TYPE_PFC;
pcmd.u.dcb.pfc.pfcen = pi->dcb.pfcen; pcmd.u.dcb.pfc.pfcen = pi->dcb.pfcen;
...@@ -842,7 +842,7 @@ static int __cxgb4_setapp(struct net_device *dev, u8 app_idtype, u16 app_id, ...@@ -842,7 +842,7 @@ static int __cxgb4_setapp(struct net_device *dev, u8 app_idtype, u16 app_id,
/* write out new app table entry */ /* write out new app table entry */
INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id);
if (pi->dcb.state == CXGB4_DCB_STATE_HOST) if (pi->dcb.state == CXGB4_DCB_STATE_HOST)
pcmd.op_to_portid |= cpu_to_be32(FW_PORT_CMD_APPLY); pcmd.op_to_portid |= cpu_to_be32(FW_PORT_CMD_APPLY_F);
pcmd.u.dcb.app_priority.type = FW_PORT_DCB_TYPE_APP_ID; pcmd.u.dcb.app_priority.type = FW_PORT_DCB_TYPE_APP_ID;
pcmd.u.dcb.app_priority.protocolid = cpu_to_be16(app_id); pcmd.u.dcb.app_priority.protocolid = cpu_to_be16(app_id);
......
...@@ -45,9 +45,9 @@ ...@@ -45,9 +45,9 @@
cpu_to_be32(FW_CMD_OP_V(FW_PORT_CMD) | \ cpu_to_be32(FW_CMD_OP_V(FW_PORT_CMD) | \
FW_CMD_REQUEST_F | \ FW_CMD_REQUEST_F | \
FW_CMD_##__op##_F | \ FW_CMD_##__op##_F | \
FW_PORT_CMD_PORTID(__port)); \ FW_PORT_CMD_PORTID_V(__port)); \
(__pcmd).action_to_len16 = \ (__pcmd).action_to_len16 = \
cpu_to_be32(FW_PORT_CMD_ACTION(__action) | \ cpu_to_be32(FW_PORT_CMD_ACTION_V(__action) | \
FW_LEN16(pcmd)); \ FW_LEN16(pcmd)); \
} while (0) } while (0)
......
...@@ -710,7 +710,7 @@ EXPORT_SYMBOL(cxgb4_dcb_enabled); ...@@ -710,7 +710,7 @@ EXPORT_SYMBOL(cxgb4_dcb_enabled);
/* Handle a Data Center Bridging update message from the firmware. */ /* Handle a Data Center Bridging update message from the firmware. */
static void dcb_rpl(struct adapter *adap, const struct fw_port_cmd *pcmd) static void dcb_rpl(struct adapter *adap, const struct fw_port_cmd *pcmd)
{ {
int port = FW_PORT_CMD_PORTID_GET(ntohl(pcmd->op_to_portid)); int port = FW_PORT_CMD_PORTID_G(ntohl(pcmd->op_to_portid));
struct net_device *dev = adap->port[port]; struct net_device *dev = adap->port[port];
int old_dcb_enabled = cxgb4_dcb_enabled(dev); int old_dcb_enabled = cxgb4_dcb_enabled(dev);
int new_dcb_enabled; int new_dcb_enabled;
...@@ -835,15 +835,15 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp, ...@@ -835,15 +835,15 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp,
const struct fw_port_cmd *pcmd = (const void *)p->data; const struct fw_port_cmd *pcmd = (const void *)p->data;
unsigned int cmd = FW_CMD_OP_G(ntohl(pcmd->op_to_portid)); unsigned int cmd = FW_CMD_OP_G(ntohl(pcmd->op_to_portid));
unsigned int action = unsigned int action =
FW_PORT_CMD_ACTION_GET(ntohl(pcmd->action_to_len16)); FW_PORT_CMD_ACTION_G(ntohl(pcmd->action_to_len16));
if (cmd == FW_PORT_CMD && if (cmd == FW_PORT_CMD &&
action == FW_PORT_ACTION_GET_PORT_INFO) { action == FW_PORT_ACTION_GET_PORT_INFO) {
int port = FW_PORT_CMD_PORTID_GET( int port = FW_PORT_CMD_PORTID_G(
be32_to_cpu(pcmd->op_to_portid)); be32_to_cpu(pcmd->op_to_portid));
struct net_device *dev = q->adap->port[port]; struct net_device *dev = q->adap->port[port];
int state_input = ((pcmd->u.info.dcbxdis_pkd & int state_input = ((pcmd->u.info.dcbxdis_pkd &
FW_PORT_CMD_DCBXDIS) FW_PORT_CMD_DCBXDIS_F)
? CXGB4_DCB_INPUT_FW_DISABLED ? CXGB4_DCB_INPUT_FW_DISABLED
: CXGB4_DCB_INPUT_FW_ENABLED); : CXGB4_DCB_INPUT_FW_ENABLED);
......
...@@ -435,9 +435,9 @@ u64 cxgb4_select_ntuple(struct net_device *dev, ...@@ -435,9 +435,9 @@ u64 cxgb4_select_ntuple(struct net_device *dev,
if (tp->vnic_shift >= 0) { if (tp->vnic_shift >= 0) {
u32 viid = cxgb4_port_viid(dev); u32 viid = cxgb4_port_viid(dev);
u32 vf = FW_VIID_VIN_GET(viid); u32 vf = FW_VIID_VIN_G(viid);
u32 pf = FW_VIID_PFN_G(viid); u32 pf = FW_VIID_PFN_G(viid);
u32 vld = FW_VIID_VIVLD_GET(viid); u32 vld = FW_VIID_VIVLD_G(viid);
ntuple |= (u64)(V_FT_VNID_ID_VF(vf) | ntuple |= (u64)(V_FT_VNID_ID_VF(vf) |
V_FT_VNID_ID_PF(pf) | V_FT_VNID_ID_PF(pf) |
......
This diff is collapsed.
...@@ -291,13 +291,13 @@ int t4vf_port_init(struct adapter *adapter, int pidx) ...@@ -291,13 +291,13 @@ int t4vf_port_init(struct adapter *adapter, int pidx)
FW_CMD_REQUEST_F | FW_CMD_REQUEST_F |
FW_CMD_READ_F); FW_CMD_READ_F);
vi_cmd.alloc_to_len16 = cpu_to_be32(FW_LEN16(vi_cmd)); vi_cmd.alloc_to_len16 = cpu_to_be32(FW_LEN16(vi_cmd));
vi_cmd.type_viid = cpu_to_be16(FW_VI_CMD_VIID(pi->viid)); vi_cmd.type_viid = cpu_to_be16(FW_VI_CMD_VIID_V(pi->viid));
v = t4vf_wr_mbox(adapter, &vi_cmd, sizeof(vi_cmd), &vi_rpl); v = t4vf_wr_mbox(adapter, &vi_cmd, sizeof(vi_cmd), &vi_rpl);
if (v) if (v)
return v; return v;
BUG_ON(pi->port_id != FW_VI_CMD_PORTID_GET(vi_rpl.portid_pkd)); BUG_ON(pi->port_id != FW_VI_CMD_PORTID_G(vi_rpl.portid_pkd));
pi->rss_size = FW_VI_CMD_RSSSIZE_GET(be16_to_cpu(vi_rpl.rsssize_pkd)); pi->rss_size = FW_VI_CMD_RSSSIZE_G(be16_to_cpu(vi_rpl.rsssize_pkd));
t4_os_set_hw_addr(adapter, pidx, vi_rpl.mac); t4_os_set_hw_addr(adapter, pidx, vi_rpl.mac);
/* /*
...@@ -311,9 +311,9 @@ int t4vf_port_init(struct adapter *adapter, int pidx) ...@@ -311,9 +311,9 @@ int t4vf_port_init(struct adapter *adapter, int pidx)
port_cmd.op_to_portid = cpu_to_be32(FW_CMD_OP_V(FW_PORT_CMD) | port_cmd.op_to_portid = cpu_to_be32(FW_CMD_OP_V(FW_PORT_CMD) |
FW_CMD_REQUEST_F | FW_CMD_REQUEST_F |
FW_CMD_READ_F | FW_CMD_READ_F |
FW_PORT_CMD_PORTID(pi->port_id)); FW_PORT_CMD_PORTID_V(pi->port_id));
port_cmd.action_to_len16 = port_cmd.action_to_len16 =
cpu_to_be32(FW_PORT_CMD_ACTION(FW_PORT_ACTION_GET_PORT_INFO) | cpu_to_be32(FW_PORT_CMD_ACTION_V(FW_PORT_ACTION_GET_PORT_INFO) |
FW_LEN16(port_cmd)); FW_LEN16(port_cmd));
v = t4vf_wr_mbox(adapter, &port_cmd, sizeof(port_cmd), &port_rpl); v = t4vf_wr_mbox(adapter, &port_cmd, sizeof(port_cmd), &port_rpl);
if (v) if (v)
...@@ -897,13 +897,13 @@ int t4vf_alloc_vi(struct adapter *adapter, int port_id) ...@@ -897,13 +897,13 @@ int t4vf_alloc_vi(struct adapter *adapter, int port_id)
FW_CMD_WRITE_F | FW_CMD_WRITE_F |
FW_CMD_EXEC_F); FW_CMD_EXEC_F);
cmd.alloc_to_len16 = cpu_to_be32(FW_LEN16(cmd) | cmd.alloc_to_len16 = cpu_to_be32(FW_LEN16(cmd) |
FW_VI_CMD_ALLOC); FW_VI_CMD_ALLOC_F);
cmd.portid_pkd = FW_VI_CMD_PORTID(port_id); cmd.portid_pkd = FW_VI_CMD_PORTID_V(port_id);
v = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl); v = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl);
if (v) if (v)
return v; return v;
return FW_VI_CMD_VIID_GET(be16_to_cpu(rpl.type_viid)); return FW_VI_CMD_VIID_G(be16_to_cpu(rpl.type_viid));
} }
/** /**
...@@ -926,8 +926,8 @@ int t4vf_free_vi(struct adapter *adapter, int viid) ...@@ -926,8 +926,8 @@ int t4vf_free_vi(struct adapter *adapter, int viid)
FW_CMD_REQUEST_F | FW_CMD_REQUEST_F |
FW_CMD_EXEC_F); FW_CMD_EXEC_F);
cmd.alloc_to_len16 = cpu_to_be32(FW_LEN16(cmd) | cmd.alloc_to_len16 = cpu_to_be32(FW_LEN16(cmd) |
FW_VI_CMD_FREE); FW_VI_CMD_FREE_F);
cmd.type_viid = cpu_to_be16(FW_VI_CMD_VIID(viid)); cmd.type_viid = cpu_to_be16(FW_VI_CMD_VIID_V(viid));
return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL); return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL);
} }
...@@ -949,9 +949,9 @@ int t4vf_enable_vi(struct adapter *adapter, unsigned int viid, ...@@ -949,9 +949,9 @@ int t4vf_enable_vi(struct adapter *adapter, unsigned int viid,
cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_ENABLE_CMD) | cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_ENABLE_CMD) |
FW_CMD_REQUEST_F | FW_CMD_REQUEST_F |
FW_CMD_EXEC_F | FW_CMD_EXEC_F |
FW_VI_ENABLE_CMD_VIID(viid)); FW_VI_ENABLE_CMD_VIID_V(viid));
cmd.ien_to_len16 = cpu_to_be32(FW_VI_ENABLE_CMD_IEN(rx_en) | cmd.ien_to_len16 = cpu_to_be32(FW_VI_ENABLE_CMD_IEN_V(rx_en) |
FW_VI_ENABLE_CMD_EEN(tx_en) | FW_VI_ENABLE_CMD_EEN_V(tx_en) |
FW_LEN16(cmd)); FW_LEN16(cmd));
return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL); return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL);
} }
...@@ -973,8 +973,8 @@ int t4vf_identify_port(struct adapter *adapter, unsigned int viid, ...@@ -973,8 +973,8 @@ int t4vf_identify_port(struct adapter *adapter, unsigned int viid,
cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_ENABLE_CMD) | cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_ENABLE_CMD) |
FW_CMD_REQUEST_F | FW_CMD_REQUEST_F |
FW_CMD_EXEC_F | FW_CMD_EXEC_F |
FW_VI_ENABLE_CMD_VIID(viid)); FW_VI_ENABLE_CMD_VIID_V(viid));
cmd.ien_to_len16 = cpu_to_be32(FW_VI_ENABLE_CMD_LED | cmd.ien_to_len16 = cpu_to_be32(FW_VI_ENABLE_CMD_LED_F |
FW_LEN16(cmd)); FW_LEN16(cmd));
cmd.blinkdur = cpu_to_be16(nblinks); cmd.blinkdur = cpu_to_be16(nblinks);
return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL); return t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), NULL);
...@@ -1001,28 +1001,28 @@ int t4vf_set_rxmode(struct adapter *adapter, unsigned int viid, ...@@ -1001,28 +1001,28 @@ int t4vf_set_rxmode(struct adapter *adapter, unsigned int viid,
/* convert to FW values */ /* convert to FW values */
if (mtu < 0) if (mtu < 0)
mtu = FW_VI_RXMODE_CMD_MTU_MASK; mtu = FW_VI_RXMODE_CMD_MTU_M;
if (promisc < 0) if (promisc < 0)
promisc = FW_VI_RXMODE_CMD_PROMISCEN_MASK; promisc = FW_VI_RXMODE_CMD_PROMISCEN_M;
if (all_multi < 0) if (all_multi < 0)
all_multi = FW_VI_RXMODE_CMD_ALLMULTIEN_MASK; all_multi = FW_VI_RXMODE_CMD_ALLMULTIEN_M;
if (bcast < 0) if (bcast < 0)
bcast = FW_VI_RXMODE_CMD_BROADCASTEN_MASK; bcast = FW_VI_RXMODE_CMD_BROADCASTEN_M;
if (vlanex < 0) if (vlanex < 0)
vlanex = FW_VI_RXMODE_CMD_VLANEXEN_MASK; vlanex = FW_VI_RXMODE_CMD_VLANEXEN_M;
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_RXMODE_CMD) | cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_RXMODE_CMD) |
FW_CMD_REQUEST_F | FW_CMD_REQUEST_F |
FW_CMD_WRITE_F | FW_CMD_WRITE_F |
FW_VI_RXMODE_CMD_VIID(viid)); FW_VI_RXMODE_CMD_VIID_V(viid));
cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd));
cmd.mtu_to_vlanexen = cmd.mtu_to_vlanexen =
cpu_to_be32(FW_VI_RXMODE_CMD_MTU(mtu) | cpu_to_be32(FW_VI_RXMODE_CMD_MTU_V(mtu) |
FW_VI_RXMODE_CMD_PROMISCEN(promisc) | FW_VI_RXMODE_CMD_PROMISCEN_V(promisc) |
FW_VI_RXMODE_CMD_ALLMULTIEN(all_multi) | FW_VI_RXMODE_CMD_ALLMULTIEN_V(all_multi) |
FW_VI_RXMODE_CMD_BROADCASTEN(bcast) | FW_VI_RXMODE_CMD_BROADCASTEN_V(bcast) |
FW_VI_RXMODE_CMD_VLANEXEN(vlanex)); FW_VI_RXMODE_CMD_VLANEXEN_V(vlanex));
return t4vf_wr_mbox_core(adapter, &cmd, sizeof(cmd), NULL, sleep_ok); return t4vf_wr_mbox_core(adapter, &cmd, sizeof(cmd), NULL, sleep_ok);
} }
...@@ -1076,15 +1076,15 @@ int t4vf_alloc_mac_filt(struct adapter *adapter, unsigned int viid, bool free, ...@@ -1076,15 +1076,15 @@ int t4vf_alloc_mac_filt(struct adapter *adapter, unsigned int viid, bool free,
FW_CMD_REQUEST_F | FW_CMD_REQUEST_F |
FW_CMD_WRITE_F | FW_CMD_WRITE_F |
(free ? FW_CMD_EXEC_F : 0) | (free ? FW_CMD_EXEC_F : 0) |
FW_VI_MAC_CMD_VIID(viid)); FW_VI_MAC_CMD_VIID_V(viid));
cmd.freemacs_to_len16 = cmd.freemacs_to_len16 =
cpu_to_be32(FW_VI_MAC_CMD_FREEMACS(free) | cpu_to_be32(FW_VI_MAC_CMD_FREEMACS_V(free) |
FW_CMD_LEN16_V(len16)); FW_CMD_LEN16_V(len16));
for (i = 0, p = cmd.u.exact; i < fw_naddr; i++, p++) { for (i = 0, p = cmd.u.exact; i < fw_naddr; i++, p++) {
p->valid_to_idx = cpu_to_be16( p->valid_to_idx = cpu_to_be16(
FW_VI_MAC_CMD_VALID | FW_VI_MAC_CMD_VALID_F |
FW_VI_MAC_CMD_IDX(FW_VI_MAC_ADD_MAC)); FW_VI_MAC_CMD_IDX_V(FW_VI_MAC_ADD_MAC));
memcpy(p->macaddr, addr[offset+i], sizeof(p->macaddr)); memcpy(p->macaddr, addr[offset+i], sizeof(p->macaddr));
} }
...@@ -1095,7 +1095,7 @@ int t4vf_alloc_mac_filt(struct adapter *adapter, unsigned int viid, bool free, ...@@ -1095,7 +1095,7 @@ int t4vf_alloc_mac_filt(struct adapter *adapter, unsigned int viid, bool free,
break; break;
for (i = 0, p = rpl.u.exact; i < fw_naddr; i++, p++) { for (i = 0, p = rpl.u.exact; i < fw_naddr; i++, p++) {
u16 index = FW_VI_MAC_CMD_IDX_GET( u16 index = FW_VI_MAC_CMD_IDX_G(
be16_to_cpu(p->valid_to_idx)); be16_to_cpu(p->valid_to_idx));
if (idx) if (idx)
...@@ -1164,16 +1164,16 @@ int t4vf_change_mac(struct adapter *adapter, unsigned int viid, ...@@ -1164,16 +1164,16 @@ int t4vf_change_mac(struct adapter *adapter, unsigned int viid,
cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_MAC_CMD) | cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_MAC_CMD) |
FW_CMD_REQUEST_F | FW_CMD_REQUEST_F |
FW_CMD_WRITE_F | FW_CMD_WRITE_F |
FW_VI_MAC_CMD_VIID(viid)); FW_VI_MAC_CMD_VIID_V(viid));
cmd.freemacs_to_len16 = cpu_to_be32(FW_CMD_LEN16_V(len16)); cmd.freemacs_to_len16 = cpu_to_be32(FW_CMD_LEN16_V(len16));
p->valid_to_idx = cpu_to_be16(FW_VI_MAC_CMD_VALID | p->valid_to_idx = cpu_to_be16(FW_VI_MAC_CMD_VALID_F |
FW_VI_MAC_CMD_IDX(idx)); FW_VI_MAC_CMD_IDX_V(idx));
memcpy(p->macaddr, addr, sizeof(p->macaddr)); memcpy(p->macaddr, addr, sizeof(p->macaddr));
ret = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl); ret = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl);
if (ret == 0) { if (ret == 0) {
p = &rpl.u.exact[0]; p = &rpl.u.exact[0];
ret = FW_VI_MAC_CMD_IDX_GET(be16_to_cpu(p->valid_to_idx)); ret = FW_VI_MAC_CMD_IDX_G(be16_to_cpu(p->valid_to_idx));
if (ret >= max_naddr) if (ret >= max_naddr)
ret = -ENOMEM; ret = -ENOMEM;
} }
...@@ -1201,9 +1201,9 @@ int t4vf_set_addr_hash(struct adapter *adapter, unsigned int viid, ...@@ -1201,9 +1201,9 @@ int t4vf_set_addr_hash(struct adapter *adapter, unsigned int viid,
cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_MAC_CMD) | cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_MAC_CMD) |
FW_CMD_REQUEST_F | FW_CMD_REQUEST_F |
FW_CMD_WRITE_F | FW_CMD_WRITE_F |
FW_VI_ENABLE_CMD_VIID(viid)); FW_VI_ENABLE_CMD_VIID_V(viid));
cmd.freemacs_to_len16 = cpu_to_be32(FW_VI_MAC_CMD_HASHVECEN | cmd.freemacs_to_len16 = cpu_to_be32(FW_VI_MAC_CMD_HASHVECEN_F |
FW_VI_MAC_CMD_HASHUNIEN(ucast) | FW_VI_MAC_CMD_HASHUNIEN_V(ucast) |
FW_CMD_LEN16_V(len16)); FW_CMD_LEN16_V(len16));
cmd.u.hash.hashvec = cpu_to_be64(vec); cmd.u.hash.hashvec = cpu_to_be64(vec);
return t4vf_wr_mbox_core(adapter, &cmd, sizeof(cmd), NULL, sleep_ok); return t4vf_wr_mbox_core(adapter, &cmd, sizeof(cmd), NULL, sleep_ok);
...@@ -1241,13 +1241,13 @@ int t4vf_get_port_stats(struct adapter *adapter, int pidx, ...@@ -1241,13 +1241,13 @@ int t4vf_get_port_stats(struct adapter *adapter, int pidx,
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_STATS_CMD) | cmd.op_to_viid = cpu_to_be32(FW_CMD_OP_V(FW_VI_STATS_CMD) |
FW_VI_STATS_CMD_VIID(pi->viid) | FW_VI_STATS_CMD_VIID_V(pi->viid) |
FW_CMD_REQUEST_F | FW_CMD_REQUEST_F |
FW_CMD_READ_F); FW_CMD_READ_F);
cmd.retval_len16 = cpu_to_be32(FW_CMD_LEN16_V(len16)); cmd.retval_len16 = cpu_to_be32(FW_CMD_LEN16_V(len16));
cmd.u.ctl.nstats_ix = cmd.u.ctl.nstats_ix =
cpu_to_be16(FW_VI_STATS_CMD_IX(ix) | cpu_to_be16(FW_VI_STATS_CMD_IX_V(ix) |
FW_VI_STATS_CMD_NSTATS(nstats)); FW_VI_STATS_CMD_NSTATS_V(nstats));
ret = t4vf_wr_mbox_ns(adapter, &cmd, len, &rpl); ret = t4vf_wr_mbox_ns(adapter, &cmd, len, &rpl);
if (ret) if (ret)
return ret; return ret;
...@@ -1359,7 +1359,7 @@ int t4vf_handle_fw_rpl(struct adapter *adapter, const __be64 *rpl) ...@@ -1359,7 +1359,7 @@ int t4vf_handle_fw_rpl(struct adapter *adapter, const __be64 *rpl)
/* /*
* Extract various fields from port status change message. * Extract various fields from port status change message.
*/ */
action = FW_PORT_CMD_ACTION_GET( action = FW_PORT_CMD_ACTION_G(
be32_to_cpu(port_cmd->action_to_len16)); be32_to_cpu(port_cmd->action_to_len16));
if (action != FW_PORT_ACTION_GET_PORT_INFO) { if (action != FW_PORT_ACTION_GET_PORT_INFO) {
dev_err(adapter->pdev_dev, dev_err(adapter->pdev_dev,
...@@ -1368,24 +1368,24 @@ int t4vf_handle_fw_rpl(struct adapter *adapter, const __be64 *rpl) ...@@ -1368,24 +1368,24 @@ int t4vf_handle_fw_rpl(struct adapter *adapter, const __be64 *rpl)
break; break;
} }
port_id = FW_PORT_CMD_PORTID_GET( port_id = FW_PORT_CMD_PORTID_G(
be32_to_cpu(port_cmd->op_to_portid)); be32_to_cpu(port_cmd->op_to_portid));
word = be32_to_cpu(port_cmd->u.info.lstatus_to_modtype); word = be32_to_cpu(port_cmd->u.info.lstatus_to_modtype);
link_ok = (word & FW_PORT_CMD_LSTATUS) != 0; link_ok = (word & FW_PORT_CMD_LSTATUS_F) != 0;
speed = 0; speed = 0;
fc = 0; fc = 0;
if (word & FW_PORT_CMD_RXPAUSE) if (word & FW_PORT_CMD_RXPAUSE_F)
fc |= PAUSE_RX; fc |= PAUSE_RX;
if (word & FW_PORT_CMD_TXPAUSE) if (word & FW_PORT_CMD_TXPAUSE_F)
fc |= PAUSE_TX; fc |= PAUSE_TX;
if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_100M)) if (word & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_100M))
speed = 100; speed = 100;
else if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_1G)) else if (word & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_1G))
speed = 1000; speed = 1000;
else if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_10G)) else if (word & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G))
speed = 10000; speed = 10000;
else if (word & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_40G)) else if (word & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G))
speed = 40000; speed = 40000;
/* /*
......
...@@ -347,24 +347,24 @@ csio_mb_port(struct csio_hw *hw, struct csio_mb *mbp, uint32_t tmo, ...@@ -347,24 +347,24 @@ csio_mb_port(struct csio_hw *hw, struct csio_mb *mbp, uint32_t tmo,
void (*cbfn) (struct csio_hw *, struct csio_mb *)) void (*cbfn) (struct csio_hw *, struct csio_mb *))
{ {
struct fw_port_cmd *cmdp = (struct fw_port_cmd *)(mbp->mb); struct fw_port_cmd *cmdp = (struct fw_port_cmd *)(mbp->mb);
unsigned int lfc = 0, mdi = FW_PORT_MDI(FW_PORT_MDI_AUTO); unsigned int lfc = 0, mdi = FW_PORT_CAP_MDI_V(FW_PORT_CAP_MDI_AUTO);
CSIO_INIT_MBP(mbp, cmdp, tmo, hw, cbfn, 1); CSIO_INIT_MBP(mbp, cmdp, tmo, hw, cbfn, 1);
cmdp->op_to_portid = htonl(FW_CMD_OP_V(FW_PORT_CMD) | cmdp->op_to_portid = htonl(FW_CMD_OP_V(FW_PORT_CMD) |
FW_CMD_REQUEST_F | FW_CMD_REQUEST_F |
(wr ? FW_CMD_EXEC_F : FW_CMD_READ_F) | (wr ? FW_CMD_EXEC_F : FW_CMD_READ_F) |
FW_PORT_CMD_PORTID(portid)); FW_PORT_CMD_PORTID_V(portid));
if (!wr) { if (!wr) {
cmdp->action_to_len16 = htonl( cmdp->action_to_len16 = htonl(
FW_PORT_CMD_ACTION(FW_PORT_ACTION_GET_PORT_INFO) | FW_PORT_CMD_ACTION_V(FW_PORT_ACTION_GET_PORT_INFO) |
FW_CMD_LEN16_V(sizeof(*cmdp) / 16)); FW_CMD_LEN16_V(sizeof(*cmdp) / 16));
return; return;
} }
/* Set port */ /* Set port */
cmdp->action_to_len16 = htonl( cmdp->action_to_len16 = htonl(
FW_PORT_CMD_ACTION(FW_PORT_ACTION_L1_CFG) | FW_PORT_CMD_ACTION_V(FW_PORT_ACTION_L1_CFG) |
FW_CMD_LEN16_V(sizeof(*cmdp) / 16)); FW_CMD_LEN16_V(sizeof(*cmdp) / 16));
if (fc & PAUSE_RX) if (fc & PAUSE_RX)
...@@ -1407,9 +1407,9 @@ csio_mb_fwevt_handler(struct csio_hw *hw, __be64 *cmd) ...@@ -1407,9 +1407,9 @@ csio_mb_fwevt_handler(struct csio_hw *hw, __be64 *cmd)
if (opcode == FW_PORT_CMD) { if (opcode == FW_PORT_CMD) {
pcmd = (struct fw_port_cmd *)cmd; pcmd = (struct fw_port_cmd *)cmd;
port_id = FW_PORT_CMD_PORTID_GET( port_id = FW_PORT_CMD_PORTID_G(
ntohl(pcmd->op_to_portid)); ntohl(pcmd->op_to_portid));
action = FW_PORT_CMD_ACTION_GET( action = FW_PORT_CMD_ACTION_G(
ntohl(pcmd->action_to_len16)); ntohl(pcmd->action_to_len16));
if (action != FW_PORT_ACTION_GET_PORT_INFO) { if (action != FW_PORT_ACTION_GET_PORT_INFO) {
csio_err(hw, "Unhandled FW_PORT_CMD action: %u\n", csio_err(hw, "Unhandled FW_PORT_CMD action: %u\n",
...@@ -1418,15 +1418,15 @@ csio_mb_fwevt_handler(struct csio_hw *hw, __be64 *cmd) ...@@ -1418,15 +1418,15 @@ csio_mb_fwevt_handler(struct csio_hw *hw, __be64 *cmd)
} }
link_status = ntohl(pcmd->u.info.lstatus_to_modtype); link_status = ntohl(pcmd->u.info.lstatus_to_modtype);
mod_type = FW_PORT_CMD_MODTYPE_GET(link_status); mod_type = FW_PORT_CMD_MODTYPE_G(link_status);
hw->pport[port_id].link_status = hw->pport[port_id].link_status =
FW_PORT_CMD_LSTATUS_GET(link_status); FW_PORT_CMD_LSTATUS_G(link_status);
hw->pport[port_id].link_speed = hw->pport[port_id].link_speed =
FW_PORT_CMD_LSPEED_GET(link_status); FW_PORT_CMD_LSPEED_G(link_status);
csio_info(hw, "Port:%x - LINK %s\n", port_id, csio_info(hw, "Port:%x - LINK %s\n", port_id,
FW_PORT_CMD_LSTATUS_GET(link_status) ? "UP" : "DOWN"); FW_PORT_CMD_LSTATUS_G(link_status) ? "UP" : "DOWN");
if (mod_type != hw->pport[port_id].mod_type) { if (mod_type != hw->pport[port_id].mod_type) {
hw->pport[port_id].mod_type = mod_type; hw->pport[port_id].mod_type = mod_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment