aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitris Michailidis <dm@chelsio.com>2010-06-18 06:05:34 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-19 01:08:38 -0400
commita0881cab6c0a1c8ad48a4ab0b971c8e786dadf1c (patch)
tree88e650f83b9a02946fd4298afbc47e5c35aff060
parent91e9a1ec91243391e6f8f24ff4c5fbd4dfd67292 (diff)
cxgb4: update FW definitions
Update to latest FW API. Most changes here pertain to port types and querying FW for parameter values. Signed-off-by: Dimitris Michailidis <dm@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/cxgb4/cxgb4_main.c55
-rw-r--r--drivers/net/cxgb4/cxgb4_uld.h2
-rw-r--r--drivers/net/cxgb4/t4_hw.c6
-rw-r--r--drivers/net/cxgb4/t4fw_api.h34
4 files changed, 73 insertions, 24 deletions
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index eb1492f4df2d..352c77090123 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -216,7 +216,7 @@ void t4_os_link_changed(struct adapter *adapter, int port_id, int link_stat)
216void t4_os_portmod_changed(const struct adapter *adap, int port_id) 216void t4_os_portmod_changed(const struct adapter *adap, int port_id)
217{ 217{
218 static const char *mod_str[] = { 218 static const char *mod_str[] = {
219 NULL, "LR", "SR", "ER", "passive DA", "active DA" 219 NULL, "LR", "SR", "ER", "passive DA", "active DA", "LRM"
220 }; 220 };
221 221
222 const struct net_device *dev = adap->port[port_id]; 222 const struct net_device *dev = adap->port[port_id];
@@ -224,7 +224,7 @@ void t4_os_portmod_changed(const struct adapter *adap, int port_id)
224 224
225 if (pi->mod_type == FW_PORT_MOD_TYPE_NONE) 225 if (pi->mod_type == FW_PORT_MOD_TYPE_NONE)
226 netdev_info(dev, "port module unplugged\n"); 226 netdev_info(dev, "port module unplugged\n");
227 else 227 else if (pi->mod_type < ARRAY_SIZE(mod_str))
228 netdev_info(dev, "%s module inserted\n", mod_str[pi->mod_type]); 228 netdev_info(dev, "%s module inserted\n", mod_str[pi->mod_type]);
229} 229}
230 230
@@ -1234,7 +1234,8 @@ static unsigned int from_fw_linkcaps(unsigned int type, unsigned int caps)
1234{ 1234{
1235 unsigned int v = 0; 1235 unsigned int v = 0;
1236 1236
1237 if (type == FW_PORT_TYPE_BT_SGMII || type == FW_PORT_TYPE_BT_XAUI) { 1237 if (type == FW_PORT_TYPE_BT_SGMII || type == FW_PORT_TYPE_BT_XFI ||
1238 type == FW_PORT_TYPE_BT_XAUI) {
1238 v |= SUPPORTED_TP; 1239 v |= SUPPORTED_TP;
1239 if (caps & FW_PORT_CAP_SPEED_100M) 1240 if (caps & FW_PORT_CAP_SPEED_100M)
1240 v |= SUPPORTED_100baseT_Full; 1241 v |= SUPPORTED_100baseT_Full;
@@ -1250,7 +1251,10 @@ static unsigned int from_fw_linkcaps(unsigned int type, unsigned int caps)
1250 v |= SUPPORTED_10000baseKX4_Full; 1251 v |= SUPPORTED_10000baseKX4_Full;
1251 } else if (type == FW_PORT_TYPE_KR) 1252 } else if (type == FW_PORT_TYPE_KR)
1252 v |= SUPPORTED_Backplane | SUPPORTED_10000baseKR_Full; 1253 v |= SUPPORTED_Backplane | SUPPORTED_10000baseKR_Full;
1253 else if (type == FW_PORT_TYPE_FIBER) 1254 else if (type == FW_PORT_TYPE_BP_AP)
1255 v |= SUPPORTED_Backplane | SUPPORTED_10000baseR_FEC;
1256 else if (type == FW_PORT_TYPE_FIBER_XFI ||
1257 type == FW_PORT_TYPE_FIBER_XAUI || type == FW_PORT_TYPE_SFP)
1254 v |= SUPPORTED_FIBRE; 1258 v |= SUPPORTED_FIBRE;
1255 1259
1256 if (caps & FW_PORT_CAP_ANEG) 1260 if (caps & FW_PORT_CAP_ANEG)
@@ -1276,13 +1280,19 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1276 const struct port_info *p = netdev_priv(dev); 1280 const struct port_info *p = netdev_priv(dev);
1277 1281
1278 if (p->port_type == FW_PORT_TYPE_BT_SGMII || 1282 if (p->port_type == FW_PORT_TYPE_BT_SGMII ||
1283 p->port_type == FW_PORT_TYPE_BT_XFI ||
1279 p->port_type == FW_PORT_TYPE_BT_XAUI) 1284 p->port_type == FW_PORT_TYPE_BT_XAUI)
1280 cmd->port = PORT_TP; 1285 cmd->port = PORT_TP;
1281 else if (p->port_type == FW_PORT_TYPE_FIBER) 1286 else if (p->port_type == FW_PORT_TYPE_FIBER_XFI ||
1287 p->port_type == FW_PORT_TYPE_FIBER_XAUI)
1282 cmd->port = PORT_FIBRE; 1288 cmd->port = PORT_FIBRE;
1283 else if (p->port_type == FW_PORT_TYPE_TWINAX) 1289 else if (p->port_type == FW_PORT_TYPE_SFP) {
1284 cmd->port = PORT_DA; 1290 if (p->mod_type == FW_PORT_MOD_TYPE_TWINAX_PASSIVE ||
1285 else 1291 p->mod_type == FW_PORT_MOD_TYPE_TWINAX_ACTIVE)
1292 cmd->port = PORT_DA;
1293 else
1294 cmd->port = PORT_FIBRE;
1295 } else
1286 cmd->port = PORT_OTHER; 1296 cmd->port = PORT_OTHER;
1287 1297
1288 if (p->mdio_addr >= 0) { 1298 if (p->mdio_addr >= 0) {
@@ -2814,14 +2824,20 @@ static int adap_init0(struct adapter *adap)
2814 for (v = 1; v < SGE_NCOUNTERS; v++) 2824 for (v = 1; v < SGE_NCOUNTERS; v++)
2815 adap->sge.counter_val[v] = min(intr_cnt[v - 1], 2825 adap->sge.counter_val[v] = min(intr_cnt[v - 1],
2816 THRESHOLD_3_MASK); 2826 THRESHOLD_3_MASK);
2817 ret = adap_init1(adap, &c);
2818 if (ret < 0)
2819 goto bye;
2820
2821#define FW_PARAM_DEV(param) \ 2827#define FW_PARAM_DEV(param) \
2822 (FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | \ 2828 (FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | \
2823 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param)) 2829 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param))
2824 2830
2831 params[0] = FW_PARAM_DEV(CCLK);
2832 ret = t4_query_params(adap, 0, 0, 0, 1, params, val);
2833 if (ret < 0)
2834 goto bye;
2835 adap->params.vpd.cclk = val[0];
2836
2837 ret = adap_init1(adap, &c);
2838 if (ret < 0)
2839 goto bye;
2840
2825#define FW_PARAM_PFVF(param) \ 2841#define FW_PARAM_PFVF(param) \
2826 (FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) | \ 2842 (FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) | \
2827 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param)) 2843 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param))
@@ -2874,6 +2890,18 @@ static int adap_init0(struct adapter *adap)
2874 adap->vres.rq.size = val[3] - val[2] + 1; 2890 adap->vres.rq.size = val[3] - val[2] + 1;
2875 adap->vres.pbl.start = val[4]; 2891 adap->vres.pbl.start = val[4];
2876 adap->vres.pbl.size = val[5] - val[4] + 1; 2892 adap->vres.pbl.size = val[5] - val[4] + 1;
2893
2894 params[0] = FW_PARAM_PFVF(SQRQ_START);
2895 params[1] = FW_PARAM_PFVF(SQRQ_END);
2896 params[2] = FW_PARAM_PFVF(CQ_START);
2897 params[3] = FW_PARAM_PFVF(CQ_END);
2898 ret = t4_query_params(adap, 0, 0, 0, 4, params, val);
2899 if (ret < 0)
2900 goto bye;
2901 adap->vres.qp.start = val[0];
2902 adap->vres.qp.size = val[1] - val[0] + 1;
2903 adap->vres.cq.start = val[2];
2904 adap->vres.cq.size = val[3] - val[2] + 1;
2877 } 2905 }
2878 if (c.iscsicaps) { 2906 if (c.iscsicaps) {
2879 params[0] = FW_PARAM_PFVF(ISCSI_START); 2907 params[0] = FW_PARAM_PFVF(ISCSI_START);
@@ -3194,7 +3222,8 @@ static int __devinit enable_msix(struct adapter *adap)
3194static void __devinit print_port_info(struct adapter *adap) 3222static void __devinit print_port_info(struct adapter *adap)
3195{ 3223{
3196 static const char *base[] = { 3224 static const char *base[] = {
3197 "R", "KX4", "T", "KX", "T", "KR", "CX4" 3225 "R XFI", "R XAUI", "T SGMII", "T XFI", "T XAUI", "KX4", "CX4",
3226 "KX", "KR", "KR SFP+", "KR FEC"
3198 }; 3227 };
3199 3228
3200 int i; 3229 int i;
diff --git a/drivers/net/cxgb4/cxgb4_uld.h b/drivers/net/cxgb4/cxgb4_uld.h
index 5b98546ac92d..0dc0866df1bf 100644
--- a/drivers/net/cxgb4/cxgb4_uld.h
+++ b/drivers/net/cxgb4/cxgb4_uld.h
@@ -185,6 +185,8 @@ struct cxgb4_virt_res { /* virtualized HW resources */
185 struct cxgb4_range stag; 185 struct cxgb4_range stag;
186 struct cxgb4_range rq; 186 struct cxgb4_range rq;
187 struct cxgb4_range pbl; 187 struct cxgb4_range pbl;
188 struct cxgb4_range qp;
189 struct cxgb4_range cq;
188}; 190};
189 191
190/* 192/*
diff --git a/drivers/net/cxgb4/t4_hw.c b/drivers/net/cxgb4/t4_hw.c
index 5c058ea36cd9..d92129b6c140 100644
--- a/drivers/net/cxgb4/t4_hw.c
+++ b/drivers/net/cxgb4/t4_hw.c
@@ -2580,7 +2580,7 @@ int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
2580 } 2580 }
2581 if (rss_size) 2581 if (rss_size)
2582 *rss_size = FW_VI_CMD_RSSSIZE_GET(ntohs(c.rsssize_pkd)); 2582 *rss_size = FW_VI_CMD_RSSSIZE_GET(ntohs(c.rsssize_pkd));
2583 return ntohs(c.viid_pkd); 2583 return FW_VI_CMD_VIID_GET(ntohs(c.type_viid));
2584} 2584}
2585 2585
2586/** 2586/**
@@ -2603,7 +2603,7 @@ int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf,
2603 FW_CMD_EXEC | FW_VI_CMD_PFN(pf) | 2603 FW_CMD_EXEC | FW_VI_CMD_PFN(pf) |
2604 FW_VI_CMD_VFN(vf)); 2604 FW_VI_CMD_VFN(vf));
2605 c.alloc_to_len16 = htonl(FW_VI_CMD_FREE | FW_LEN16(c)); 2605 c.alloc_to_len16 = htonl(FW_VI_CMD_FREE | FW_LEN16(c));
2606 c.viid_pkd = htons(FW_VI_CMD_VIID(viid)); 2606 c.type_viid = htons(FW_VI_CMD_VIID(viid));
2607 return t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); 2607 return t4_wr_mbox(adap, mbox, &c, sizeof(c), &c);
2608} 2608}
2609 2609
@@ -3169,7 +3169,7 @@ int __devinit t4_port_init(struct adapter *adap, int mbox, int pf, int vf)
3169 p->mdio_addr = (ret & FW_PORT_CMD_MDIOCAP) ? 3169 p->mdio_addr = (ret & FW_PORT_CMD_MDIOCAP) ?
3170 FW_PORT_CMD_MDIOADDR_GET(ret) : -1; 3170 FW_PORT_CMD_MDIOADDR_GET(ret) : -1;
3171 p->port_type = FW_PORT_CMD_PTYPE_GET(ret); 3171 p->port_type = FW_PORT_CMD_PTYPE_GET(ret);
3172 p->mod_type = FW_PORT_CMD_MODTYPE_GET(ret); 3172 p->mod_type = FW_PORT_MOD_TYPE_NA;
3173 3173
3174 init_link_config(&p->link_cfg, ntohs(c.u.info.pcap)); 3174 init_link_config(&p->link_cfg, ntohs(c.u.info.pcap));
3175 j++; 3175 j++;
diff --git a/drivers/net/cxgb4/t4fw_api.h b/drivers/net/cxgb4/t4fw_api.h
index 63991d68950e..111c2a5763e4 100644
--- a/drivers/net/cxgb4/t4fw_api.h
+++ b/drivers/net/cxgb4/t4fw_api.h
@@ -475,7 +475,13 @@ enum fw_params_param_pfvf {
475 FW_PARAMS_PARAM_PFVF_PBL_END = 0x12, 475 FW_PARAMS_PARAM_PFVF_PBL_END = 0x12,
476 FW_PARAMS_PARAM_PFVF_L2T_START = 0x13, 476 FW_PARAMS_PARAM_PFVF_L2T_START = 0x13,
477 FW_PARAMS_PARAM_PFVF_L2T_END = 0x14, 477 FW_PARAMS_PARAM_PFVF_L2T_END = 0x14,
478 FW_PARAMS_PARAM_PFVF_SQRQ_START = 0x15,
479 FW_PARAMS_PARAM_PFVF_SQRQ_END = 0x16,
480 FW_PARAMS_PARAM_PFVF_CQ_START = 0x17,
481 FW_PARAMS_PARAM_PFVF_CQ_END = 0x18,
478 FW_PARAMS_PARAM_PFVF_SCHEDCLASS_ETH = 0x20, 482 FW_PARAMS_PARAM_PFVF_SCHEDCLASS_ETH = 0x20,
483 FW_PARAMS_PARAM_PFVF_VIID = 0x24,
484 FW_PARAMS_PARAM_PFVF_CPMASK = 0x25,
479}; 485};
480 486
481/* 487/*
@@ -804,16 +810,16 @@ struct fw_eq_ofld_cmd {
804struct fw_vi_cmd { 810struct fw_vi_cmd {
805 __be32 op_to_vfn; 811 __be32 op_to_vfn;
806 __be32 alloc_to_len16; 812 __be32 alloc_to_len16;
807 __be16 viid_pkd; 813 __be16 type_viid;
808 u8 mac[6]; 814 u8 mac[6];
809 u8 portid_pkd; 815 u8 portid_pkd;
810 u8 nmac; 816 u8 nmac;
811 u8 nmac0[6]; 817 u8 nmac0[6];
812 __be16 rsssize_pkd; 818 __be16 rsssize_pkd;
813 u8 nmac1[6]; 819 u8 nmac1[6];
814 __be16 r7; 820 __be16 idsiiq_pkd;
815 u8 nmac2[6]; 821 u8 nmac2[6];
816 __be16 r8; 822 __be16 idseiq_pkd;
817 u8 nmac3[6]; 823 u8 nmac3[6];
818 __be64 r9; 824 __be64 r9;
819 __be64 r10; 825 __be64 r10;
@@ -824,6 +830,7 @@ struct fw_vi_cmd {
824#define FW_VI_CMD_ALLOC (1U << 31) 830#define FW_VI_CMD_ALLOC (1U << 31)
825#define FW_VI_CMD_FREE (1U << 30) 831#define FW_VI_CMD_FREE (1U << 30)
826#define FW_VI_CMD_VIID(x) ((x) << 0) 832#define FW_VI_CMD_VIID(x) ((x) << 0)
833#define FW_VI_CMD_VIID_GET(x) ((x) & 0xfff)
827#define FW_VI_CMD_PORTID(x) ((x) << 4) 834#define FW_VI_CMD_PORTID(x) ((x) << 4)
828#define FW_VI_CMD_RSSSIZE_GET(x) (((x) >> 0) & 0x7ff) 835#define FW_VI_CMD_RSSSIZE_GET(x) (((x) >> 0) & 0x7ff)
829 836
@@ -1136,6 +1143,11 @@ struct fw_port_cmd {
1136 __be32 lstatus_to_modtype; 1143 __be32 lstatus_to_modtype;
1137 __be16 pcap; 1144 __be16 pcap;
1138 __be16 acap; 1145 __be16 acap;
1146 __be16 mtu;
1147 __u8 cbllen;
1148 __u8 r9;
1149 __be32 r10;
1150 __be64 r11;
1139 } info; 1151 } info;
1140 struct fw_port_ppp { 1152 struct fw_port_ppp {
1141 __be32 pppen_to_ncsich; 1153 __be32 pppen_to_ncsich;
@@ -1196,14 +1208,17 @@ struct fw_port_cmd {
1196#define FW_PORT_CMD_NCSICH(x) ((x) << 4) 1208#define FW_PORT_CMD_NCSICH(x) ((x) << 4)
1197 1209
1198enum fw_port_type { 1210enum fw_port_type {
1199 FW_PORT_TYPE_FIBER, 1211 FW_PORT_TYPE_FIBER_XFI,
1200 FW_PORT_TYPE_KX4, 1212 FW_PORT_TYPE_FIBER_XAUI,
1201 FW_PORT_TYPE_BT_SGMII, 1213 FW_PORT_TYPE_BT_SGMII,
1202 FW_PORT_TYPE_KX, 1214 FW_PORT_TYPE_BT_XFI,
1203 FW_PORT_TYPE_BT_XAUI, 1215 FW_PORT_TYPE_BT_XAUI,
1204 FW_PORT_TYPE_KR, 1216 FW_PORT_TYPE_KX4,
1205 FW_PORT_TYPE_CX4, 1217 FW_PORT_TYPE_CX4,
1206 FW_PORT_TYPE_TWINAX, 1218 FW_PORT_TYPE_KX,
1219 FW_PORT_TYPE_KR,
1220 FW_PORT_TYPE_SFP,
1221 FW_PORT_TYPE_BP_AP,
1207 1222
1208 FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_MASK 1223 FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_MASK
1209}; 1224};
@@ -1213,6 +1228,9 @@ enum fw_port_module_type {
1213 FW_PORT_MOD_TYPE_LR, 1228 FW_PORT_MOD_TYPE_LR,
1214 FW_PORT_MOD_TYPE_SR, 1229 FW_PORT_MOD_TYPE_SR,
1215 FW_PORT_MOD_TYPE_ER, 1230 FW_PORT_MOD_TYPE_ER,
1231 FW_PORT_MOD_TYPE_TWINAX_PASSIVE,
1232 FW_PORT_MOD_TYPE_TWINAX_ACTIVE,
1233 FW_PORT_MOD_TYPE_LRM,
1216 1234
1217 FW_PORT_MOD_TYPE_NONE = FW_PORT_CMD_MODTYPE_MASK 1235 FW_PORT_MOD_TYPE_NONE = FW_PORT_CMD_MODTYPE_MASK
1218}; 1236};