Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[deliverable/linux.git] / drivers / net / ethernet / qlogic / qede / qede_main.c
index 337e839ca586724edd7a00245ef689b7ffaf4833..423168ba7c9826d3a28cb1bad606310487203fed 100644 (file)
@@ -87,7 +87,9 @@ static const struct pci_device_id qede_pci_tbl[] = {
        {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_100), QEDE_PRIVATE_PF},
        {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_50), QEDE_PRIVATE_PF},
        {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_25), QEDE_PRIVATE_PF},
+#ifdef CONFIG_QED_SRIOV
        {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_IOV), QEDE_PRIVATE_VF},
+#endif
        { 0 }
 };
 
@@ -577,8 +579,6 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb,
 
        /* Fill the parsing flags & params according to the requested offload */
        if (xmit_type & XMIT_L4_CSUM) {
-               u16 temp = 1 << ETH_TX_DATA_1ST_BD_TUNN_CFG_OVERRIDE_SHIFT;
-
                /* We don't re-calculate IP checksum as it is already done by
                 * the upper stack
                 */
@@ -588,14 +588,8 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb,
                if (xmit_type & XMIT_ENC) {
                        first_bd->data.bd_flags.bitfields |=
                                1 << ETH_TX_1ST_BD_FLAGS_IP_CSUM_SHIFT;
-               } else {
-                       /* In cases when OS doesn't indicate for inner offloads
-                        * when packet is tunnelled, we need to override the HW
-                        * tunnel configuration so that packets are treated as
-                        * regular non tunnelled packets and no inner offloads
-                        * are done by the hardware.
-                        */
-                       first_bd->data.bitfields |= cpu_to_le16(temp);
+                       first_bd->data.bitfields |=
+                           1 << ETH_TX_DATA_1ST_BD_TUNN_FLAG_SHIFT;
                }
 
                /* If the packet is IPv6 with extension header, indicate that
@@ -653,6 +647,10 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb,
                        tx_data_bd = (struct eth_tx_bd *)third_bd;
                        data_split = true;
                }
+       } else {
+               first_bd->data.bitfields |=
+                   (skb->len & ETH_TX_DATA_1ST_BD_PKT_LEN_MASK) <<
+                   ETH_TX_DATA_1ST_BD_PKT_LEN_SHIFT;
        }
 
        /* Handle fragmented skb */
@@ -1824,7 +1822,7 @@ static int qede_set_vf_rate(struct net_device *dev, int vfidx,
 {
        struct qede_dev *edev = netdev_priv(dev);
 
-       return edev->ops->iov->set_rate(edev->cdev, vfidx, max_tx_rate,
+       return edev->ops->iov->set_rate(edev->cdev, vfidx, min_tx_rate,
                                        max_tx_rate);
 }
 
@@ -2091,6 +2089,29 @@ static void qede_vlan_mark_nonconfigured(struct qede_dev *edev)
        edev->accept_any_vlan = false;
 }
 
+int qede_set_features(struct net_device *dev, netdev_features_t features)
+{
+       struct qede_dev *edev = netdev_priv(dev);
+       netdev_features_t changes = features ^ dev->features;
+       bool need_reload = false;
+
+       /* No action needed if hardware GRO is disabled during driver load */
+       if (changes & NETIF_F_GRO) {
+               if (dev->features & NETIF_F_GRO)
+                       need_reload = !edev->gro_disable;
+               else
+                       need_reload = edev->gro_disable;
+       }
+
+       if (need_reload && netif_running(edev->ndev)) {
+               dev->features = features;
+               qede_reload(edev, NULL, NULL);
+               return 1;
+       }
+
+       return 0;
+}
+
 #ifdef CONFIG_QEDE_VXLAN
 static void qede_add_vxlan_port(struct net_device *dev,
                                sa_family_t sa_family, __be16 port)
@@ -2175,6 +2196,7 @@ static const struct net_device_ops qede_netdev_ops = {
 #endif
        .ndo_vlan_rx_add_vid = qede_vlan_rx_add_vid,
        .ndo_vlan_rx_kill_vid = qede_vlan_rx_kill_vid,
+       .ndo_set_features = qede_set_features,
        .ndo_get_stats64 = qede_get_stats64,
 #ifdef CONFIG_QED_SRIOV
        .ndo_set_vf_link_state = qede_set_vf_link_state,
@@ -2479,6 +2501,10 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
 
        edev->ops->register_ops(cdev, &qede_ll_ops, edev);
 
+#ifdef CONFIG_DCB
+       qede_set_dcbnl_ops(edev->ndev);
+#endif
+
        INIT_DELAYED_WORK(&edev->sp_task, qede_sp_task);
        mutex_init(&edev->qede_lock);
 
@@ -2797,6 +2823,7 @@ static int qede_alloc_mem_rxq(struct qede_dev *edev,
        rc = edev->ops->common->chain_alloc(edev->cdev,
                                            QED_CHAIN_USE_TO_CONSUME_PRODUCE,
                                            QED_CHAIN_MODE_NEXT_PTR,
+                                           QED_CHAIN_CNT_TYPE_U16,
                                            RX_RING_SIZE,
                                            sizeof(struct eth_rx_bd),
                                            &rxq->rx_bd_ring);
@@ -2808,6 +2835,7 @@ static int qede_alloc_mem_rxq(struct qede_dev *edev,
        rc = edev->ops->common->chain_alloc(edev->cdev,
                                            QED_CHAIN_USE_TO_CONSUME,
                                            QED_CHAIN_MODE_PBL,
+                                           QED_CHAIN_CNT_TYPE_U16,
                                            RX_RING_SIZE,
                                            sizeof(union eth_rx_cqe),
                                            &rxq->rx_comp_ring);
@@ -2859,9 +2887,9 @@ static int qede_alloc_mem_txq(struct qede_dev *edev,
        rc = edev->ops->common->chain_alloc(edev->cdev,
                                            QED_CHAIN_USE_TO_CONSUME_PRODUCE,
                                            QED_CHAIN_MODE_PBL,
+                                           QED_CHAIN_CNT_TYPE_U16,
                                            NUM_TX_BDS_MAX,
-                                           sizeof(*p_virt),
-                                           &txq->tx_pbl);
+                                           sizeof(*p_virt), &txq->tx_pbl);
        if (rc)
                goto err;
 
This page took 0.027958 seconds and 5 git commands to generate.