Commit c435e6e0 authored by David S. Miller's avatar David S. Miller

Merge branch 'nfp-next'

Jakub Kicinski says:

====================
nfp: few code improvements

Three small patches for net-next.  First and second patches
improve the code quality by spelling things correctly and
removing unused parameters.  Third patch hooks-in standard
kernel implementation of .get_link() in ethtool ops.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6fde0e63 2370def2
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
#define NFP_NET_POLL_TIMEOUT 5 #define NFP_NET_POLL_TIMEOUT 5
/* Bar allocation */ /* Bar allocation */
#define NFP_NET_CRTL_BAR 0 #define NFP_NET_CTRL_BAR 0
#define NFP_NET_Q0_BAR 2 #define NFP_NET_Q0_BAR 2
#define NFP_NET_Q1_BAR 4 /* OBSOLETE */ #define NFP_NET_Q1_BAR 4 /* OBSOLETE */
......
...@@ -1845,13 +1845,14 @@ void nfp_net_coalesce_write_cfg(struct nfp_net *nn) ...@@ -1845,13 +1845,14 @@ void nfp_net_coalesce_write_cfg(struct nfp_net *nn)
} }
/** /**
* nfp_net_write_mac_addr() - Write mac address to device registers * nfp_net_write_mac_addr() - Write mac address to the device control BAR
* @nn: NFP Net device to reconfigure * @nn: NFP Net device to reconfigure
* @mac: Six-byte MAC address to be written
* *
* We do a bit of byte swapping dance because firmware is LE. * Writes the MAC address from the netdev to the device control BAR. Does not
* perform the required reconfig. We do a bit of byte swapping dance because
* firmware is LE.
*/ */
static void nfp_net_write_mac_addr(struct nfp_net *nn, const u8 *mac) static void nfp_net_write_mac_addr(struct nfp_net *nn)
{ {
nn_writel(nn, NFP_NET_CFG_MACADDR + 0, nn_writel(nn, NFP_NET_CFG_MACADDR + 0,
get_unaligned_be32(nn->netdev->dev_addr)); get_unaligned_be32(nn->netdev->dev_addr));
...@@ -1952,7 +1953,7 @@ static int __nfp_net_set_config_and_enable(struct nfp_net *nn) ...@@ -1952,7 +1953,7 @@ static int __nfp_net_set_config_and_enable(struct nfp_net *nn)
nn_writeq(nn, NFP_NET_CFG_RXRS_ENABLE, nn->num_rx_rings == 64 ? nn_writeq(nn, NFP_NET_CFG_RXRS_ENABLE, nn->num_rx_rings == 64 ?
0xffffffffffffffffULL : ((u64)1 << nn->num_rx_rings) - 1); 0xffffffffffffffffULL : ((u64)1 << nn->num_rx_rings) - 1);
nfp_net_write_mac_addr(nn, nn->netdev->dev_addr); nfp_net_write_mac_addr(nn);
nn_writel(nn, NFP_NET_CFG_MTU, nn->netdev->mtu); nn_writel(nn, NFP_NET_CFG_MTU, nn->netdev->mtu);
nn_writel(nn, NFP_NET_CFG_FLBUFSZ, nn->fl_bufsz); nn_writel(nn, NFP_NET_CFG_FLBUFSZ, nn->fl_bufsz);
...@@ -2739,7 +2740,7 @@ int nfp_net_netdev_init(struct net_device *netdev) ...@@ -2739,7 +2740,7 @@ int nfp_net_netdev_init(struct net_device *netdev)
nn->cap = nn_readl(nn, NFP_NET_CFG_CAP); nn->cap = nn_readl(nn, NFP_NET_CFG_CAP);
nn->max_mtu = nn_readl(nn, NFP_NET_CFG_MAX_MTU); nn->max_mtu = nn_readl(nn, NFP_NET_CFG_MAX_MTU);
nfp_net_write_mac_addr(nn, nn->netdev->dev_addr); nfp_net_write_mac_addr(nn);
/* Set default MTU and Freelist buffer size */ /* Set default MTU and Freelist buffer size */
if (nn->max_mtu < NFP_NET_DEFAULT_MTU) if (nn->max_mtu < NFP_NET_DEFAULT_MTU)
......
...@@ -605,6 +605,7 @@ static int nfp_net_set_coalesce(struct net_device *netdev, ...@@ -605,6 +605,7 @@ static int nfp_net_set_coalesce(struct net_device *netdev,
static const struct ethtool_ops nfp_net_ethtool_ops = { static const struct ethtool_ops nfp_net_ethtool_ops = {
.get_drvinfo = nfp_net_get_drvinfo, .get_drvinfo = nfp_net_get_drvinfo,
.get_link = ethtool_op_get_link,
.get_ringparam = nfp_net_get_ringparam, .get_ringparam = nfp_net_get_ringparam,
.set_ringparam = nfp_net_set_ringparam, .set_ringparam = nfp_net_set_ringparam,
.get_strings = nfp_net_get_strings, .get_strings = nfp_net_get_strings,
......
...@@ -124,11 +124,11 @@ static int nfp_netvf_pci_probe(struct pci_dev *pdev, ...@@ -124,11 +124,11 @@ static int nfp_netvf_pci_probe(struct pci_dev *pdev,
* first NFP_NET_CFG_BAR_SZ of the BAR. This keeps the code * first NFP_NET_CFG_BAR_SZ of the BAR. This keeps the code
* the identical for PF and VF drivers. * the identical for PF and VF drivers.
*/ */
ctrl_bar = ioremap_nocache(pci_resource_start(pdev, NFP_NET_CRTL_BAR), ctrl_bar = ioremap_nocache(pci_resource_start(pdev, NFP_NET_CTRL_BAR),
NFP_NET_CFG_BAR_SZ); NFP_NET_CFG_BAR_SZ);
if (!ctrl_bar) { if (!ctrl_bar) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Failed to map resource %d\n", NFP_NET_CRTL_BAR); "Failed to map resource %d\n", NFP_NET_CTRL_BAR);
err = -EIO; err = -EIO;
goto err_pci_regions; goto err_pci_regions;
} }
......
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