aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb4
diff options
context:
space:
mode:
authorDimitris Michailidis <dm@chelsio.com>2010-12-14 16:36:48 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-16 16:16:01 -0500
commit118969ed21b6895045b0a5a8a32feac1c9341096 (patch)
tree2901197d1105edea93cf72c6e71b34d74f0609eb /drivers/net/cxgb4
parent7d5e77aafa39f3210b6273a44fe07508e837c3cb (diff)
cxgb4: print port information after registering each netdev
Print information about each port when its netdev is registered instead of looping separately over the ports at the end. The bulk of this patch is due to indentation change. Signed-off-by: Dimitris Michailidis <dm@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb4')
-rw-r--r--drivers/net/cxgb4/cxgb4_main.c54
1 files changed, 22 insertions, 32 deletions
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index 3f33d515f62e..089b753b8a2f 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -3490,50 +3490,41 @@ static int __devinit init_rss(struct adapter *adap)
3490 return 0; 3490 return 0;
3491} 3491}
3492 3492
3493static void __devinit print_port_info(struct adapter *adap) 3493static void __devinit print_port_info(const struct net_device *dev)
3494{ 3494{
3495 static const char *base[] = { 3495 static const char *base[] = {
3496 "R XFI", "R XAUI", "T SGMII", "T XFI", "T XAUI", "KX4", "CX4", 3496 "R XFI", "R XAUI", "T SGMII", "T XFI", "T XAUI", "KX4", "CX4",
3497 "KX", "KR", "R SFP+", "KR/KX", "KR/KX/KX4" 3497 "KX", "KR", "R SFP+", "KR/KX", "KR/KX/KX4"
3498 }; 3498 };
3499 3499
3500 int i;
3501 char buf[80]; 3500 char buf[80];
3501 char *bufp = buf;
3502 const char *spd = ""; 3502 const char *spd = "";
3503 const struct port_info *pi = netdev_priv(dev);
3504 const struct adapter *adap = pi->adapter;
3503 3505
3504 if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_2_5GB) 3506 if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_2_5GB)
3505 spd = " 2.5 GT/s"; 3507 spd = " 2.5 GT/s";
3506 else if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_5_0GB) 3508 else if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_5_0GB)
3507 spd = " 5 GT/s"; 3509 spd = " 5 GT/s";
3508 3510
3509 for_each_port(adap, i) { 3511 if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100M)
3510 struct net_device *dev = adap->port[i]; 3512 bufp += sprintf(bufp, "100/");
3511 const struct port_info *pi = netdev_priv(dev); 3513 if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_1G)
3512 char *bufp = buf; 3514 bufp += sprintf(bufp, "1000/");
3513 3515 if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G)
3514 if (!test_bit(i, &adap->registered_device_map)) 3516 bufp += sprintf(bufp, "10G/");
3515 continue; 3517 if (bufp != buf)
3516 3518 --bufp;
3517 if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100M) 3519 sprintf(bufp, "BASE-%s", base[pi->port_type]);
3518 bufp += sprintf(bufp, "100/"); 3520
3519 if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_1G) 3521 netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n",
3520 bufp += sprintf(bufp, "1000/"); 3522 adap->params.vpd.id, adap->params.rev, buf,
3521 if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) 3523 is_offload(adap) ? "R" : "", adap->params.pci.width, spd,
3522 bufp += sprintf(bufp, "10G/"); 3524 (adap->flags & USING_MSIX) ? " MSI-X" :
3523 if (bufp != buf) 3525 (adap->flags & USING_MSI) ? " MSI" : "");
3524 --bufp; 3526 netdev_info(dev, "S/N: %s, E/C: %s\n",
3525 sprintf(bufp, "BASE-%s", base[pi->port_type]); 3527 adap->params.vpd.sn, adap->params.vpd.ec);
3526
3527 netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n",
3528 adap->params.vpd.id, adap->params.rev,
3529 buf, is_offload(adap) ? "R" : "",
3530 adap->params.pci.width, spd,
3531 (adap->flags & USING_MSIX) ? " MSI-X" :
3532 (adap->flags & USING_MSI) ? " MSI" : "");
3533 if (adap->name == dev->name)
3534 netdev_info(dev, "S/N: %s, E/C: %s\n",
3535 adap->params.vpd.sn, adap->params.vpd.ec);
3536 }
3537} 3528}
3538 3529
3539static void __devinit enable_pcie_relaxed_ordering(struct pci_dev *dev) 3530static void __devinit enable_pcie_relaxed_ordering(struct pci_dev *dev)
@@ -3753,6 +3744,7 @@ static int __devinit init_one(struct pci_dev *pdev,
3753 3744
3754 __set_bit(i, &adapter->registered_device_map); 3745 __set_bit(i, &adapter->registered_device_map);
3755 adapter->chan_map[pi->tx_chan] = i; 3746 adapter->chan_map[pi->tx_chan] = i;
3747 print_port_info(adapter->port[i]);
3756 } 3748 }
3757 } 3749 }
3758 if (!adapter->registered_device_map) { 3750 if (!adapter->registered_device_map) {
@@ -3769,8 +3761,6 @@ static int __devinit init_one(struct pci_dev *pdev,
3769 if (is_offload(adapter)) 3761 if (is_offload(adapter))
3770 attach_ulds(adapter); 3762 attach_ulds(adapter);
3771 3763
3772 print_port_info(adapter);
3773
3774sriov: 3764sriov:
3775#ifdef CONFIG_PCI_IOV 3765#ifdef CONFIG_PCI_IOV
3776 if (func < ARRAY_SIZE(num_vf) && num_vf[func] > 0) 3766 if (func < ARRAY_SIZE(num_vf) && num_vf[func] > 0)