aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb4/cxgb4_main.c
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 /drivers/net/cxgb4/cxgb4_main.c
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>
Diffstat (limited to 'drivers/net/cxgb4/cxgb4_main.c')
-rw-r--r--drivers/net/cxgb4/cxgb4_main.c55
1 files changed, 42 insertions, 13 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;