Re: [ewg] [PATCH] RDMA/nes: Backport for RHEL-6.2

2012-07-12 Thread Vladimir Sokolovsky

On 07/13/2012 12:09 AM, Tatyana Nikolova wrote:

Backport for linux-3.5 nes to RHEL-6.2

Signed-off-by: Tatyana Nikolova 
---
  drivers/infiniband/hw/nes/nes_cm.c  |8 --
  drivers/infiniband/hw/nes/nes_nic.c |   45 +-
  2 files changed, 12 insertions(+), 41 deletions(-)



Hi Tatyana,
The idea of the compat-rdma is to have one directory with backport patches for 
all
supported kernels/Distros using compat headers and LINUX_VERSION_CODE and 
KERNEL_VERSION
macros.
See the "patches" directory under compat-rdma.

Please update your patches accordingly.

Regards,
Vladimir


diff --git a/drivers/infiniband/hw/nes/nes_cm.c 
b/drivers/infiniband/hw/nes/nes_cm.c
index 020e95c..68dbf10 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -1339,13 +1339,15 @@ static inline int mini_cm_accelerated(struct 
nes_cm_core *cm_core,
  static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int 
arpindex)
  {
struct rtable *rt;
+   struct flowi fl;
struct neighbour *neigh;
int rc = arpindex;
struct net_device *netdev;
struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter;

-   rt = ip_route_output(&init_net, htonl(dst_ip), 0, 0, 0);
-   if (IS_ERR(rt)) {
+   memset(&fl, 0, sizeof fl);
+   fl.nl_u.ip4_u.daddr = htonl(dst_ip);
+   if (ip_route_output_key(&init_net, &rt, &fl)) {
printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n",
   __func__, dst_ip);
return rc;
@@ -1356,7 +1358,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic 
*nesvnic, u32 dst_ip, int arpi
else
netdev = nesvnic->netdev;

-   neigh = dst_neigh_lookup(&rt->dst, &dst_ip);
+   neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, netdev);

rcu_read_lock();
if (neigh) {
diff --git a/drivers/infiniband/hw/nes/nes_nic.c 
b/drivers/infiniband/hw/nes/nes_nic.c
index f3a3ecf..d2d9e6f 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -909,7 +909,7 @@ static void nes_netdev_set_multicast_list(struct net_device 
*netdev)
if (!mc_all_on) {
char *addrs;
int i;
-   struct netdev_hw_addr *ha;
+   struct dev_mc_list *mcaddr;

addrs = kmalloc(ETH_ALEN * mc_count, GFP_ATOMIC);
if (!addrs) {
@@ -917,8 +917,8 @@ static void nes_netdev_set_multicast_list(struct net_device 
*netdev)
goto unlock;
}
i = 0;
-   netdev_for_each_mc_addr(ha, netdev)
-   memcpy(get_addr(addrs, i++), ha->addr, ETH_ALEN);
+   netdev_for_each_mc_addr(mcaddr, netdev)
+   memcpy(get_addr(addrs, i++), mcaddr->dmi_addr, 
ETH_ALEN);

perfect_filter_register_address = NES_IDX_PERFECT_FILTER_LOW +
pft_entries_preallocated * 0x8;
@@ -1610,32 +1610,6 @@ static void nes_vlan_mode(struct net_device *netdev, 
struct nes_device *nesdev,
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
  }

-static netdev_features_t nes_fix_features(struct net_device *netdev, 
netdev_features_t features)
-{
-   /*
-* 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;
-   else
-   features &= ~NETIF_F_HW_VLAN_TX;
-
-   return features;
-}
-
-static int nes_set_features(struct net_device *netdev, netdev_features_t 
features)
-{
-   struct nes_vnic *nesvnic = netdev_priv(netdev);
-   struct nes_device *nesdev = nesvnic->nesdev;
-   u32 changed = netdev->features ^ features;
-
-   if (changed & NETIF_F_HW_VLAN_RX)
-   nes_vlan_mode(netdev, nesdev, features);
-
-   return 0;
-}
-
  static const struct net_device_ops nes_netdev_ops = {
.ndo_open   = nes_netdev_open,
.ndo_stop   = nes_netdev_stop,
@@ -1646,8 +1620,6 @@ 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,
-   .ndo_fix_features   = nes_fix_features,
-   .ndo_set_features   = nes_set_features,
  };

  /**
@@ -1711,13 +1683,10 @@ struct net_device *nes_netdev_init(struct nes_device 
*nesdev,
netdev->dev_addr[5] = (u8)u64temp;
memcpy(netdev->perm_addr, netdev->dev_addr, 6);

-   netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_IP_CSUM |
- NETIF_F_HW_VLAN_RX;
-   if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != 
NE020_REV))
-

[ewg] [PATCH] RDMA/nes: Backport for RHEL-6.2

2012-07-12 Thread Tatyana Nikolova
Backport for linux-3.5 nes to RHEL-6.2

Signed-off-by: Tatyana Nikolova 
---
 drivers/infiniband/hw/nes/nes_cm.c  |8 --
 drivers/infiniband/hw/nes/nes_nic.c |   45 +-
 2 files changed, 12 insertions(+), 41 deletions(-)

diff --git a/drivers/infiniband/hw/nes/nes_cm.c 
b/drivers/infiniband/hw/nes/nes_cm.c
index 020e95c..68dbf10 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -1339,13 +1339,15 @@ static inline int mini_cm_accelerated(struct 
nes_cm_core *cm_core,
 static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int 
arpindex)
 {
struct rtable *rt;
+   struct flowi fl;
struct neighbour *neigh;
int rc = arpindex;
struct net_device *netdev;
struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter;
 
-   rt = ip_route_output(&init_net, htonl(dst_ip), 0, 0, 0);
-   if (IS_ERR(rt)) {
+   memset(&fl, 0, sizeof fl);
+   fl.nl_u.ip4_u.daddr = htonl(dst_ip);
+   if (ip_route_output_key(&init_net, &rt, &fl)) {
printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n",
   __func__, dst_ip);
return rc;
@@ -1356,7 +1358,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic 
*nesvnic, u32 dst_ip, int arpi
else
netdev = nesvnic->netdev;
 
-   neigh = dst_neigh_lookup(&rt->dst, &dst_ip);
+   neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, netdev);
 
rcu_read_lock();
if (neigh) {
diff --git a/drivers/infiniband/hw/nes/nes_nic.c 
b/drivers/infiniband/hw/nes/nes_nic.c
index f3a3ecf..d2d9e6f 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -909,7 +909,7 @@ static void nes_netdev_set_multicast_list(struct net_device 
*netdev)
if (!mc_all_on) {
char *addrs;
int i;
-   struct netdev_hw_addr *ha;
+   struct dev_mc_list *mcaddr;
 
addrs = kmalloc(ETH_ALEN * mc_count, GFP_ATOMIC);
if (!addrs) {
@@ -917,8 +917,8 @@ static void nes_netdev_set_multicast_list(struct net_device 
*netdev)
goto unlock;
}
i = 0;
-   netdev_for_each_mc_addr(ha, netdev)
-   memcpy(get_addr(addrs, i++), ha->addr, ETH_ALEN);
+   netdev_for_each_mc_addr(mcaddr, netdev)
+   memcpy(get_addr(addrs, i++), mcaddr->dmi_addr, 
ETH_ALEN);
 
perfect_filter_register_address = NES_IDX_PERFECT_FILTER_LOW +
pft_entries_preallocated * 0x8;
@@ -1610,32 +1610,6 @@ static void nes_vlan_mode(struct net_device *netdev, 
struct nes_device *nesdev,
spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
 }
 
-static netdev_features_t nes_fix_features(struct net_device *netdev, 
netdev_features_t features)
-{
-   /*
-* 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;
-   else
-   features &= ~NETIF_F_HW_VLAN_TX;
-
-   return features;
-}
-
-static int nes_set_features(struct net_device *netdev, netdev_features_t 
features)
-{
-   struct nes_vnic *nesvnic = netdev_priv(netdev);
-   struct nes_device *nesdev = nesvnic->nesdev;
-   u32 changed = netdev->features ^ features;
-
-   if (changed & NETIF_F_HW_VLAN_RX)
-   nes_vlan_mode(netdev, nesdev, features);
-
-   return 0;
-}
-
 static const struct net_device_ops nes_netdev_ops = {
.ndo_open   = nes_netdev_open,
.ndo_stop   = nes_netdev_stop,
@@ -1646,8 +1620,6 @@ 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,
-   .ndo_fix_features   = nes_fix_features,
-   .ndo_set_features   = nes_set_features,
 };
 
 /**
@@ -1711,13 +1683,10 @@ struct net_device *nes_netdev_init(struct nes_device 
*nesdev,
netdev->dev_addr[5] = (u8)u64temp;
memcpy(netdev->perm_addr, netdev->dev_addr, 6);
 
-   netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_IP_CSUM |
- NETIF_F_HW_VLAN_RX;
-   if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != 
NE020_REV))
-   netdev->hw_features |= NETIF_F_TSO;
-   netdev->features |= netdev->hw_features;
-   netdev->hw_features |= NETIF_F_LRO;
-
+   netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
+   if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != 
NE020_REV)) {
+   netdev->features |= NETIF_F_TSO | NETIF_F_GSO;
+