--- /dev/null
+From: Steve Wise <swise@opengridcomputing.com>
+Subject: [PATCH] BACKPORT: cxgb3
+
+Signed-off-by: Steve Wise <swise@opengridcomputing.com>
+---
+ drivers/infiniband/hw/cxgb3/iwch.h | 16 +++
+ drivers/infiniband/hw/cxgb3/iwch_cm.c | 31 ++++++
+ drivers/net/ethernet/chelsio/cxgb3/adapter.h | 6 +
+ drivers/net/ethernet/chelsio/cxgb3/common.h | 3 +
+ drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 105 +++++++++++++++++++-
+ drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c | 36 +++++++
+ drivers/net/ethernet/chelsio/cxgb3/l2t.c | 6 +
+ drivers/net/ethernet/chelsio/cxgb3/sge.c | 17 +++
+ drivers/net/ethernet/chelsio/cxgb3/xgmac.c | 18 +++-
+ 9 files changed, 236 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/infiniband/hw/cxgb3/iwch.h b/drivers/infiniband/hw/cxgb3/iwch.h
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/infiniband/hw/cxgb3/iwch.h
++++ b/drivers/infiniband/hw/cxgb3/iwch.h
+@@ -154,6 +154,7 @@ static inline int insert_handle(struct iwch_dev *rhp, struct idr *idr,
+ {
+ int ret;
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+ idr_preload(GFP_KERNEL);
+ spin_lock_irq(&rhp->lock);
+
+@@ -164,6 +165,21 @@ static inline int insert_handle(struct iwch_dev *rhp, struct idr *idr,
+
+ BUG_ON(ret == -ENOSPC);
+ return ret < 0 ? ret : 0;
++#else
++ int newid;
++
++ do {
++ if (!idr_pre_get(idr, GFP_KERNEL)) {
++ return -ENOMEM;
++ }
++ spin_lock_irq(&rhp->lock);
++ ret = idr_get_new_above(idr, handle, id, &newid);
++ BUG_ON(newid != id);
++ spin_unlock_irq(&rhp->lock);
++ } while (ret == -EAGAIN);
++
++ return ret;
++#endif
+ }
+
+ static inline void remove_handle(struct iwch_dev *rhp, struct idr *idr, u32 id)
+diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
++++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
+@@ -337,12 +337,33 @@ static struct rtable *find_route(struct t3cdev *dev, __be32 local_ip,
+ __be16 peer_port, u8 tos)
+ {
+ struct rtable *rt;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+ struct flowi4 fl4;
+
+ rt = ip_route_output_ports(&init_net, &fl4, NULL, peer_ip, local_ip,
+ peer_port, local_port, IPPROTO_TCP,
+ tos, 0);
+ if (IS_ERR(rt))
++#else
++ struct flowi fl = {
++ .oif = 0,
++ .nl_u = {
++ .ip4_u = {
++ .daddr = peer_ip,
++ .saddr = local_ip,
++ .tos = tos
++ }
++ },
++ .proto = IPPROTO_TCP,
++ .uli_u = {
++ .ports = {
++ .sport = local_port,
++ .dport = peer_port
++ }
++ }
++ };
++ if (ip_route_output_flow(&init_net, &rt, &fl, NULL, false))
++#endif
+ return NULL;
+ return rt;
+ }
+@@ -1377,7 +1398,12 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
+ __func__);
+ goto reject;
+ }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+ dst = &rt->dst;
++#else
++ dst = &rt->u.dst;
++#endif
++
+ l2t = t3_l2t_get(tdev, dst, NULL, &req->peer_ip);
+ if (!l2t) {
+ printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n",
+@@ -1950,7 +1976,12 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
+ err = -EHOSTUNREACH;
+ goto fail3;
+ }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
+ ep->dst = &rt->dst;
++#else
++ ep->dst = &rt->u.dst;
++#endif
++
+ ep->l2t = t3_l2t_get(ep->com.tdev, ep->dst, NULL,
+ &raddr->sin_addr.s_addr);
+ if (!ep->l2t) {
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/adapter.h b/drivers/net/ethernet/chelsio/cxgb3/adapter.h
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/net/ethernet/chelsio/cxgb3/adapter.h
++++ b/drivers/net/ethernet/chelsio/cxgb3/adapter.h
+@@ -65,6 +65,9 @@ struct iscsi_config {
+
+ struct port_info {
+ struct adapter *adapter;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0)
++ struct vlan_group *vlan_grp;
++#endif
+ struct sge_qset *qs;
+ u8 port_id;
+ u8 nqsets;
+@@ -204,6 +207,9 @@ struct sge_qset { /* an SGE queue set */
+ struct sge_fl fl[SGE_RXQ_PER_SET];
+ struct sge_txq txq[SGE_TXQ_PER_SET];
+ int nomem;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++ int lro_enabled;
++#endif
+ void *lro_va;
+ struct net_device *netdev;
+ struct netdev_queue *tx_q; /* associated netdev TX queue */
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/common.h b/drivers/net/ethernet/chelsio/cxgb3/common.h
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/net/ethernet/chelsio/cxgb3/common.h
++++ b/drivers/net/ethernet/chelsio/cxgb3/common.h
+@@ -315,6 +315,9 @@ struct tp_params {
+
+ struct qset_params { /* SGE queue set parameters */
+ unsigned int polling; /* polling/interrupt service for rspq */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++ unsigned int lro; /* large receive offload */
++#endif
+ unsigned int coalesce_usecs; /* irq coalescing timer */
+ unsigned int rspq_size; /* # of entries in response queue */
+ unsigned int fl_size; /* # of entries in regular free list */
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
++++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+@@ -647,6 +647,28 @@ static void enable_all_napi(struct adapter *adap)
+ napi_enable(&adap->sge.qs[i].napi);
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++/**
++ * set_qset_lro - Turn a queue set's LRO capability on and off
++ * @dev: the device the qset is attached to
++ * @qset_idx: the queue set index
++ * @val: the LRO switch
++ *
++ * Sets LRO on or off for a particular queue set.
++ * the device's features flag is updated to reflect the LRO
++ * capability when all queues belonging to the device are
++ * in the same state.
++ */
++static void set_qset_lro(struct net_device *dev, int qset_idx, int val)
++{
++ struct port_info *pi = netdev_priv(dev);
++ struct adapter *adapter = pi->adapter;
++
++ adapter->params.sge.qset[qset_idx].lro = !!val;
++ adapter->sge.qs[qset_idx].lro_enabled = !!val;
++}
++#endif
++
+ /**
+ * setup_sge_qsets - configure SGE Tx/Rx/response queues
+ * @adap: the adapter
+@@ -1174,6 +1196,7 @@ static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p)
+ }
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
+ static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features)
+ {
+ struct port_info *pi = netdev_priv(dev);
+@@ -1195,6 +1218,26 @@ static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features)
+ }
+ t3_synchronize_rx(adapter, pi);
+ }
++#else
++static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
++{
++ struct port_info *pi = netdev_priv(dev);
++ struct adapter *adapter = pi->adapter;
++
++ pi->vlan_grp = grp;
++ if (adapter->params.rev > 0)
++ t3_set_vlan_accel(adapter, 1 << pi->port_id, grp != NULL);
++ else {
++ /* single control for all ports */
++ unsigned int i, have_vlans = 0;
++ for_each_port(adapter, i)
++ have_vlans |= adap2pinfo(adapter, i)->vlan_grp != NULL;
++
++ t3_set_vlan_accel(adapter, 1, have_vlans);
++ }
++ t3_synchronize_rx(adapter, pi);
++}
++#endif
+
+ /**
+ * cxgb_up - enable the adapter
+@@ -1208,7 +1251,7 @@ static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features)
+ */
+ static int cxgb_up(struct adapter *adap)
+ {
+- int i, err;
++ int err;
+
+ if (!(adap->flags & FULL_INIT_DONE)) {
+ err = t3_check_fw_version(adap);
+@@ -1245,8 +1288,13 @@ static int cxgb_up(struct adapter *adap)
+ if (err)
+ goto out;
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
++{
++ int i;
+ for_each_port(adap, i)
+ cxgb_vlan_mode(adap->port[i], adap->port[i]->features);
++}
++#endif
+
+ setup_rss(adap);
+ if (!(adap->flags & NAPI_INIT))
+@@ -1775,6 +1823,7 @@ static int restart_autoneg(struct net_device *dev)
+ return 0;
+ }
+
++#ifdef HAVE_SET_PHYS_ID
+ static int set_phys_id(struct net_device *dev,
+ enum ethtool_phys_id_state state)
+ {
+@@ -1797,6 +1846,7 @@ static int set_phys_id(struct net_device *dev,
+
+ return 0;
+ }
++#endif
+
+ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+ {
+@@ -2110,7 +2160,9 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
+ .set_pauseparam = set_pauseparam,
+ .get_link = ethtool_op_get_link,
+ .get_strings = get_strings,
++#ifdef HAVE_SET_PHYS_ID
+ .set_phys_id = set_phys_id,
++#endif
+ .nway_reset = restart_autoneg,
+ .get_sset_count = get_sset_count,
+ .get_ethtool_stats = get_stats,
+@@ -2225,6 +2277,7 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
+ }
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+ if (t.lro >= 0) {
+ if (t.lro)
+ dev->wanted_features |= NETIF_F_GRO;
+@@ -2232,6 +2285,10 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
+ dev->wanted_features &= ~NETIF_F_GRO;
+ netdev_update_features(dev);
+ }
++#else
++ if (t.lro >= 0)
++ set_qset_lro(dev, t.qset_idx, t.lro);
++#endif
+
+ break;
+ }
+@@ -2557,6 +2614,7 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p)
+ return 0;
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
+ static netdev_features_t cxgb_fix_features(struct net_device *dev,
+ netdev_features_t features)
+ {
+@@ -2581,6 +2639,7 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features)
+
+ return 0;
+ }
++#endif
+
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+ static void cxgb_netpoll(struct net_device *dev)
+@@ -3094,10 +3153,30 @@ static int cxgb_enable_msix(struct adapter *adap)
+ for (i = 0; i < vectors; ++i)
+ entries[i].entry = i;
+
++#ifdef HAVE_PCI_ENABLE_MSIX_RANGE
+ vectors = pci_enable_msix_range(adap->pdev, entries,
+ adap->params.nports + 1, vectors);
+ if (vectors < 0)
+ return vectors;
++#else
++{
++ int err;
++
++ while ((err = pci_enable_msix(adap->pdev, entries, vectors)) > 0)
++ vectors = err;
++
++ if (err < 0) {
++ pci_disable_msix(adap->pdev);
++ return err;
++ }
++
++ if (!err && vectors < (adap->params.nports + 1)) {
++ pci_disable_msix(adap->pdev);
++ err = -1;
++ return err;
++ }
++}
++#endif
+
+ for (i = 0; i < vectors; ++i)
+ adap->msix_info[i].vec = entries[i].vector;
+@@ -3154,8 +3233,12 @@ static const struct net_device_ops cxgb_netdev_ops = {
+ .ndo_do_ioctl = cxgb_ioctl,
+ .ndo_change_mtu = cxgb_change_mtu,
+ .ndo_set_mac_address = cxgb_set_mac_addr,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
+ .ndo_fix_features = cxgb_fix_features,
+ .ndo_set_features = cxgb_set_features,
++#else
++ .ndo_vlan_rx_register = vlan_rx_register,
++#endif
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = cxgb_netpoll,
+ #endif
+@@ -3282,14 +3365,34 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
+ netdev->irq = pdev->irq;
+ netdev->mem_start = mmio_start;
+ netdev->mem_end = mmio_start + mmio_len - 1;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 0, 0)
++ netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
++ NETIF_F_TSO | NETIF_F_RXCSUM;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
++ netdev->features |= netdev->hw_features |
++ NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
++#else
++ netdev->features |= netdev->hw_features |
++ NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */
++#else
+ netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
+ NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX;
+ netdev->features |= netdev->hw_features |
+ NETIF_F_HW_VLAN_CTAG_TX;
++#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(3,0, 0) */
++#else
++ netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
++ netdev->features |= NETIF_F_GRO;
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) */
+ netdev->vlan_features |= netdev->features & VLAN_FEAT;
+ if (pci_using_dac)
+ netdev->features |= NETIF_F_HIGHDMA;
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++ netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
++#endif
+ netdev->netdev_ops = &cxgb_netdev_ops;
+ netdev->ethtool_ops = &cxgb_ethtool_ops;
+ }
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
++++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
+@@ -185,13 +185,34 @@ static struct net_device *get_iff_from_mac(struct adapter *adapter,
+ if (ether_addr_equal(dev->dev_addr, mac)) {
+ rcu_read_lock();
+ if (vlan && vlan != VLAN_VID_MASK) {
++#ifdef HAVE___VLAN_FIND_DEV_DEEP_RCU
+ dev = __vlan_find_dev_deep_rcu(dev, htons(ETH_P_8021Q), vlan);
++#else
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
++ dev = __vlan_find_dev_deep(dev, htons(ETH_P_8021Q), vlan);
++#else
++ {
++ struct port_info *p = netdev_priv(dev);
++
++ if (p->vlan_grp)
++ dev = vlan_group_get_device(p->vlan_grp, vlan);
++ else
++ dev = NULL;
++ }
++#endif
++#endif
+ } else if (netif_is_bond_slave(dev)) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+ struct net_device *upper_dev;
+
+ while ((upper_dev =
+ netdev_master_upper_dev_get_rcu(dev)))
+ dev = upper_dev;
++#else
++ while (dev->master)
++ dev = dev->master;
++
++#endif
+ }
+ rcu_read_unlock();
+ return dev;
+@@ -969,9 +990,24 @@ static int nb_callback(struct notifier_block *self, unsigned long event,
+ }
+ case (NETEVENT_REDIRECT):{
+ struct netevent_redirect *nr = ctx;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+ cxgb_redirect(nr->old, nr->new, nr->neigh,
+ nr->daddr);
+ cxgb_neigh_update(nr->neigh);
++#else
++ {
++ struct neighbour *neigh;
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
++ neigh = dst_get_neighbour_noref(nr->new);
++#else
++ neigh = dst_get_neighbour(nr->new);
++#endif
++ if (neigh)
++ cxgb_redirect(nr->old, nr->new, neigh, NULL);
++ cxgb_neigh_update(dst_get_neighbour(nr->new));
++ }
++#endif
+ break;
+ }
+ default:
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.c b/drivers/net/ethernet/chelsio/cxgb3/l2t.c
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/net/ethernet/chelsio/cxgb3/l2t.c
++++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.c
+@@ -311,7 +311,11 @@ struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst,
+ int smt_idx;
+
+ rcu_read_lock();
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
+ neigh = dst_neigh_lookup(dst, daddr);
++#else
++ neigh = dst_get_neighbour(dst);
++#endif
+ if (!neigh)
+ goto done_rcu;
+
+@@ -360,8 +364,10 @@ struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst,
+ done_unlock:
+ write_unlock_bh(&d->lock);
+ done_rcu:
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
+ if (neigh)
+ neigh_release(neigh);
++#endif
+ rcu_read_unlock();
+ return e;
+ }
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/net/ethernet/chelsio/cxgb3/sge.c
++++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c
+@@ -298,7 +298,12 @@ static void free_tx_desc(struct adapter *adapter, struct sge_txq *q,
+ if (need_unmap)
+ unmap_skb(d->skb, q, cidx, pdev);
+ if (d->eop) {
++#ifdef HAVE_DEV_CONSUME_SKB_ANY
+ dev_consume_skb_any(d->skb);
++#else
++ dev_kfree_skb_any(d->skb);
++#endif
++
+ d->skb = NULL;
+ }
+ }
+@@ -1188,7 +1193,11 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb,
+ cpl->wr.wr_lo = htonl(V_WR_LEN(flits) | V_WR_GEN(gen) |
+ V_WR_TID(q->token));
+ wr_gen2(d, gen);
++#ifdef HAVE_DEV_CONSUME_SKB_ANY
+ dev_consume_skb_any(skb);
++#else
++ dev_kfree_skb_any(skb);
++#endif
+ return;
+ }
+
+@@ -2030,7 +2039,11 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
+
+ if (p->vlan_valid) {
+ qs->port_stats[SGE_PSTAT_VLANEX]++;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
++ __vlan_hwaccel_put_tag(skb, ntohs(p->vlan));
++#else
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(p->vlan));
++#endif
+ }
+ if (rq->polling) {
+ if (lro)
+@@ -2132,7 +2145,11 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
+
+ if (cpl->vlan_valid) {
+ qs->port_stats[SGE_PSTAT_VLANEX]++;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
++ __vlan_hwaccel_put_tag(skb, ntohs(cpl->vlan));
++#else
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(cpl->vlan));
++#endif
+ }
+ napi_gro_frags(&qs->napi);
+ }
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/xgmac.c b/drivers/net/ethernet/chelsio/cxgb3/xgmac.c
+index xxxxxxx..xxxxxxx xxxxxx
+--- a/drivers/net/ethernet/chelsio/cxgb3/xgmac.c
++++ b/drivers/net/ethernet/chelsio/cxgb3/xgmac.c
+@@ -311,17 +311,33 @@ int t3_mac_set_rx_mode(struct cmac *mac, struct net_device *dev)
+ if (dev->flags & IFF_ALLMULTI)
+ hash_lo = hash_hi = 0xffffffff;
+ else {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
+ struct netdev_hw_addr *ha;
++#else
++ struct dev_mc_list *dmi;
++#endif
+ int exact_addr_idx = mac->nucast;
+
+ hash_lo = hash_hi = 0;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
+ netdev_for_each_mc_addr(ha, dev)
++#else
++ netdev_for_each_mc_addr(dmi, dev)
++#endif
+ if (exact_addr_idx < EXACT_ADDR_FILTERS)
+ set_addr_filter(mac, exact_addr_idx++,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
+ ha->addr);
++#else
++ dmi->dmi_addr);
++#endif
+ else {
+- int hash = hash_hw_addr(ha->addr);
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
++ int hash = hash_hw_addr(ha->addr);
++#else
++ int hash = hash_hw_addr(dmi->dmi_addr);
++#endif
+ if (hash < 32)
+ hash_lo |= (1 << hash);
+ else