--- /dev/null
+From 281ca94c09468c699d276f023949dd8e4750d26d Mon Sep 17 00:00:00 2001
+From: Devesh Sharma <devesh.sharma@emulex.com>
+Date: Fri, 21 Feb 2014 23:30:40 +0530
+Subject: [PATCH 1/2] be2net: Backports for RHEL 6.4, RHEL 6.5 and SLES11SP3
+
+Signed-off-by: Selvin Xavier <selvin.xavier@emulex.com>
+Signed-off-by: Devesh Sharma <devesh.sharma@emulex.com>
+---
+ drivers/net/ethernet/emulex/benet/Makefile | 2 +-
+ drivers/net/ethernet/emulex/benet/be.h | 8 +-
+ drivers/net/ethernet/emulex/benet/be_cmds.c | 6 +-
+ drivers/net/ethernet/emulex/benet/be_compat.c | 72 +++++++++++
+ drivers/net/ethernet/emulex/benet/be_compat.h | 97 +++++++++++++++
+ drivers/net/ethernet/emulex/benet/be_ethtool.c | 17 ++-
+ drivers/net/ethernet/emulex/benet/be_main.c | 158 ++++++++++++++++++++---
+ 7 files changed, 333 insertions(+), 27 deletions(-)
+ create mode 100644 drivers/net/ethernet/emulex/benet/be_compat.c
+ create mode 100644 drivers/net/ethernet/emulex/benet/be_compat.h
+
+diff --git a/drivers/net/ethernet/emulex/benet/Makefile b/drivers/net/ethernet/emulex/benet/Makefile
+index 1a91b27..a32863b 100644
+--- a/drivers/net/ethernet/emulex/benet/Makefile
++++ b/drivers/net/ethernet/emulex/benet/Makefile
+@@ -4,4 +4,4 @@
+
+ obj-$(CONFIG_BE2NET) += be2net.o
+
+-be2net-y := be_main.o be_cmds.o be_ethtool.o be_roce.o
++be2net-y := be_main.o be_cmds.o be_ethtool.o be_roce.o be_compat.o
+diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
+index db02023..fea7156 100644
+--- a/drivers/net/ethernet/emulex/benet/be.h
++++ b/drivers/net/ethernet/emulex/benet/be.h
+@@ -20,6 +20,7 @@
+
+ #include <linux/pci.h>
+ #include <linux/etherdevice.h>
++#include <linux/version.h>
+ #include <linux/delay.h>
+ #include <net/tcp.h>
+ #include <net/ip.h>
+@@ -30,9 +31,11 @@
+ #include <linux/firmware.h>
+ #include <linux/slab.h>
+ #include <linux/u64_stats_sync.h>
++#include <linux/netdevice.h>
+
+ #include "be_hw.h"
+ #include "be_roce.h"
++#include "be_compat.h"
+
+ #define DRV_VER "4.9.134.0u"
+ #define DRV_NAME "be2net"
+@@ -446,7 +449,9 @@ struct be_adapter {
+ u32 num_msix_roce_vec;
+ struct ocrdma_dev *ocrdma_dev;
+ struct list_head entry;
+-
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++ struct net_device_stats net_stats;
++#endif
+ u32 flash_status;
+ struct completion flash_compl;
+
+@@ -468,6 +473,7 @@ struct be_adapter {
+ int be_get_temp_freq;
+ u8 pf_number;
+ u64 rss_flags;
++ struct vlan_group *vlan_grp;
+ };
+
+ #define be_physfn(adapter) (!adapter->virtfn)
+diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
+index c08fd32..cac9862 100644
+--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
++++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
+@@ -1823,7 +1823,11 @@ int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value)
+ req->if_flags =
+ cpu_to_le32(BE_IF_FLAGS_VLAN_PROMISCUOUS);
+ } else {
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)
+ struct netdev_hw_addr *ha;
++#else
++ struct dev_addr_list *ha;
++#endif
+ int i = 0;
+
+ req->if_flags_mask = req->if_flags =
+@@ -1837,7 +1841,7 @@ int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value)
+ be_if_cap_flags(adapter));
+ req->mcast_num = cpu_to_le32(netdev_mc_count(adapter->netdev));
+ netdev_for_each_mc_addr(ha, adapter->netdev)
+- memcpy(req->mcast_mac[i++].byte, ha->addr, ETH_ALEN);
++ memcpy(req->mcast_mac[i++].byte, ha->DMI_ADDR, ETH_ALEN);
+ }
+
+ status = be_mcc_notify_wait(adapter);
+diff --git a/drivers/net/ethernet/emulex/benet/be_compat.c b/drivers/net/ethernet/emulex/benet/be_compat.c
+new file mode 100644
+index 0000000..6e8f6c6
+--- /dev/null
++++ b/drivers/net/ethernet/emulex/benet/be_compat.c
+@@ -0,0 +1,72 @@
++#include "be.h"
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) && defined(CONFIG_PCI_IOV)
++#define sriov_kernel true
++#else
++#define sriov_kernel false
++#endif
++
++#ifndef PCI_DEV_FLAGS_ASSIGNED
++#define PCI_DEV_FLAGS_ASSIGNED 0x04
++#endif
++
++#ifdef CONFIG_PCI_IOV
++int be_find_vfs(struct pci_dev *pdev, int vf_state)
++{
++ struct pci_dev *dev = pdev;
++ int vfs = 0, assigned_vfs = 0, pos;
++
++ if (!sriov_kernel)
++ return 0;
++
++ pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
++ if (!pos)
++ return 0;
++
++ dev = pci_get_device(pdev->vendor, PCI_ANY_ID, NULL);
++ while (dev) {
++ if (dev->is_virtfn && pci_physfn(dev) == pdev) {
++ vfs++;
++ if (dev->dev_flags & PCI_DEV_FLAGS_ASSIGNED)
++ assigned_vfs++;
++ }
++ dev = pci_get_device(pdev->vendor, PCI_ANY_ID, dev);
++ }
++ return (vf_state == ASSIGNED) ? assigned_vfs : vfs;
++}
++
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 10, 0)
++/**
++ * pci_vfs_assigned - returns number of VFs are assigned to a guest
++ * @dev: the PCI device
++ *
++ * Returns number of VFs belonging to this device that are assigned to a guest.
++ * If device is not a physical function returns -ENODEV.
++ */
++int pci_vfs_assigned(struct pci_dev *pdev)
++{
++ return be_find_vfs(pdev, ASSIGNED);
++}
++/**
++ * pci_num_vf - return number of VFs associated with a PF device_release_driver
++ * @dev: the PCI device
++ *
++ * Returns number of VFs, or 0 if SR-IOV is not enabled.
++ */
++int pci_num_vf(struct pci_dev *pdev)
++{
++ return be_find_vfs(pdev, ENABLED);
++}
++int pci_sriov_get_totalvfs(struct pci_dev *pdev)
++{
++ u16 num = 0;
++ int pos;
++
++ pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
++ if (pos)
++ pci_read_config_word(pdev, pos + PCI_SRIOV_TOTAL_VF, &num);
++ return num;
++}
++
++#endif
++#endif /* CONFIG_PCI_IOV */
+diff --git a/drivers/net/ethernet/emulex/benet/be_compat.h b/drivers/net/ethernet/emulex/benet/be_compat.h
+new file mode 100644
+index 0000000..3daa68a
+--- /dev/null
++++ b/drivers/net/ethernet/emulex/benet/be_compat.h
+@@ -0,0 +1,97 @@
++#ifndef BE_COMPAT_H
++#define BE_COMPAT_H
++
++#include <linux/netdevice.h>
++
++#ifndef VLAN_N_VID
++#define VLAN_N_VID 4096
++#endif
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
++#define USE_NEW_VLAN_MODEL
++#endif
++
++static inline struct sk_buff *__vlan_put_tag_fixed(struct sk_buff *skb,
++ __be16 vlan_proto,
++ ushort vlan_tag)
++{
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
++ struct sk_buff *new_skb = __vlan_put_tag(skb, vlan_proto, vlan_tag);
++#else
++ struct sk_buff *new_skb = __vlan_put_tag(skb, vlan_tag);
++#endif
++ return new_skb;
++}
++
++#ifdef USE_NEW_VLAN_MODEL
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
++struct vlan_group {
++ char dummy;
++};
++#endif
++
++static inline int vlan_hwaccel_receive_skb_compat(struct sk_buff *skb,
++ struct vlan_group *grp,
++ u16 vlan_tci)
++{
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
++ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
++#else
++ __vlan_hwaccel_put_tag(skb, vlan_tci);
++#endif
++ return netif_receive_skb(skb);
++}
++
++static inline gro_result_t vlan_gro_frags_compat(struct napi_struct *napi,
++ struct vlan_group *grp,
++ unsigned int vlan_tci)
++{
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
++ __vlan_hwaccel_put_tag(napi->skb, htons(ETH_P_8021Q), vlan_tci);
++#else
++ __vlan_hwaccel_put_tag(napi->skb, vlan_tci);
++#endif
++ return napi_gro_frags(napi);
++}
++#define vlan_hwaccel_receive_skb vlan_hwaccel_receive_skb_compat
++#define vlan_gro_frags vlan_gro_frags_compat
++#endif
++
++#ifdef CONFIG_PCI_IOV
++int be_find_vfs(struct pci_dev *pdev, int vf_state);
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 10, 0)
++int pci_vfs_assigned(struct pci_dev *pdev);
++
++int pci_num_vf(struct pci_dev *pdev);
++int pci_sriov_get_totalvfs(struct pci_dev *pdev);
++#endif
++#else
++#define pci_vfs_assigned(x) 0
++#define pci_num_vf(x) 0
++#endif /* CONFIG_PCI_IOV */
++
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 3, 0)
++#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX
++#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX
++#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER
++#endif
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++#define hw_features features
++#endif
++
++#ifndef netdev_for_each_mc_addr
++#define netdev_for_each_mc_addr(h, n) for (h = (n)->mc_list; h; h = h->next)
++#endif
++
++/* When new mc-list macros were used in 2.6.35, dev_mc_list was dropped */
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)
++#define DMI_ADDR addr
++#else
++#define DMI_ADDR dmi_addr
++#endif /* dev_mc_list */
++
++#ifndef DUPLEX_UNKNOWN
++#define DUPLEX_UNKNOWN 0xFF
++#endif
++
++#endif /* BE_COMPAT_H */
+diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
+index b440a1f..a739c20 100644
+--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
++++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
+@@ -638,7 +638,7 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
+
+ return status;
+ }
+-
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+ static int
+ be_set_phys_id(struct net_device *netdev,
+ enum ethtool_phys_id_state state)
+@@ -697,6 +697,7 @@ static int be_set_dump(struct net_device *netdev, struct ethtool_dump *dump)
+ }
+ return status;
+ }
++#endif
+
+ static void
+ be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
+@@ -999,9 +1000,13 @@ static u64 be_get_rss_hash_opts(struct be_adapter *adapter, u64 flow_type)
+
+ return data;
+ }
+-
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 2)
++static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
++ u32 *rule_locs)
++#else
+ static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
+- u32 *rule_locs)
++ void *rule_locs)
++#endif
+ {
+ struct be_adapter *adapter = netdev_priv(netdev);
+
+@@ -1119,6 +1124,7 @@ static int be_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
+ return status;
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+ static void be_get_channels(struct net_device *netdev,
+ struct ethtool_channels *ch)
+ {
+@@ -1141,6 +1147,7 @@ static int be_set_channels(struct net_device *netdev,
+
+ return be_update_queues(adapter);
+ }
++#endif
+
+ const struct ethtool_ops be_ethtool_ops = {
+ .get_settings = be_get_settings,
+@@ -1156,8 +1163,10 @@ const struct ethtool_ops be_ethtool_ops = {
+ .get_pauseparam = be_get_pauseparam,
+ .set_pauseparam = be_set_pauseparam,
+ .get_strings = be_get_stat_strings,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+ .set_phys_id = be_set_phys_id,
+ .set_dump = be_set_dump,
++#endif
+ .get_msglevel = be_get_msg_level,
+ .set_msglevel = be_set_msg_level,
+ .get_sset_count = be_get_sset_count,
+@@ -1168,6 +1177,8 @@ const struct ethtool_ops be_ethtool_ops = {
+ .self_test = be_self_test,
+ .get_rxnfc = be_get_rxnfc,
+ .set_rxnfc = be_set_rxnfc,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
+ .get_channels = be_get_channels,
+ .set_channels = be_set_channels
++#endif
+ };
+diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
+index 2c38cc4..2ff0d29 100644
+--- a/drivers/net/ethernet/emulex/benet/be_main.c
++++ b/drivers/net/ethernet/emulex/benet/be_main.c
+@@ -146,8 +146,8 @@ static int be_queue_alloc(struct be_adapter *adapter, struct be_queue_info *q,
+ q->len = len;
+ q->entry_size = entry_size;
+ mem->size = len * entry_size;
+- mem->va = dma_zalloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma,
+- GFP_KERNEL);
++ mem->va = dma_alloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma,
++ GFP_KERNEL|__GFP_ZERO);
+ if (!mem->va)
+ return -ENOMEM;
+ return 0;
+@@ -511,6 +511,76 @@ void be_parse_stats(struct be_adapter *adapter)
+ }
+ }
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++static void be_get_error_stats(struct be_adapter *adapter,
++ struct net_device_stats *stats)
++{
++ struct be_drv_stats *drvs = &adapter->drv_stats;
++
++ /* bad pkts received */
++ stats->rx_errors = drvs->rx_crc_errors +
++ drvs->rx_alignment_symbol_errors +
++ drvs->rx_in_range_errors +
++ drvs->rx_out_range_errors +
++ drvs->rx_frame_too_long +
++ drvs->rx_dropped_too_small +
++ drvs->rx_dropped_too_short +
++ drvs->rx_dropped_header_too_small +
++ drvs->rx_dropped_tcp_length +
++ drvs->rx_dropped_runt;
++
++ /* detailed rx errors */
++ stats->rx_length_errors = drvs->rx_in_range_errors +
++ drvs->rx_out_range_errors +
++ drvs->rx_frame_too_long;
++
++ stats->rx_crc_errors = drvs->rx_crc_errors;
++
++ /* frame alignment errors */
++ stats->rx_frame_errors = drvs->rx_alignment_symbol_errors;
++
++ /* receiver fifo overrun */
++ /* drops_no_pbuf is no per i/f, it's per BE card */
++ stats->rx_fifo_errors = drvs->rxpp_fifo_overflow_drop +
++ drvs->rx_input_fifo_overflow_drop +
++ drvs->rx_drops_no_pbuf;
++}
++
++static struct net_device_stats *be_get_stats(struct net_device *dev)
++{
++ struct be_adapter *adapter = netdev_priv(dev);
++ struct net_device_stats *stats = &adapter->net_stats;
++ struct be_rx_obj *rxo;
++ struct be_tx_obj *txo;
++ unsigned long pkts = 0, bytes = 0, mcast = 0, drops = 0;
++ int i;
++
++ for_all_rx_queues(adapter, rxo, i) {
++ pkts += rx_stats(rxo)->rx_pkts;
++ bytes += rx_stats(rxo)->rx_bytes;
++ mcast += rx_stats(rxo)->rx_mcast_pkts;
++ drops += rx_stats(rxo)->rx_drops_no_skbs +
++ rx_stats(rxo)->rx_drops_no_frags;
++ }
++ stats->rx_packets = pkts;
++ stats->rx_bytes = bytes;
++ stats->multicast = mcast;
++ stats->rx_dropped = drops;
++
++ pkts = 0;
++ bytes = 0;
++ for_all_tx_queues(adapter, txo, i) {
++ pkts += tx_stats(txo)->tx_pkts;
++ bytes += tx_stats(txo)->tx_bytes;
++ }
++ stats->tx_packets = pkts;
++ stats->tx_bytes = bytes;
++
++ be_get_error_stats(adapter, stats);
++
++ return stats;
++}
++#else
+ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
+ struct rtnl_link_stats64 *stats)
+ {
+@@ -576,6 +646,7 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
+ drvs->rx_drops_no_pbuf;
+ return stats;
+ }
++#endif
+
+ void be_link_status_update(struct be_adapter *adapter, u8 link_status)
+ {
+@@ -795,7 +866,7 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter,
+ }
+
+ if (vlan_tag) {
+- skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
++ skb = __vlan_put_tag_fixed(skb, htons(ETH_P_8021Q), vlan_tag);
+ if (unlikely(!skb))
+ return skb;
+ skb->vlan_tci = 0;
+@@ -804,7 +875,7 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter,
+ /* Insert the outer VLAN, if any */
+ if (adapter->qnq_vid) {
+ vlan_tag = adapter->qnq_vid;
+- skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
++ skb = __vlan_put_tag_fixed(skb, htons(ETH_P_8021Q), vlan_tag);
+ if (unlikely(!skb))
+ return skb;
+ if (skip_hw_vlan)
+@@ -1049,8 +1120,11 @@ set_vlan_promisc:
+ "Failed to enable VLAN Promiscuous mode.\n");
+ return status;
+ }
+-
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+ static int be_vlan_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
++#else
++static void be_vlan_add_vid(struct net_device *netdev, u16 vid)
++#endif
+ {
+ struct be_adapter *adapter = netdev_priv(netdev);
+ int status = 0;
+@@ -1058,7 +1132,11 @@ static int be_vlan_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
+
+ /* Packets with VID 0 are always received by Lancer by default */
+ if (lancer_chip(adapter) && vid == 0)
+- goto ret;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
++ return status;
++#else
++ return;
++#endif
+
+ adapter->vlan_tag[vid] = 1;
+ if (adapter->vlans_added <= (be_max_vlans(adapter) + 1))
+@@ -1068,18 +1146,27 @@ static int be_vlan_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
+ adapter->vlans_added++;
+ else
+ adapter->vlan_tag[vid] = 0;
+-ret:
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+ return status;
++#endif
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+ static int be_vlan_rem_vid(struct net_device *netdev, __be16 proto, u16 vid)
++#else
++static void be_vlan_rem_vid(struct net_device *netdev, u16 vid)
++#endif
+ {
+ struct be_adapter *adapter = netdev_priv(netdev);
+ int status = 0;
+
+ /* Packets with VID 0 are always received by Lancer by default */
+ if (lancer_chip(adapter) && vid == 0)
+- goto ret;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
++ return status;
++#else
++ return;
++#endif
+
+ adapter->vlan_tag[vid] = 0;
+ if (adapter->vlans_added <= be_max_vlans(adapter))
+@@ -1089,8 +1176,9 @@ static int be_vlan_rem_vid(struct net_device *netdev, __be16 proto, u16 vid)
+ adapter->vlans_added--;
+ else
+ adapter->vlan_tag[vid] = 1;
+-ret:
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+ return status;
++#endif
+ }
+
+ static void be_set_rx_mode(struct net_device *netdev)
+@@ -1491,9 +1579,9 @@ static void be_rx_compl_process(struct be_rx_obj *rxo,
+
+
+ if (rxcp->vlanf)
+- __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rxcp->vlan_tag);
+-
+- netif_receive_skb(skb);
++ vlan_hwaccel_receive_skb(skb, adapter->vlan_grp, rxcp->vlan_tag);
++ else
++ netif_receive_skb(skb);
+ }
+
+ /* Process the RX completion indicated by rxcp when GRO is enabled */
+@@ -1548,9 +1636,10 @@ static void be_rx_compl_process_gro(struct be_rx_obj *rxo,
+ skb->rxhash = rxcp->rss_hash;
+
+ if (rxcp->vlanf)
+- __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rxcp->vlan_tag);
+
+- napi_gro_frags(napi);
++ vlan_gro_frags(napi, NULL, rxcp->vlan_tag);
++ else
++ napi_gro_frags(napi);
+ }
+
+ static void be_parse_rx_compl_v1(struct be_eth_rx_compl *compl,
+@@ -2657,8 +2746,8 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable)
+ memset(mac, 0, ETH_ALEN);
+
+ cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config);
+- cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
+- GFP_KERNEL);
++ cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
++ GFP_KERNEL|__GFP_ZERO);
+ if (cmd.va == NULL)
+ return -1;
+
+@@ -3152,7 +3241,11 @@ static int be_setup_queues(struct be_adapter *adapter)
+ if (status)
+ goto err;
+
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 0, 0)
+ status = netif_set_real_num_tx_queues(netdev, adapter->num_tx_qs);
++#else
++ netif_set_real_num_tx_queues(netdev, adapter->num_tx_qs);
++#endif
+ if (status)
+ goto err;
+
+@@ -3811,7 +3904,7 @@ fw_exit:
+ release_firmware(fw);
+ return status;
+ }
+-
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
+ static int be_ndo_bridge_setlink(struct net_device *dev,
+ struct nlmsghdr *nlh)
+ {
+@@ -3879,6 +3972,18 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
+ hsw_mode == PORT_FWD_TYPE_VEPA ?
+ BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB);
+ }
++#endif
++
++
++#ifndef USE_NEW_VLAN_MODEL
++static void be_vlan_register(struct net_device *netdev, struct vlan_group *grp)
++{
++ struct be_adapter *adapter = netdev_priv(netdev);
++
++ adapter->vlan_grp = grp;
++}
++#endif
++
+
+ static const struct net_device_ops be_netdev_ops = {
+ .ndo_open = be_open,
+@@ -3887,8 +3992,15 @@ static const struct net_device_ops be_netdev_ops = {
+ .ndo_set_rx_mode = be_set_rx_mode,
+ .ndo_set_mac_address = be_mac_addr_set,
+ .ndo_change_mtu = be_change_mtu,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
++ .ndo_get_stats = be_get_stats,
++#else
+ .ndo_get_stats64 = be_get_stats64,
++#endif
+ .ndo_validate_addr = eth_validate_addr,
++#ifndef USE_NEW_VLAN_MODEL
++ .ndo_vlan_rx_register = be_vlan_register,
++#endif
+ .ndo_vlan_rx_add_vid = be_vlan_add_vid,
+ .ndo_vlan_rx_kill_vid = be_vlan_rem_vid,
+ .ndo_set_vf_mac = be_set_vf_mac,
+@@ -3898,8 +4010,10 @@ static const struct net_device_ops be_netdev_ops = {
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = be_netpoll,
+ #endif
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
+ .ndo_bridge_setlink = be_ndo_bridge_setlink,
+ .ndo_bridge_getlink = be_ndo_bridge_getlink,
++#endif
+ };
+
+ static void be_netdev_init(struct net_device *netdev)
+@@ -3918,7 +4032,9 @@ static void be_netdev_init(struct net_device *netdev)
+ netdev->vlan_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
+ NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+ netdev->priv_flags |= IFF_UNICAST_FLT;
++#endif
+
+ netdev->flags |= IFF_MULTICAST;
+
+@@ -4033,9 +4149,9 @@ static int be_ctrl_init(struct be_adapter *adapter)
+ memset(mbox_mem_align->va, 0, sizeof(struct be_mcc_mailbox));
+
+ rx_filter->size = sizeof(struct be_cmd_req_rx_filter);
+- rx_filter->va = dma_zalloc_coherent(&adapter->pdev->dev,
++ rx_filter->va = dma_alloc_coherent(&adapter->pdev->dev,
+ rx_filter->size, &rx_filter->dma,
+- GFP_KERNEL);
++ GFP_KERNEL|__GFP_ZERO);
+ if (rx_filter->va == NULL) {
+ status = -ENOMEM;
+ goto free_mbox;
+@@ -4081,8 +4197,8 @@ static int be_stats_init(struct be_adapter *adapter)
+ /* BE3 and Skyhawk */
+ cmd->size = sizeof(struct be_cmd_req_get_stats_v1);
+
+- cmd->va = dma_zalloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma,
+- GFP_KERNEL);
++ cmd->va = dma_alloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma,
++ GFP_KERNEL|__GFP_ZERO);
+ if (cmd->va == NULL)
+ return -1;
+ return 0;
+--
+1.7.1
+