From: Mitesh Ahuja Date: Thu, 12 Feb 2015 09:41:28 +0000 (-0800) Subject: be2net: Backport support for RHEL 6.[56] X-Git-Tag: vofed-3.18~39 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=3d511c4505288b52239ac7998665e2ce697cc6f4;p=~aditr%2Fcompat-rdma.git be2net: Backport support for RHEL 6.[56] --- diff --git a/linux-next-pending/0008-be2net-Backport-support-for-RHEL-6.-56.patch b/linux-next-pending/0008-be2net-Backport-support-for-RHEL-6.-56.patch new file mode 100644 index 0000000..724cd49 --- /dev/null +++ b/linux-next-pending/0008-be2net-Backport-support-for-RHEL-6.-56.patch @@ -0,0 +1,421 @@ +From 2df5671f3e96458d687a8f69da9b40f688cb3077 Mon Sep 17 00:00:00 2001 +From: Mitesh Ahuja +Date: Wed, 11 Feb 2015 03:46:57 -0800 +Subject: [PATCH] be2net: Backport support for RHEL 6.[56] + +Fixing compilation issues for RHEL 6.5 and RHEL 6.6 +--- + drivers/net/ethernet/emulex/benet/be_cmds.c | 2 +- + drivers/net/ethernet/emulex/benet/be_compat.h | 54 +++++++++++++++++++++++- + drivers/net/ethernet/emulex/benet/be_ethtool.c | 12 +++++ + drivers/net/ethernet/emulex/benet/be_main.c | 49 +++++++++++++++++++-- + 4 files changed, 110 insertions(+), 7 deletions(-) + +diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c +index 1d12f49..eda5c0a 100644 +--- a/drivers/net/ethernet/emulex/benet/be_cmds.c ++++ b/drivers/net/ethernet/emulex/benet/be_cmds.c +@@ -1920,7 +1920,7 @@ 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 { +-#ifdef HAVE_NETDEV_HW_ADDR ++#ifndef HAVE_NETDEV_DEV_ADDR + struct netdev_hw_addr *ha; + #else + struct dev_addr_list *ha; +diff --git a/drivers/net/ethernet/emulex/benet/be_compat.h b/drivers/net/ethernet/emulex/benet/be_compat.h +index e6a94f7..be334b0 100644 +--- a/drivers/net/ethernet/emulex/benet/be_compat.h ++++ b/drivers/net/ethernet/emulex/benet/be_compat.h +@@ -96,7 +96,7 @@ int pci_sriov_get_totalvfs(struct pci_dev *pdev); + #endif + + /* When new mc-list macros were used in 2.6.35, dev_mc_list was dropped */ +-#ifdef HAVE_NETDEV_HW_ADDR ++#ifndef HAVE_NETDEV_DEV_ADDR + #define DMI_ADDR addr + #else + #define DMI_ADDR dmi_addr +@@ -123,4 +123,56 @@ static inline void ether_addr_copy(u8 *dst, const u8 *src) + } + #endif + ++#ifndef SUPPORTED_1000baseKX_Full ++#define SUPPORTED_1000baseKX_Full (1 << 17) ++#endif ++ ++#ifndef SUPPORTED_10000baseKX4_Full ++#define SUPPORTED_10000baseKX4_Full (1 << 18) ++#endif ++ ++#ifndef SUPPORTED_10000baseKR_Full ++#define SUPPORTED_10000baseKR_Full (1 << 19) ++#endif ++ ++#ifndef SUPPORTED_20000baseKR2_Full ++#define SUPPORTED_20000baseKR2_Full (1 << 22) ++#endif ++ ++#ifndef SUPPORTED_40000baseKR4_Full ++#define SUPPORTED_40000baseKR4_Full (1 << 23) ++#endif ++ ++#ifndef SUPPORTED_40000baseCR4_Full ++#define SUPPORTED_40000baseCR4_Full (1 << 24) ++#endif ++ ++#ifndef SUPPORTED_40000baseSR4_Full ++#define SUPPORTED_40000baseSR4_Full (1 << 25) ++#endif ++ ++#ifndef SUPPORTED_40000baseLR4_Full ++#define SUPPORTED_40000baseLR4_Full (1 << 26) ++#endif ++ ++#ifndef ADVERTISED_1000baseKX_Full ++#define ADVERTISED_1000baseKX_Full (1 << 17) ++#endif ++ ++#ifndef ADVERTISED_10000baseKX4_Full ++#define ADVERTISED_10000baseKX4_Full (1 << 18) ++#endif ++ ++#ifndef ADVERTISED_10000baseKR_Full ++#define ADVERTISED_10000baseKR_Full (1 << 19) ++#endif ++ ++#ifndef ADVERTISED_20000baseKR2_Full ++#define ADVERTISED_20000baseKR2_Full (1 << 22) ++#endif ++ ++#ifndef ADVERTISED_40000baseKR4_Full ++#define ADVERTISED_40000baseKR4_Full (1 << 23) ++#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 04628fa..3e24d65 100644 +--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c ++++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c +@@ -769,6 +769,7 @@ static int be_set_phys_id(struct net_device *netdev, + } + #endif + ++#ifdef HAVE_ETHTOOL_OPS_SET_DUMP + static int be_set_dump(struct net_device *netdev, struct ethtool_dump *dump) + { + struct be_adapter *adapter = netdev_priv(netdev); +@@ -796,6 +797,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) + { +@@ -1252,6 +1254,7 @@ static int be_set_rxfh(struct net_device *netdev, const u32 *indir, + + #endif + ++#ifdef HAVE_ETHTOOL_OPS_GET_MODULE_INFO + static int be_get_module_info(struct net_device *netdev, + struct ethtool_modinfo *modinfo) + { +@@ -1275,7 +1278,9 @@ static int be_get_module_info(struct net_device *netdev, + } + return be_cmd_status(status); + } ++#endif + ++#ifdef HAVE_ETHTOOL_OPS_GET_MODULE_EEPROM + static int be_get_module_eeprom(struct net_device *netdev, + struct ethtool_eeprom *eeprom, u8 *data) + { +@@ -1303,6 +1308,7 @@ static int be_get_module_eeprom(struct net_device *netdev, + err: + return be_cmd_status(status); + } ++#endif + + const struct ethtool_ops be_ethtool_ops = { + .get_settings = be_get_settings, +@@ -1321,7 +1327,9 @@ const struct ethtool_ops be_ethtool_ops = { + #ifdef HAVE_SET_PHYS_ID + .set_phys_id = be_set_phys_id, + #endif ++#ifdef HAVE_ETHTOOL_OPS_SET_DUMP + .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, +@@ -1342,6 +1350,10 @@ const struct ethtool_ops be_ethtool_ops = { + .get_channels = be_get_channels, + .set_channels = be_set_channels, + #endif ++#ifdef HAVE_ETHTOOL_OPS_GET_MODULE_INFO + .get_module_info = be_get_module_info, ++#endif ++#ifdef HAVE_ETHTOOL_OPS_GET_MODULE_EEPROM + .get_module_eeprom = be_get_module_eeprom ++#endif + }; +diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c +index 5c92b4e..b3890ae 100644 +--- a/drivers/net/ethernet/emulex/benet/be_main.c ++++ b/drivers/net/ethernet/emulex/benet/be_main.c +@@ -22,7 +22,9 @@ + #include + #include + #include ++#ifdef HAVE_SKB_MARK_NAPI_ID + #include ++#endif + #include + + MODULE_VERSION(DRV_VER); +@@ -809,11 +811,13 @@ static inline u16 be_get_tx_vlan_tag(struct be_adapter *adapter, + } + + /* Used only for IP tunnel packets */ ++#ifdef HAVE_SK_BUFF_CSUM_LEVEL + static u16 skb_inner_ip_proto(struct sk_buff *skb) + { + return (inner_ip_hdr(skb)->version == 4) ? + inner_ip_hdr(skb)->protocol : inner_ipv6_hdr(skb)->nexthdr; + } ++#endif + + static u16 skb_ip_proto(struct sk_buff *skb) + { +@@ -837,12 +841,16 @@ static void wrb_fill_hdr(struct be_adapter *adapter, struct be_eth_hdr_wrb *hdr, + if (skb_is_gso_v6(skb) && !lancer_chip(adapter)) + SET_TX_WRB_HDR_BITS(lso6, hdr, 1); + } else if (skb->ip_summed == CHECKSUM_PARTIAL) { ++#ifdef HAVE_SK_BUFF_CSUM_LEVEL + if (skb->encapsulation) { + SET_TX_WRB_HDR_BITS(ipcs, hdr, 1); + proto = skb_inner_ip_proto(skb); + } else { + proto = skb_ip_proto(skb); + } ++#else ++ proto = skb_ip_proto(skb); ++#endif + if (proto == IPPROTO_TCP) + SET_TX_WRB_HDR_BITS(tcpcs, hdr, 1); + else if (proto == IPPROTO_UDP) +@@ -1433,14 +1441,16 @@ static int be_get_vf_config(struct net_device *netdev, int vf, + return -EINVAL; + + vi->vf = vf; +-#ifdef HAVE_TX_RATE_LIMI ++#ifdef HAVE_TX_RATE_LIMIT + vi->max_tx_rate = vf_cfg->tx_rate; + vi->min_tx_rate = 0; + #endif + vi->vlan = vf_cfg->vlan_tag & VLAN_VID_MASK; + vi->qos = vf_cfg->vlan_tag >> VLAN_PRIO_SHIFT; + memcpy(&vi->mac, vf_cfg->mac_addr, ETH_ALEN); ++#ifdef HAVE_LINKSTATE + vi->linkstate = adapter->vf_cfg[vf].plink_tracking; ++#endif + + return 0; + } +@@ -1545,6 +1555,7 @@ err: + + #endif + ++#ifdef HAVE_NETDEV_OPS_NDO_SET_VF_LINK_STATE + static int be_set_vf_link_state(struct net_device *netdev, int vf, + int link_state) + { +@@ -1568,6 +1579,7 @@ static int be_set_vf_link_state(struct net_device *netdev, int vf, + + return 0; + } ++#endif + + static void be_aic_update(struct be_aic_obj *aic, u64 rx_pkts, u64 tx_pkts, + ulong now) +@@ -1829,14 +1841,21 @@ static void be_rx_compl_process(struct be_rx_obj *rxo, struct napi_struct *napi, + skb->protocol = eth_type_trans(skb, netdev); + skb_record_rx_queue(skb, rxo - &adapter->rx_obj[0]); + if (netdev->features & NETIF_F_RXHASH) ++#ifdef HAVE_SKB_SET_HASH + skb_set_hash(skb, rxcp->rss_hash, PKT_HASH_TYPE_L3); ++#else ++ skb->rxhash = rxcp->rss_hash; ++#endif + + #ifdef HAVE_SK_BUFF_CSUM_LEVEL + skb->csum_level = rxcp->tunneled; + #else + skb->encapsulation = rxcp->tunneled; + #endif ++ ++#ifdef HAVE_SKB_MARK_NAPI_ID + skb_mark_napi_id(skb, napi); ++#endif + + if (rxcp->vlanf) + vlan_hwaccel_receive_skb(skb, adapter->vlan_grp, rxcp->vlan_tag); +@@ -1891,7 +1910,11 @@ static void be_rx_compl_process_gro(struct be_rx_obj *rxo, + skb->ip_summed = CHECKSUM_UNNECESSARY; + skb_record_rx_queue(skb, rxo - &adapter->rx_obj[0]); + if (adapter->netdev->features & NETIF_F_RXHASH) ++#ifdef HAVE_SKB_SET_HASH + skb_set_hash(skb, rxcp->rss_hash, PKT_HASH_TYPE_L3); ++#else ++ skb->rxhash = rxcp->rss_hash; ++#endif + + #ifdef HAVE_SK_BUFF_CSUM_LEVEL + skb->csum_level = rxcp->tunneled; +@@ -1899,7 +1922,9 @@ static void be_rx_compl_process_gro(struct be_rx_obj *rxo, + skb->encapsulation = rxcp->tunneled; + #endif + ++#ifdef HAVE_SKB_MARK_NAPI_ID + skb_mark_napi_id(skb, napi); ++#endif + + if (rxcp->vlanf) + +@@ -2287,7 +2312,9 @@ static void be_evt_queues_destroy(struct be_adapter *adapter) + if (eqo->q.created) { + be_eq_clean(eqo); + be_cmd_q_destroy(adapter, &eqo->q, QTYPE_EQ); ++#ifdef HAVE_NAPI_HASH_ADD + napi_hash_del(&eqo->napi); ++#endif + netif_napi_del(&eqo->napi); + } + be_queue_free(adapter, &eqo->q); +@@ -2307,7 +2334,9 @@ static int be_evt_queues_create(struct be_adapter *adapter) + for_all_evt_queues(adapter, eqo, i) { + netif_napi_add(adapter->netdev, &eqo->napi, be_poll, + BE_NAPI_WEIGHT); ++#ifdef HAVE_NAPI_HASH_ADD + napi_hash_add(&eqo->napi); ++#endif + aic = &adapter->aic_obj[i]; + eqo->adapter = adapter; + eqo->idx = i; +@@ -2719,6 +2748,7 @@ int be_poll(struct napi_struct *napi, int budget) + } + + #ifdef CONFIG_NET_RX_BUSY_POLL ++#ifndef HAVE_NETDEV_EXTENDED_NDO_BUSY_POLL + static int be_busy_poll(struct napi_struct *napi) + { + struct be_eq_obj *eqo = container_of(napi, struct be_eq_obj, napi); +@@ -2739,6 +2769,7 @@ static int be_busy_poll(struct napi_struct *napi) + return work; + } + #endif ++#endif + + void be_detect_error(struct be_adapter *adapter) + { +@@ -2829,9 +2860,7 @@ static int be_msix_enable(struct be_adapter *adapter) + { + int i, num_vec; + struct device *dev = &adapter->pdev->dev; +-#ifndef HAVE_PCI_ENABLE_MSIX_RANGE + int status; +-#endif + + /* If RoCE is supported, program the max number of NIC vectors that + * may be configured via set-channels, along with vectors needed for +@@ -2866,7 +2895,6 @@ static int be_msix_enable(struct be_adapter *adapter) + } else { + goto fail; + } +-#endif + + done: + if (be_roce_supported(adapter) && num_vec > MIN_MSIX_VECTORS) { +@@ -2880,6 +2908,7 @@ done: + dev_info(dev, "enabled %d MSI-x vector(s) for NIC\n", + adapter->num_msix_vec); + return 0; ++#endif + + fail: + dev_warn(dev, "MSIx enable failed\n"); +@@ -3771,7 +3800,7 @@ static int be_setup_queues(struct be_adapter *adapter) + if (status) + goto err; + +-#if HAVE_RETURN_INT_FOR_SET_NUM_TX_QUEUES ++#ifdef HAVE_RETURN_INT_FOR_SET_NUM_TX_QUEUES + status = netif_set_real_num_tx_queues(netdev, adapter->num_tx_qs); + #else + netif_set_real_num_tx_queues(netdev, adapter->num_tx_qs); +@@ -4654,7 +4683,9 @@ static const struct net_device_ops be_netdev_ops = { + .ndo_set_vf_rate = be_set_vf_tx_rate, + #endif + .ndo_get_vf_config = be_get_vf_config, ++#ifdef HAVE_NETDEV_OPS_NDO_SET_VF_LINK_STATE + .ndo_set_vf_link_state = be_set_vf_link_state, ++#endif + #ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = be_netpoll, + #endif +@@ -4663,8 +4694,10 @@ static const struct net_device_ops be_netdev_ops = { + .ndo_bridge_getlink = be_ndo_bridge_getlink, + #endif + #ifdef CONFIG_NET_RX_BUSY_POLL ++#ifndef HAVE_NETDEV_EXTENDED_NDO_BUSY_POLL + .ndo_busy_poll = be_busy_poll, + #endif ++#endif + #ifdef CONFIG_BE2NET_VXLAN + .ndo_add_vxlan_port = be_add_vxlan_port, + .ndo_del_vxlan_port = be_del_vxlan_port, +@@ -4676,10 +4709,12 @@ static void be_netdev_init(struct net_device *netdev) + struct be_adapter *adapter = netdev_priv(netdev); + + if (skyhawk_chip(adapter)) { ++#ifdef HAVE_NETDEV_HW_ENC_FEATURES + netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | + NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_GSO_UDP_TUNNEL; + netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; ++#endif + } + netdev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | +@@ -4694,8 +4729,10 @@ static void be_netdev_init(struct net_device *netdev) + NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + + #ifdef HAVE_NET_DEVICE_PRIV_FLAGS ++#ifdef IFF_UNICAST_FLT + netdev->priv_flags |= IFF_UNICAST_FLT; + #endif ++#endif + + netdev->flags |= IFF_MULTICAST; + +@@ -5091,6 +5128,7 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id) + adapter->netdev = netdev; + SET_NETDEV_DEV(netdev, &pdev->dev); + ++#ifdef HAVE_DMA_SET_MASK_AND_COHERENT + status = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); + if (!status) { + netdev->features |= NETIF_F_HIGHDMA; +@@ -5101,6 +5139,7 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id) + goto free_netdev; + } + } ++#endif + + status = pci_enable_pcie_error_reporting(pdev); + if (!status) +-- +1.7.1 +