Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / drivers / net / ethernet / chelsio / cxgb3 / cxgb3_main.c
index f15ee326d5c19414563b30abbb66ba780fd59b00..71497e835f4258bedc82896e12ead2a71778902d 100644 (file)
@@ -29,6 +29,9 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
@@ -153,7 +156,7 @@ struct workqueue_struct *cxgb3_wq;
 static void link_report(struct net_device *dev)
 {
        if (!netif_carrier_ok(dev))
-               printk(KERN_INFO "%s: link down\n", dev->name);
+               netdev_info(dev, "link down\n");
        else {
                const char *s = "10Mbps";
                const struct port_info *p = netdev_priv(dev);
@@ -170,8 +173,9 @@ static void link_report(struct net_device *dev)
                        break;
                }
 
-               printk(KERN_INFO "%s: link up, %s, %s-duplex\n", dev->name, s,
-                      p->link_config.duplex == DUPLEX_FULL ? "full" : "half");
+               netdev_info(dev, "link up, %s, %s-duplex\n",
+                           s, p->link_config.duplex == DUPLEX_FULL
+                           ? "full" : "half");
        }
 }
 
@@ -318,10 +322,10 @@ void t3_os_phymod_changed(struct adapter *adap, int port_id)
        const struct port_info *pi = netdev_priv(dev);
 
        if (pi->phy.modtype == phy_modtype_none)
-               printk(KERN_INFO "%s: PHY module unplugged\n", dev->name);
+               netdev_info(dev, "PHY module unplugged\n");
        else
-               printk(KERN_INFO "%s: %s PHY module inserted\n", dev->name,
-                      mod_str[pi->phy.modtype]);
+               netdev_info(dev, "%s PHY module inserted\n",
+                           mod_str[pi->phy.modtype]);
 }
 
 static void cxgb_set_rxmode(struct net_device *dev)
@@ -1177,14 +1181,15 @@ static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features)
 
        if (adapter->params.rev > 0) {
                t3_set_vlan_accel(adapter, 1 << pi->port_id,
-                                 features & NETIF_F_HW_VLAN_RX);
+                                 features & NETIF_F_HW_VLAN_CTAG_RX);
        } else {
                /* single control for all ports */
-               unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX;
+               unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_CTAG_RX;
 
                for_each_port(adapter, i)
                        have_vlans |=
-                               adapter->port[i]->features & NETIF_F_HW_VLAN_RX;
+                               adapter->port[i]->features &
+                               NETIF_F_HW_VLAN_CTAG_RX;
 
                t3_set_vlan_accel(adapter, 1, have_vlans);
        }
@@ -1422,8 +1427,7 @@ static int cxgb_open(struct net_device *dev)
        if (is_offload(adapter) && !ofld_disable) {
                err = offload_open(dev);
                if (err)
-                       printk(KERN_WARNING
-                              "Could not initialize offload capabilities\n");
+                       pr_warn("Could not initialize offload capabilities\n");
        }
 
        netif_set_real_num_tx_queues(dev, pi->nqsets);
@@ -2560,10 +2564,10 @@ static netdev_features_t cxgb_fix_features(struct net_device *dev,
         * Since there is no support for separate rx/tx vlan accel
         * enable/disable make sure tx flag is always in same state as rx.
         */
-       if (features & NETIF_F_HW_VLAN_RX)
-               features |= NETIF_F_HW_VLAN_TX;
+       if (features & NETIF_F_HW_VLAN_CTAG_RX)
+               features |= NETIF_F_HW_VLAN_CTAG_TX;
        else
-               features &= ~NETIF_F_HW_VLAN_TX;
+               features &= ~NETIF_F_HW_VLAN_CTAG_TX;
 
        return features;
 }
@@ -2572,7 +2576,7 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features)
 {
        netdev_features_t changed = dev->features ^ features;
 
-       if (changed & NETIF_F_HW_VLAN_RX)
+       if (changed & NETIF_F_HW_VLAN_CTAG_RX)
                cxgb_vlan_mode(dev, features);
 
        return 0;
@@ -3132,14 +3136,13 @@ static void print_port_info(struct adapter *adap, const struct adapter_info *ai)
 
                if (!test_bit(i, &adap->registered_device_map))
                        continue;
-               printk(KERN_INFO "%s: %s %s %sNIC (rev %d) %s%s\n",
-                      dev->name, ai->desc, pi->phy.desc,
-                      is_offload(adap) ? "R" : "", adap->params.rev, buf,
-                      (adap->flags & USING_MSIX) ? " MSI-X" :
-                      (adap->flags & USING_MSI) ? " MSI" : "");
+               netdev_info(dev, "%s %s %sNIC (rev %d) %s%s\n",
+                           ai->desc, pi->phy.desc,
+                           is_offload(adap) ? "R" : "", adap->params.rev, buf,
+                           (adap->flags & USING_MSIX) ? " MSI-X" :
+                           (adap->flags & USING_MSI) ? " MSI" : "");
                if (adap->name == dev->name && adap->params.vpd.mclk)
-                       printk(KERN_INFO
-                              "%s: %uMB CM, %uMB PMTX, %uMB PMRX, S/N: %s\n",
+                       pr_info("%s: %uMB CM, %uMB PMTX, %uMB PMRX, S/N: %s\n",
                               adap->name, t3_mc7_size(&adap->cm) >> 20,
                               t3_mc7_size(&adap->pmtx) >> 20,
                               t3_mc7_size(&adap->pmrx) >> 20,
@@ -3177,24 +3180,18 @@ static void cxgb3_init_iscsi_mac(struct net_device *dev)
                        NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA)
 static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
-       static int version_printed;
-
        int i, err, pci_using_dac = 0;
        resource_size_t mmio_start, mmio_len;
        const struct adapter_info *ai;
        struct adapter *adapter = NULL;
        struct port_info *pi;
 
-       if (!version_printed) {
-               printk(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION);
-               ++version_printed;
-       }
+       pr_info_once("%s - version %s\n", DRV_DESC, DRV_VERSION);
 
        if (!cxgb3_wq) {
                cxgb3_wq = create_singlethread_workqueue(DRV_NAME);
                if (!cxgb3_wq) {
-                       printk(KERN_ERR DRV_NAME
-                              ": cannot initialize work queue\n");
+                       pr_err("cannot initialize work queue\n");
                        return -ENOMEM;
                }
        }
@@ -3292,8 +3289,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                netdev->mem_start = mmio_start;
                netdev->mem_end = mmio_start + mmio_len - 1;
                netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
-                       NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX;
-               netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_TX;
+                       NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX;
+               netdev->features |= netdev->hw_features |
+                                   NETIF_F_HW_VLAN_CTAG_TX;
                netdev->vlan_features |= netdev->features & VLAN_FEAT;
                if (pci_using_dac)
                        netdev->features |= NETIF_F_HIGHDMA;