]> git.openfabrics.org - ~emulex/compat-rdma.git/commitdiff
Backports for nes and iwpm - OFED-3.18
authorTatyana E. Nikolova <tatyana.e.nikolova@intel.com>
Thu, 30 Oct 2014 21:01:44 +0000 (14:01 -0700)
committerTatyana E. Nikolova <tatyana.e.nikolova@intel.com>
Thu, 30 Oct 2014 21:01:44 +0000 (14:01 -0700)
patches/0012-BACKPORT-rdma-nes.patch [new file with mode: 0644]
patches/0013-BACKPORT-rdma-iwpm.patch [new file with mode: 0644]

diff --git a/patches/0012-BACKPORT-rdma-nes.patch b/patches/0012-BACKPORT-rdma-nes.patch
new file mode 100644 (file)
index 0000000..9cf1846
--- /dev/null
@@ -0,0 +1,349 @@
+Subject: [PATCH] RDMA/nes: Backports for OFED-3.18
+
+Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
+---
+ drivers/infiniband/hw/nes/nes.c     |  4 ++
+ drivers/infiniband/hw/nes/nes_cm.c  | 14 +++++-
+ drivers/infiniband/hw/nes/nes_hw.c  | 28 +++++++++--
+ drivers/infiniband/hw/nes/nes_hw.h  |  6 +++
+ drivers/infiniband/hw/nes/nes_nic.c | 96 ++++++++++++++++++++++++++++++++++---
+ 5 files changed, 137 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/infiniband/hw/nes/nes.c
++++ b/drivers/infiniband/hw/nes/nes.c
+@@ -146,7 +146,11 @@ static int nes_inetaddr_event(struct notifier_block *notifier,
+                               nesdev, nesdev->netdev[0]->name);
+               netdev = nesdev->netdev[0];
+               nesvnic = netdev_priv(netdev);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
+               upper_dev = netdev_master_upper_dev_get(netdev);
++#else
++              upper_dev = netdev->master;
++#endif
+               is_bonded = netif_is_bond_slave(netdev) &&
+                           (upper_dev == event_netdev);
+               if ((netdev == event_netdev) || is_bonded) {
+diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/infiniband/hw/nes/nes_cm.c
++++ b/drivers/infiniband/hw/nes/nes_cm.c
+@@ -1331,16 +1331,28 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi
+       int rc = arpindex;
+       struct net_device *netdev;
+       struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
++      struct flowi fl;
++      memset(&fl, 0, sizeof fl);
++      fl.nl_u.ip4_u.daddr = htonl(dst_ip);
++      if (ip_route_output_key(&init_net, &rt, &fl)) {
++#else
+       rt = ip_route_output(&init_net, htonl(dst_ip), 0, 0, 0);
+       if (IS_ERR(rt)) {
++#endif
+               printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n",
+                      __func__, dst_ip);
+               return rc;
+       }
+-      if (netif_is_bond_slave(nesvnic->netdev))
++      if (netif_is_bond_slave(nesvnic->netdev)) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
+               netdev = netdev_master_upper_dev_get(nesvnic->netdev);
++#else
++              netdev = nesvnic->netdev->master;
++#endif
++      }
+       else
+               netdev = nesvnic->netdev;
+diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/infiniband/hw/nes/nes_hw.c
++++ b/drivers/infiniband/hw/nes/nes_hw.c
+@@ -2909,7 +2909,11 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq)
+                                       if ((cqe_errv &
+                                                       (NES_NIC_ERRV_BITS_IPV4_CSUM_ERR | NES_NIC_ERRV_BITS_TCPUDP_CSUM_ERR |
+                                                       NES_NIC_ERRV_BITS_IPH_ERR | NES_NIC_ERRV_BITS_WQE_OVERRUN)) == 0) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
++                                              if (nesvnic->rx_checksum_disabled == 0)
++#else
+                                               if (nesvnic->netdev->features & NETIF_F_RXCSUM)
++#endif
+                                                       rx_skb->ip_summed = CHECKSUM_UNNECESSARY;
+                                       } else
+                                               nes_debug(NES_DBG_CQ, "%s: unsuccessfully checksummed TCP or UDP packet."
+@@ -2920,11 +2924,12 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq)
+                                       if ((cqe_errv &
+                                                       (NES_NIC_ERRV_BITS_IPV4_CSUM_ERR | NES_NIC_ERRV_BITS_IPH_ERR |
+                                                       NES_NIC_ERRV_BITS_WQE_OVERRUN)) == 0) {
+-                                              if (nesvnic->netdev->features & NETIF_F_RXCSUM) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
++                                              if (nesvnic->rx_checksum_disabled == 0)
++#else
++                                              if (nesvnic->netdev->features & NETIF_F_RXCSUM)
++#endif
+                                                       rx_skb->ip_summed = CHECKSUM_UNNECESSARY;
+-                                                      /* nes_debug(NES_DBG_CQ, "%s: Reporting successfully checksummed IPv4 packet.\n",
+-                                                                nesvnic->netdev->name); */
+-                                              }
+                                       } else
+                                               nes_debug(NES_DBG_CQ, "%s: unsuccessfully checksummed TCP or UDP packet."
+                                                               " errv = 0x%X, pkt_type = 0x%X.\n",
+@@ -2948,7 +2953,22 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq)
+                                       nes_debug(NES_DBG_CQ, "%s: Reporting stripped VLAN packet. Tag = 0x%04X\n",
+                                                       nesvnic->netdev->name, vlan_tag);
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
++                                      if (nesvnic->vlan_grp != NULL) {
++                                              if (nes_use_lro)
++                                                      lro_vlan_hwaccel_receive_skb(&nesvnic->lro_mgr, rx_skb,
++                                                              nesvnic->vlan_grp, vlan_tag, NULL);
++                                              else
++                                                      vlan_hwaccel_receive_skb(rx_skb, nesvnic->vlan_grp, vlan_tag);
++                                              goto skip_rx_indicate0;
++                                      }
++#endif
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
++                                      __vlan_hwaccel_put_tag(rx_skb, vlan_tag);
++#else
+                                       __vlan_hwaccel_put_tag(rx_skb, htons(ETH_P_8021Q), vlan_tag);
++#endif
+                               }
+                               if (nes_use_lro)
+                                       lro_receive_skb(&nesvnic->lro_mgr, rx_skb, NULL);
+diff --git a/drivers/infiniband/hw/nes/nes_hw.h b/drivers/infiniband/hw/nes/nes_hw.h
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/infiniband/hw/nes/nes_hw.h
++++ b/drivers/infiniband/hw/nes/nes_hw.h
+@@ -1269,6 +1269,12 @@ struct nes_vnic {
+       u8  next_qp_nic_index;
+       u8  of_device_registered;
+       u8  rdma_enabled;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
++      struct vlan_group *vlan_grp;
++#endif
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
++      u8  rx_checksum_disabled;
++#endif
+       u32 lro_max_aggr;
+       struct net_lro_mgr lro_mgr;
+       struct net_lro_desc lro_desc[NES_MAX_LRO_DESCRIPTORS];
+diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/infiniband/hw/nes/nes_nic.c
++++ b/drivers/infiniband/hw/nes/nes_nic.c
+@@ -904,16 +904,24 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev)
+       if (!mc_all_on) {
+               char *addrs;
+               int i;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
+               struct netdev_hw_addr *ha;
+-
++#else
++              struct dev_mc_list *mcaddr;
++#endif
+               addrs = kmalloc(ETH_ALEN * mc_count, GFP_ATOMIC);
+               if (!addrs) {
+                       set_allmulti(nesdev, nic_active_bit);
+                       goto unlock;
+               }
+               i = 0;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
+               netdev_for_each_mc_addr(ha, netdev)
+                       memcpy(get_addr(addrs, i++), ha->addr, ETH_ALEN);
++#else
++              netdev_for_each_mc_addr(mcaddr, netdev)
++                      memcpy(get_addr(addrs, i++), mcaddr->dmi_addr, ETH_ALEN);
++#endif
+               perfect_filter_register_address = NES_IDX_PERFECT_FILTER_LOW +
+                                               pft_entries_preallocated * 0x8;
+@@ -1572,6 +1580,34 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd
+       return 0;
+ }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
++/**
++ * nes_netdev_get_rx_csum
++ */
++static u32 nes_netdev_get_rx_csum (struct net_device *netdev)
++{
++      struct nes_vnic *nesvnic = netdev_priv(netdev);
++
++      if (nesvnic->rx_checksum_disabled)
++              return 0;
++      else
++              return 1;
++}
++
++/**
++ * nes_netdev_set_rc_csum
++ */
++static int nes_netdev_set_rx_csum(struct net_device *netdev, u32 enable)
++{
++      struct nes_vnic *nesvnic = netdev_priv(netdev);
++
++      if (enable)
++              nesvnic->rx_checksum_disabled = 0;
++      else
++              nesvnic->rx_checksum_disabled = 1;
++      return 0;
++}
++#endif
+ static const struct ethtool_ops nes_ethtool_ops = {
+       .get_link = ethtool_op_get_link,
+@@ -1585,8 +1621,46 @@ static const struct ethtool_ops nes_ethtool_ops = {
+       .set_coalesce = nes_netdev_set_coalesce,
+       .get_pauseparam = nes_netdev_get_pauseparam,
+       .set_pauseparam = nes_netdev_set_pauseparam,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
++      .get_tx_csum = ethtool_op_get_tx_csum,
++      .set_tx_csum = ethtool_op_set_tx_csum,
++      .get_rx_csum = nes_netdev_get_rx_csum,
++      .set_rx_csum = nes_netdev_set_rx_csum,
++      .get_sg = ethtool_op_get_sg,
++      .set_sg = ethtool_op_set_sg,
++      .get_tso = ethtool_op_get_tso,
++      .set_tso = ethtool_op_set_tso,
++      .get_flags = ethtool_op_get_flags,
++      .set_flags = ethtool_op_set_flags
++#endif
+ };
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
++static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
++{
++      struct nes_vnic *nesvnic = netdev_priv(netdev);
++      struct nes_device *nesdev = nesvnic->nesdev;
++      struct nes_adapter *nesadapter = nesdev->nesadapter;
++      u32 u32temp;
++      unsigned long flags;
++
++      spin_lock_irqsave(&nesadapter->phy_lock, flags);
++      nesvnic->vlan_grp = grp;
++
++      nes_debug(NES_DBG_NETDEV, "%s: %s\n", __func__, netdev->name);
++
++      /* Enable/Disable VLAN Stripping */
++      u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG);
++      if (grp)
++              u32temp &= 0xfdffffff;
++      else
++              u32temp |= 0x02000000;
++
++      nes_write_indexed(nesdev, NES_IDX_PCIX_DIAG, u32temp);
++      spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
++}
++#endif
++
+ static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev, netdev_features_t features)
+ {
+       struct nes_adapter *nesadapter = nesdev->nesadapter;
+@@ -1608,6 +1682,7 @@ static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev,
+       spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
+ }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
+ static netdev_features_t nes_fix_features(struct net_device *netdev, netdev_features_t features)
+ {
+       /*
+@@ -1633,6 +1708,7 @@ static int nes_set_features(struct net_device *netdev, netdev_features_t feature
+       return 0;
+ }
++#endif
+ static const struct net_device_ops nes_netdev_ops = {
+       .ndo_open               = nes_netdev_open,
+@@ -1644,8 +1720,13 @@ static const struct net_device_ops nes_netdev_ops = {
+       .ndo_set_rx_mode        = nes_netdev_set_multicast_list,
+       .ndo_change_mtu         = nes_netdev_change_mtu,
+       .ndo_validate_addr      = eth_validate_addr,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
+       .ndo_fix_features       = nes_fix_features,
+       .ndo_set_features       = nes_set_features,
++#endif
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
++      .ndo_vlan_rx_register   = nes_netdev_vlan_rx_register,
++#endif
+ };
+ /**
+@@ -1706,12 +1787,15 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
+       netdev->dev_addr[4] = (u8)(u64temp>>8);
+       netdev->dev_addr[5] = (u8)u64temp;
+-      netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX;
+-      if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV))
+-              netdev->hw_features |= NETIF_F_TSO;
++      netdev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX;
++
++      if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV)) 
++              netdev->features |= NETIF_F_TSO;
+-      netdev->features = netdev->hw_features | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX;
+-      netdev->hw_features |= NETIF_F_LRO;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
++      netdev->hw_features |= netdev->features | NETIF_F_LRO;
++#endif
++      netdev->features |= NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX;
+       nes_debug(NES_DBG_INIT, "nesvnic = %p, reported features = 0x%lX, QPid = %d,"
+                       " nic_index = %d, logical_port = %d, mac_index = %d.\n",
+diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
+index 02120d3..4eb5cf8 100644
+--- a/drivers/infiniband/hw/nes/nes_hw.c
++++ b/drivers/infiniband/hw/nes/nes_hw.c
+@@ -1003,9 +1003,14 @@ int nes_init_cqp(struct nes_device *nesdev)
+                       (sizeof(struct nes_hw_aeqe) * nesadapter->max_qp) +
+                       sizeof(struct nes_hw_cqp_qp_context);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0))
+       nesdev->cqp_vbase = pci_zalloc_consistent(nesdev->pcidev,
+                                                 nesdev->cqp_mem_size,
+                                                 &nesdev->cqp_pbase);
++#else
++      nesdev->cqp_vbase = pci_alloc_consistent(nesdev->pcidev, nesdev->cqp_mem_size,
++                      &nesdev->cqp_pbase);
++#endif
+       if (!nesdev->cqp_vbase) {
+               nes_debug(NES_DBG_INIT, "Unable to allocate memory for host descriptor rings\n");
+               return -ENOMEM;
+@@ -1691,9 +1696,14 @@ int nes_init_nic_qp(struct nes_device *nesdev, struct net_device *netdev)
+                       (NES_NIC_WQ_SIZE * 2 * sizeof(struct nes_hw_nic_cqe)) +
+                       sizeof(struct nes_hw_nic_qp_context);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0))
+       nesvnic->nic_vbase = pci_zalloc_consistent(nesdev->pcidev,
+                                                  nesvnic->nic_mem_size,
+                                                  &nesvnic->nic_pbase);
++#else
++      nesvnic->nic_vbase = pci_alloc_consistent(nesdev->pcidev, nesvnic->nic_mem_size,
++                      &nesvnic->nic_pbase);
++#endif
+       if (!nesvnic->nic_vbase) {
+               nes_debug(NES_DBG_INIT, "Unable to allocate memory for NIC host descriptor rings\n");
+               return -ENOMEM;
+diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
+index fef067c..a077703 100644
+--- a/drivers/infiniband/hw/nes/nes_verbs.c
++++ b/drivers/infiniband/hw/nes/nes_verbs.c
+@@ -1616,8 +1616,13 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
+                               entries, nescq->cq_mem_size, nescq->hw_cq.cq_number);
+               /* allocate the physical buffer space */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0))
+               mem = pci_zalloc_consistent(nesdev->pcidev, nescq->cq_mem_size,
+                                           &nescq->hw_cq.cq_pbase);
++#else
++              mem = pci_alloc_consistent(nesdev->pcidev, nescq->cq_mem_size,
++                      &nescq->hw_cq.cq_pbase);
++#endif
+               if (!mem) {
+                       printk(KERN_ERR PFX "Unable to allocate pci memory for cq\n");
+                       nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
diff --git a/patches/0013-BACKPORT-rdma-iwpm.patch b/patches/0013-BACKPORT-rdma-iwpm.patch
new file mode 100644 (file)
index 0000000..bb7a9bc
--- /dev/null
@@ -0,0 +1,87 @@
+Subject: [PATCH] RDMA/iwpm: Backports for OFED-3.18
+
+Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
+---
+ drivers/infiniband/core/iwpm_util.c |   26 ++++++++++++++++++++++++--
+ 1 files changed, 24 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
+index 69e9f84..5e01389 100644
+--- a/drivers/infiniband/core/iwpm_util.c
++++ b/drivers/infiniband/core/iwpm_util.c
+@@ -131,6 +131,9 @@ int iwpm_remove_mapinfo(struct sockaddr_storage *local_sockaddr,
+       struct hlist_node *tmp_hlist_node;
+       struct hlist_head *hash_bucket_head;
+       struct iwpm_mapping_info *map_info = NULL;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
++      struct hlist_node *node;
++#endif
+       unsigned long flags;
+       int ret = -EINVAL;
+@@ -139,9 +142,13 @@ int iwpm_remove_mapinfo(struct sockaddr_storage *local_sockaddr,
+               hash_bucket_head = get_hash_bucket_head(
+                                       local_sockaddr,
+                                       mapped_local_addr);
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
++              hlist_for_each_entry_safe(map_info, node, tmp_hlist_node,
++                                      hash_bucket_head, hlist_node) {
++#else
+               hlist_for_each_entry_safe(map_info, tmp_hlist_node,
+                                       hash_bucket_head, hlist_node) {
+-
++#endif
+                       if (!iwpm_compare_sockaddr(&map_info->mapped_sockaddr,
+                                               mapped_local_addr)) {
+@@ -161,15 +168,22 @@ static void free_hash_bucket(void)
+ {
+       struct hlist_node *tmp_hlist_node;
+       struct iwpm_mapping_info *map_info;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
++      struct hlist_node *node;
++#endif
+       unsigned long flags;
+       int i;
+       /* remove all the mapinfo data from the list */
+       spin_lock_irqsave(&iwpm_mapinfo_lock, flags);
+       for (i = 0; i < IWPM_HASH_BUCKET_SIZE; i++) {
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
++              hlist_for_each_entry_safe(map_info, node, tmp_hlist_node,
++                      &iwpm_hash_bucket[i], hlist_node) {
++#else
+               hlist_for_each_entry_safe(map_info, tmp_hlist_node,
+                       &iwpm_hash_bucket[i], hlist_node) {
+-
++#endif
+                               hlist_del_init(&map_info->hlist_node);
+                               kfree(map_info);
+                       }
+@@ -498,6 +512,9 @@ int iwpm_send_mapinfo(u8 nl_client, int iwpm_pid)
+       struct iwpm_mapping_info *map_info;
+       struct sk_buff *skb = NULL;
+       struct nlmsghdr *nlh;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
++      struct hlist_node *node;
++#endif
+       int skb_num = 0, mapping_num = 0;
+       int i = 0, nlmsg_bytes = 0;
+       unsigned long flags;
+@@ -513,8 +530,13 @@ int iwpm_send_mapinfo(u8 nl_client, int iwpm_pid)
+       skb_num++;
+       spin_lock_irqsave(&iwpm_mapinfo_lock, flags);
+       for (i = 0; i < IWPM_HASH_BUCKET_SIZE; i++) {
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
++              hlist_for_each_entry(map_info, node,
++                      &iwpm_hash_bucket[i], hlist_node) {
++#else
+               hlist_for_each_entry(map_info, &iwpm_hash_bucket[i],
+                                    hlist_node) {
++#endif
+                       if (map_info->nl_client != nl_client)
+                               continue;
+                       nlh = NULL;
+-- 
+1.7.1
+