Commit 118969ed authored by Dimitris Michailidis's avatar Dimitris Michailidis Committed by David S. Miller

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: default avatarDimitris Michailidis <dm@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7d5e77aa
...@@ -3490,50 +3490,41 @@ static int __devinit init_rss(struct adapter *adap) ...@@ -3490,50 +3490,41 @@ static int __devinit init_rss(struct adapter *adap)
return 0; return 0;
} }
static void __devinit print_port_info(struct adapter *adap) static void __devinit print_port_info(const struct net_device *dev)
{ {
static const char *base[] = { static const char *base[] = {
"R XFI", "R XAUI", "T SGMII", "T XFI", "T XAUI", "KX4", "CX4", "R XFI", "R XAUI", "T SGMII", "T XFI", "T XAUI", "KX4", "CX4",
"KX", "KR", "R SFP+", "KR/KX", "KR/KX/KX4" "KX", "KR", "R SFP+", "KR/KX", "KR/KX/KX4"
}; };
int i;
char buf[80]; char buf[80];
char *bufp = buf;
const char *spd = ""; const char *spd = "";
const struct port_info *pi = netdev_priv(dev);
const struct adapter *adap = pi->adapter;
if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_2_5GB) if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_2_5GB)
spd = " 2.5 GT/s"; spd = " 2.5 GT/s";
else if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_5_0GB) else if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_5_0GB)
spd = " 5 GT/s"; spd = " 5 GT/s";
for_each_port(adap, i) { if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100M)
struct net_device *dev = adap->port[i]; bufp += sprintf(bufp, "100/");
const struct port_info *pi = netdev_priv(dev); if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_1G)
char *bufp = buf; bufp += sprintf(bufp, "1000/");
if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G)
if (!test_bit(i, &adap->registered_device_map)) bufp += sprintf(bufp, "10G/");
continue; if (bufp != buf)
--bufp;
if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100M) sprintf(bufp, "BASE-%s", base[pi->port_type]);
bufp += sprintf(bufp, "100/");
if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_1G) netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n",
bufp += sprintf(bufp, "1000/"); adap->params.vpd.id, adap->params.rev, buf,
if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) is_offload(adap) ? "R" : "", adap->params.pci.width, spd,
bufp += sprintf(bufp, "10G/"); (adap->flags & USING_MSIX) ? " MSI-X" :
if (bufp != buf) (adap->flags & USING_MSI) ? " MSI" : "");
--bufp; netdev_info(dev, "S/N: %s, E/C: %s\n",
sprintf(bufp, "BASE-%s", base[pi->port_type]); adap->params.vpd.sn, adap->params.vpd.ec);
netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n",
adap->params.vpd.id, adap->params.rev,
buf, is_offload(adap) ? "R" : "",
adap->params.pci.width, spd,
(adap->flags & USING_MSIX) ? " MSI-X" :
(adap->flags & USING_MSI) ? " MSI" : "");
if (adap->name == dev->name)
netdev_info(dev, "S/N: %s, E/C: %s\n",
adap->params.vpd.sn, adap->params.vpd.ec);
}
} }
static void __devinit enable_pcie_relaxed_ordering(struct pci_dev *dev) static void __devinit enable_pcie_relaxed_ordering(struct pci_dev *dev)
...@@ -3753,6 +3744,7 @@ static int __devinit init_one(struct pci_dev *pdev, ...@@ -3753,6 +3744,7 @@ static int __devinit init_one(struct pci_dev *pdev,
__set_bit(i, &adapter->registered_device_map); __set_bit(i, &adapter->registered_device_map);
adapter->chan_map[pi->tx_chan] = i; adapter->chan_map[pi->tx_chan] = i;
print_port_info(adapter->port[i]);
} }
} }
if (!adapter->registered_device_map) { if (!adapter->registered_device_map) {
...@@ -3769,8 +3761,6 @@ static int __devinit init_one(struct pci_dev *pdev, ...@@ -3769,8 +3761,6 @@ static int __devinit init_one(struct pci_dev *pdev,
if (is_offload(adapter)) if (is_offload(adapter))
attach_ulds(adapter); attach_ulds(adapter);
print_port_info(adapter);
sriov: sriov:
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV
if (func < ARRAY_SIZE(num_vf) && num_vf[func] > 0) if (func < ARRAY_SIZE(num_vf) && num_vf[func] > 0)
......
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