From: Chiqijun chiqijun@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
Delete the old kernel version adaptation interface in netdev ops.
Signed-off-by: Chiqijun chiqijun@huawei.com Reviewed-by: Zengweiliang zengweiliang.zengweiliang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../net/ethernet/huawei/hinic/hinic_ethtool.c | 8 - .../net/ethernet/huawei/hinic/hinic_main.c | 274 +----------------- .../net/ethernet/huawei/hinic/hinic_nic_cfg.c | 18 -- .../net/ethernet/huawei/hinic/hinic_nic_cfg.h | 2 - .../net/ethernet/huawei/hinic/hinic_nic_dev.h | 7 - .../net/ethernet/huawei/hinic/hinic_nictool.c | 3 - drivers/net/ethernet/huawei/hinic/hinic_rx.h | 5 +- .../net/ethernet/huawei/hinic/hinic_sriov.c | 27 +- .../net/ethernet/huawei/hinic/hinic_sriov.h | 14 - drivers/net/ethernet/huawei/hinic/hinic_tx.h | 4 - .../ethernet/huawei/hinic/ossl_knl_linux.h | 53 ---- 11 files changed, 7 insertions(+), 408 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c index 0c0189b63a0d..1a745cd38afd 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c @@ -1587,12 +1587,8 @@ static void hinic_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, u64 *data) { struct hinic_nic_dev *nic_dev = netdev_priv(netdev); -#ifdef HAVE_NDO_GET_STATS64 struct rtnl_link_stats64 temp; const struct rtnl_link_stats64 *net_stats; -#else - const struct net_device_stats *net_stats; -#endif struct hinic_phy_port_stats *port_stats; struct hinic_nic_stats *nic_stats; struct hinic_vport_stats vport_stats = {0}; @@ -1600,11 +1596,7 @@ static void hinic_get_ethtool_stats(struct net_device *netdev, char *p; int err;
-#ifdef HAVE_NDO_GET_STATS64 net_stats = dev_get_stats(netdev, &temp); -#else - net_stats = dev_get_stats(netdev); -#endif for (j = 0; j < ARRAY_LEN(hinic_netdev_stats); j++, i++) { p = (char *)(net_stats) + hinic_netdev_stats[j].offset; data[i] = (hinic_netdev_stats[j].size == diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index d78a5e3678b1..7b9c38c4db93 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -180,7 +180,6 @@ enum hinic_rx_buff_len { #define HINIC_MODERATONE_DELAY HZ #define CONVERT_UNIT 1024
-#ifdef HAVE_MULTI_VLAN_OFFLOAD_EN int hinic_netdev_event(struct notifier_block *notifier, unsigned long event, void *ptr);
@@ -255,15 +254,7 @@ int hinic_netdev_event(struct notifier_block *notifier, if (vlan_depth == HINIC_MAX_VLAN_DEPTH_OFFLOAD_SUPPORT) { ndev->vlan_features &= (~HINIC_VLAN_CLEAR_OFFLOAD); } else if (vlan_depth > HINIC_MAX_VLAN_DEPTH_OFFLOAD_SUPPORT) { -#ifdef HAVE_NDO_SET_FEATURES -#ifdef HAVE_RHEL6_NET_DEVICE_OPS_EXT - set_netdev_hw_features(ndev, - get_netdev_hw_features(ndev) & - (~HINIC_VLAN_CLEAR_OFFLOAD)); -#else ndev->hw_features &= (~HINIC_VLAN_CLEAR_OFFLOAD); -#endif -#endif ndev->features &= (~HINIC_VLAN_CLEAR_OFFLOAD); }
@@ -278,7 +269,6 @@ int hinic_netdev_event(struct notifier_block *notifier,
return NOTIFY_DONE; } -#endif
void hinic_link_status_change(struct hinic_nic_dev *nic_dev, bool status) { @@ -1172,24 +1162,9 @@ static u16 select_queue_by_toeplitz(struct net_device *dev, return (u16)nic_dev->rss_indir_user[hash & 0xFF]; }
-#if defined(HAVE_NDO_SELECT_QUEUE_ACCEL_FALLBACK) -#if defined(HAVE_NDO_SELECT_QUEUE_SB_DEV) static u16 hinic_select_queue(struct net_device *netdev, struct sk_buff *skb, struct net_device *sb_dev, select_queue_fallback_t fallback) -#else -static u16 hinic_select_queue(struct net_device *netdev, struct sk_buff *skb, - __always_unused void *accel, - select_queue_fallback_t fallback) -#endif - -#elif defined(HAVE_NDO_SELECT_QUEUE_ACCEL) -static u16 hinic_select_queue(struct net_device *netdev, struct sk_buff *skb, - __always_unused void *accel) - -#else -static u16 hinic_select_queue(struct net_device *netdev, struct sk_buff *skb) -#endif /* end of HAVE_NDO_SELECT_QUEUE_ACCEL_FALLBACK */ { struct hinic_nic_dev *nic_dev = netdev_priv(netdev);
@@ -1204,40 +1179,13 @@ static u16 hinic_select_queue(struct net_device *netdev, struct sk_buff *skb) netdev->real_num_tx_queues);
fallback: - -#ifndef HAVE_NDO_SELECT_QUEUE_ACCEL_FALLBACK - return skb_tx_hash(netdev, skb); -#else -#ifdef HAVE_NDO_SELECT_QUEUE_SB_DEV return fallback(netdev, skb, sb_dev); -#else - return fallback(netdev, skb); -#endif -#endif }
-#ifdef HAVE_NDO_GET_STATS64 -#ifdef HAVE_VOID_NDO_GET_STATS64 static void hinic_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats) -#else -static struct rtnl_link_stats64 - *hinic_get_stats64(struct net_device *netdev, - struct rtnl_link_stats64 *stats) -#endif - -#else /* !HAVE_NDO_GET_STATS64 */ -static struct net_device_stats *hinic_get_stats(struct net_device *netdev) -#endif { struct hinic_nic_dev *nic_dev = netdev_priv(netdev); -#ifndef HAVE_NDO_GET_STATS64 -#ifdef HAVE_NETDEV_STATS_IN_NETDEV - struct net_device_stats *stats = &netdev->stats; -#else - struct net_device_stats *stats = &nic_dev->net_stats; -#endif /* HAVE_NETDEV_STATS_IN_NETDEV */ -#endif /* HAVE_NDO_GET_STATS64 */ struct hinic_txq_stats *txq_stats; struct hinic_rxq_stats *rxq_stats; struct hinic_txq *txq; @@ -1289,10 +1237,6 @@ static struct net_device_stats *hinic_get_stats(struct net_device *netdev) stats->rx_bytes = bytes; stats->rx_errors = errors; stats->rx_dropped = dropped; - -#ifndef HAVE_VOID_NDO_GET_STATS64 - return stats; -#endif }
static void hinic_tx_timeout(struct net_device *netdev) @@ -1495,12 +1439,8 @@ static int set_features(struct hinic_nic_dev *nic_dev, return err; }
-#ifdef HAVE_RHEL6_NET_DEVICE_OPS_EXT -static int hinic_set_features(struct net_device *netdev, u32 features) -#else static int hinic_set_features(struct net_device *netdev, netdev_features_t features) -#endif { struct hinic_nic_dev *nic_dev = netdev_priv(netdev);
@@ -1508,12 +1448,8 @@ static int hinic_set_features(struct net_device *netdev, features, false); }
-#ifdef HAVE_RHEL6_NET_DEVICE_OPS_EXT -static u32 hinic_fix_features(struct net_device *netdev, u32 features) -#else static netdev_features_t hinic_fix_features(struct net_device *netdev, netdev_features_t features) -#endif { /* If Rx checksum is disabled, then LRO should also be disabled */ if (!(features & NETIF_F_RXCSUM)) @@ -1577,52 +1513,23 @@ static int hinic_set_default_hw_feature(struct hinic_nic_dev *nic_dev) return set_features(nic_dev, 0, nic_dev->netdev->features, true); }
-#ifdef NETIF_F_HW_TC -#ifdef TC_MQPRIO_HW_OFFLOAD_MAX static int hinic_setup_tc_mqprio(struct net_device *dev, struct tc_mqprio_qopt *mqprio) { mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS; return hinic_setup_tc(dev, mqprio->num_tc); } -#endif /* TC_MQPRIO_HW_OFFLOAD_MAX */
-#if defined(HAVE_NDO_SETUP_TC_REMOVE_TC_TO_NETDEV) static int __hinic_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data) -#elif defined(HAVE_NDO_SETUP_TC_CHAIN_INDEX) -static int __hinic_setup_tc(struct net_device *dev, __always_unused u32 handle, - u32 chain_index, __always_unused __be16 proto, - struct tc_to_netdev *tc) -#else -static int __hinic_setup_tc(struct net_device *dev, __always_unused u32 handle, - __always_unused __be16 proto, - struct tc_to_netdev *tc) -#endif { -#ifndef HAVE_NDO_SETUP_TC_REMOVE_TC_TO_NETDEV - unsigned int type = tc->type; - -#ifdef HAVE_NDO_SETUP_TC_CHAIN_INDEX - if (chain_index) - return -EOPNOTSUPP; - -#endif -#endif switch (type) { case TC_SETUP_QDISC_MQPRIO: -#if defined(HAVE_NDO_SETUP_TC_REMOVE_TC_TO_NETDEV) return hinic_setup_tc_mqprio(dev, type_data); -#elif defined(TC_MQPRIO_HW_OFFLOAD_MAX) - return hinic_setup_tc_mqprio(dev, tc->mqprio); -#else - return hinic_setup_tc(dev, tc->tc); -#endif default: return -EOPNOTSUPP; } } -#endif /* NETIF_F_HW_TC */
#ifdef CONFIG_NET_POLL_CONTROLLER static void hinic_netpoll(struct net_device *netdev) @@ -1974,43 +1881,6 @@ static void hinic_update_mac_filter(struct hinic_nic_dev *nic_dev, } }
-#ifndef NETDEV_HW_ADDR_T_MULTICAST -static void hinic_update_mc_filter(struct hinic_nic_dev *nic_dev, - struct list_head *filter_list) -{ - struct dev_mc_list *ha; - struct hinic_mac_filter *f, *ftmp, *filter; - - /* add addr if not already in the filter list */ - netif_addr_lock_bh(nic_dev->netdev); - netdev_for_each_mc_addr(ha, nic_dev->netdev) { - filter = hinic_find_mac(filter_list, ha->da_addr); - if (!filter) - hinic_add_filter(nic_dev, filter_list, ha->da_addr); - else if (filter->state == HINIC_MAC_WAIT_HW_UNSYNC) - filter->state = HINIC_MAC_HW_SYNCED; - } - netif_addr_unlock_bh(nic_dev->netdev); - /* delete addr if not in netdev list */ - list_for_each_entry_safe(f, ftmp, filter_list, list) { - bool found = false; - - netif_addr_lock_bh(nic_dev->netdev); - netdev_for_each_mc_addr(ha, nic_dev->netdev) - if (ether_addr_equal(ha->da_addr, f->addr)) { - found = true; - break; - } - netif_addr_unlock_bh(nic_dev->netdev); - - if (found) - continue; - - hinic_del_filter(nic_dev, f); - } -} -#endif - static void __update_mac_filter(struct hinic_nic_dev *nic_dev) { struct net_device *netdev = nic_dev->netdev; @@ -2018,12 +1888,8 @@ static void __update_mac_filter(struct hinic_nic_dev *nic_dev) if (test_and_clear_bit(HINIC_UPDATE_MAC_FILTER, &nic_dev->flags)) { hinic_update_mac_filter(nic_dev, &netdev->uc, &nic_dev->uc_filter_list); -#ifdef NETDEV_HW_ADDR_T_MULTICAST hinic_update_mac_filter(nic_dev, &netdev->mc, &nic_dev->mc_filter_list); -#else - hinic_update_mc_filter(nic_dev, &nic_dev->mc_filter_list); -#endif } }
@@ -2104,124 +1970,44 @@ static const struct net_device_ops hinic_netdev_ops = { .ndo_open = hinic_open, .ndo_stop = hinic_close, .ndo_start_xmit = hinic_xmit_frame, - -#ifdef HAVE_NDO_GET_STATS64 .ndo_get_stats64 = hinic_get_stats64, -#else - .ndo_get_stats = hinic_get_stats, -#endif /* HAVE_NDO_GET_STATS64 */ - .ndo_tx_timeout = hinic_tx_timeout, .ndo_select_queue = hinic_select_queue, -#ifdef HAVE_RHEL7_NETDEV_OPS_EXT_NDO_CHANGE_MTU - .extended.ndo_change_mtu = hinic_change_mtu, -#else .ndo_change_mtu = hinic_change_mtu, -#endif .ndo_set_mac_address = hinic_set_mac_addr, .ndo_validate_addr = eth_validate_addr, #if defined(NETIF_F_HW_VLAN_TX) || defined(NETIF_F_HW_VLAN_CTAG_TX) .ndo_vlan_rx_add_vid = hinic_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = hinic_vlan_rx_kill_vid, #endif -#ifdef HAVE_RHEL7_NET_DEVICE_OPS_EXT - /* RHEL7 requires this to be defined to enable extended ops. RHEL7 - * uses the function get_ndo_ext to retrieve offsets for extended - * fields from with the net_device_ops struct and ndo_size is checked - * to determine whether or not the offset is valid. - */ - .ndo_size = sizeof(const struct net_device_ops), -#endif -#ifdef IFLA_VF_MAX + .ndo_set_vf_mac = hinic_ndo_set_vf_mac, -#ifdef HAVE_RHEL7_NETDEV_OPS_EXT_NDO_SET_VF_VLAN - .extended.ndo_set_vf_vlan = hinic_ndo_set_vf_vlan, -#else .ndo_set_vf_vlan = hinic_ndo_set_vf_vlan, -#endif -#ifdef HAVE_NDO_SET_VF_MIN_MAX_TX_RATE .ndo_set_vf_rate = hinic_ndo_set_vf_bw, -#else - .ndo_set_vf_tx_rate = hinic_ndo_set_vf_bw, -#endif /* HAVE_NDO_SET_VF_MIN_MAX_TX_RATE */ -#ifdef HAVE_VF_SPOOFCHK_CONFIGURE .ndo_set_vf_spoofchk = hinic_ndo_set_vf_spoofchk, -#endif -#ifdef HAVE_NDO_SET_VF_TRUST -#ifdef HAVE_RHEL7_NET_DEVICE_OPS_EXT - .extended.ndo_set_vf_trust = hinic_ndo_set_vf_trust, -#else .ndo_set_vf_trust = hinic_ndo_set_vf_trust, -#endif /* HAVE_RHEL7_NET_DEVICE_OPS_EXT */ -#endif /* HAVE_NDO_SET_VF_TRUST */ - .ndo_get_vf_config = hinic_ndo_get_vf_config, -#endif
-#ifdef HAVE_RHEL7_NETDEV_OPS_EXT_NDO_SETUP_TC - .extended.ndo_setup_tc_rh = __hinic_setup_tc, -#else -#ifdef HAVE_SETUP_TC -#ifdef NETIF_F_HW_TC .ndo_setup_tc = __hinic_setup_tc, -#else - .ndo_setup_tc = hinic_setup_tc, -#endif /* NETIF_F_HW_TC */ -#endif /* HAVE_SETUP_TC */ -#endif
#ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = hinic_netpoll, #endif /* CONFIG_NET_POLL_CONTROLLER */
.ndo_set_rx_mode = hinic_nic_set_rx_mode, - -#ifdef HAVE_RHEL6_NET_DEVICE_OPS_EXT -}; - -/* RHEL6 keeps these operations in a separate structure */ -static const struct net_device_ops_ext hinic_netdev_ops_ext = { - .size = sizeof(struct net_device_ops_ext), -#endif /* HAVE_RHEL6_NET_DEVICE_OPS_EXT */ - -#ifdef HAVE_NDO_SET_VF_LINK_STATE .ndo_set_vf_link_state = hinic_ndo_set_vf_link_state, -#endif - -#ifdef HAVE_NDO_SET_FEATURES .ndo_fix_features = hinic_fix_features, .ndo_set_features = hinic_set_features, -#endif /* HAVE_NDO_SET_FEATURES */ };
static const struct net_device_ops hinicvf_netdev_ops = { .ndo_open = hinic_open, .ndo_stop = hinic_close, .ndo_start_xmit = hinic_xmit_frame, - -#ifdef HAVE_NDO_GET_STATS64 .ndo_get_stats64 = hinic_get_stats64, -#else - .ndo_get_stats = hinic_get_stats, -#endif /* HAVE_NDO_GET_STATS64 */ - .ndo_tx_timeout = hinic_tx_timeout, .ndo_select_queue = hinic_select_queue, - -#ifdef HAVE_RHEL7_NET_DEVICE_OPS_EXT - /* RHEL7 requires this to be defined to enable extended ops. RHEL7 - * uses the function get_ndo_ext to retrieve offsets for extended - * fields from with the net_device_ops struct and ndo_size is checked - * to determine whether or not the offset is valid. - */ - .ndo_size = sizeof(const struct net_device_ops), -#endif - -#ifdef HAVE_RHEL7_NETDEV_OPS_EXT_NDO_CHANGE_MTU - .extended.ndo_change_mtu = hinic_change_mtu, -#else .ndo_change_mtu = hinic_change_mtu, -#endif .ndo_set_mac_address = hinic_set_mac_addr, .ndo_validate_addr = eth_validate_addr, #if defined(NETIF_F_HW_VLAN_TX) || defined(NETIF_F_HW_VLAN_CTAG_TX) @@ -2235,31 +2021,14 @@ static const struct net_device_ops hinicvf_netdev_ops = {
.ndo_set_rx_mode = hinic_nic_set_rx_mode,
-#ifdef HAVE_RHEL6_NET_DEVICE_OPS_EXT -}; - -/* RHEL6 keeps these operations in a separate structure */ -static const struct net_device_ops_ext hinicvf_netdev_ops_ext = { - .size = sizeof(struct net_device_ops_ext), -#endif /* HAVE_RHEL6_NET_DEVICE_OPS_EXT */ - -#ifdef HAVE_NDO_SET_FEATURES .ndo_fix_features = hinic_fix_features, .ndo_set_features = hinic_set_features, -#endif /* HAVE_NDO_SET_FEATURES */ };
static void netdev_feature_init(struct net_device *netdev) { struct hinic_nic_dev *nic_dev = netdev_priv(netdev); - -#ifdef HAVE_NDO_SET_FEATURES -#ifndef HAVE_RHEL6_NET_DEVICE_OPS_EXT netdev_features_t hw_features; -#else - u32 hw_features; -#endif -#endif
netdev->features = NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | @@ -2271,12 +2040,9 @@ static void netdev_feature_init(struct net_device *netdev)
netdev->vlan_features = netdev->features;
- if (FUNC_SUPPORT_ENCAP_TSO_CSUM(nic_dev->hwdev)) { -#ifdef HAVE_ENCAPSULATION_TSO + if (FUNC_SUPPORT_ENCAP_TSO_CSUM(nic_dev->hwdev)) netdev->features |= NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM; -#endif /* HAVE_ENCAPSULATION_TSO */ - }
if (FUNC_SUPPORT_HW_VLAN(nic_dev->hwdev)) { #if defined(NETIF_F_HW_VLAN_CTAG_TX) @@ -2292,15 +2058,10 @@ static void netdev_feature_init(struct net_device *netdev) #endif }
-#ifdef HAVE_NDO_SET_FEATURES /* copy netdev features into list of user selectable features */ -#ifdef HAVE_RHEL6_NET_DEVICE_OPS_EXT - hw_features = get_netdev_hw_features(netdev); -#else hw_features = netdev->hw_features; -#endif hw_features |= netdev->features; -#endif + if (FUNC_SUPPORT_LRO(nic_dev->hwdev)) { /* LRO is disable in default, only set hw features */ hw_features |= NETIF_F_LRO; @@ -2311,13 +2072,7 @@ static void netdev_feature_init(struct net_device *netdev) netdev->features |= NETIF_F_LRO; }
-#ifdef HAVE_NDO_SET_FEATURES -#ifdef HAVE_RHEL6_NET_DEVICE_OPS_EXT - set_netdev_hw_features(netdev, hw_features); -#else netdev->hw_features = hw_features; -#endif -#endif
/* Set after hw_features because this could not be part of hw_features */ #if defined(NETIF_F_HW_VLAN_CTAG_FILTER) @@ -2331,16 +2086,12 @@ static void netdev_feature_init(struct net_device *netdev) #endif
if (FUNC_SUPPORT_ENCAP_TSO_CSUM(nic_dev->hwdev)) { -#ifdef HAVE_ENCAPSULATION_CSUM netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SCTP_CRC | NETIF_F_SG; -#ifdef HAVE_ENCAPSULATION_TSO netdev->hw_enc_features |= NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_UDP_TUNNEL; -#endif /* HAVE_ENCAPSULATION_TSO */ -#endif /* HAVE_ENCAPSULATION_CSUM */ } }
@@ -2486,15 +2237,9 @@ static int hinic_sw_init(struct hinic_nic_dev *adapter) }
/* MTU range: 256 - 9600 */ -#ifdef HAVE_NETDEVICE_MIN_MAX_MTU netdev->min_mtu = HINIC_MIN_MTU_SIZE; netdev->max_mtu = HINIC_MAX_JUMBO_FRAME_SIZE; -#endif
-#ifdef HAVE_NETDEVICE_EXTENDED_MIN_MAX_MTU - netdev->extended->min_mtu = HINIC_MIN_MTU_SIZE; - netdev->extended->max_mtu = HINIC_MAX_JUMBO_FRAME_SIZE; -#endif return 0;
set_mac_err: @@ -2511,17 +2256,11 @@ static void hinic_assign_netdev_ops(struct hinic_nic_dev *adapter) { if (!HINIC_FUNC_IS_VF(adapter->hwdev)) { adapter->netdev->netdev_ops = &hinic_netdev_ops; -#ifdef HAVE_RHEL6_NET_DEVICE_OPS_EXT - set_netdev_ops_ext(adapter->netdev, &hinic_netdev_ops_ext); -#endif /* HAVE_RHEL6_NET_DEVICE_OPS_EXT */ if (FUNC_SUPPORT_DCB(adapter->hwdev)) adapter->netdev->dcbnl_ops = &hinic_dcbnl_ops; hinic_set_ethtool_ops(adapter->netdev); } else { adapter->netdev->netdev_ops = &hinicvf_netdev_ops; -#ifdef HAVE_RHEL6_NET_DEVICE_OPS_EXT - set_netdev_ops_ext(adapter->netdev, &hinicvf_netdev_ops_ext); -#endif /* HAVE_RHEL6_NET_DEVICE_OPS_EXT */ hinicvf_set_ethtool_ops(adapter->netdev); } adapter->netdev->watchdog_timeo = 5 * HZ; @@ -3025,9 +2764,8 @@ static int nic_probe(struct hinic_lld_dev *lld_dev, void **uld_dev, if (err) goto set_features_err;
-#ifdef HAVE_MULTI_VLAN_OFFLOAD_EN hinic_register_notifier(nic_dev); -#endif + err = register_netdev(netdev); if (err) { nic_err(&pdev->dev, "Failed to register netdev\n"); @@ -3043,9 +2781,7 @@ static int nic_probe(struct hinic_lld_dev *lld_dev, void **uld_dev, return 0;
netdev_err: -#ifdef HAVE_MULTI_VLAN_OFFLOAD_EN hinic_unregister_notifier(nic_dev); -#endif
set_features_err: destroy_workqueue(nic_dev->workq); @@ -3083,10 +2819,8 @@ static void nic_remove(struct hinic_lld_dev *lld_dev, void *adapter) netdev = nic_dev->netdev;
unregister_netdev(netdev); -#ifdef HAVE_MULTI_VLAN_OFFLOAD_EN hinic_unregister_notifier(nic_dev);
-#endif cancel_work_sync(&nic_dev->rx_mode_work); destroy_workqueue(nic_dev->workq);
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c index 9acde2025cd6..5cdcc3ec16c0 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c @@ -3056,30 +3056,18 @@ void hinic_get_vf_config(void *hwdev, u16 vf_id, struct ifla_vf_info *ivi) memcpy(ivi->mac, vfinfo->vf_mac_addr, ETH_ALEN); ivi->vlan = vfinfo->pf_vlan; ivi->qos = vfinfo->pf_qos; - -#ifdef HAVE_VF_SPOOFCHK_CONFIGURE ivi->spoofchk = vfinfo->spoofchk; -#endif - -#ifdef HAVE_NDO_SET_VF_TRUST ivi->trusted = vfinfo->trust; -#endif
-#ifdef HAVE_NDO_SET_VF_MIN_MAX_TX_RATE ivi->max_tx_rate = vfinfo->max_rate; ivi->min_tx_rate = vfinfo->min_rate; -#else - ivi->tx_rate = vfinfo->max_rate; -#endif /* HAVE_NDO_SET_VF_MIN_MAX_TX_RATE */
-#ifdef HAVE_NDO_SET_VF_LINK_STATE if (!vfinfo->link_forced) ivi->linkstate = IFLA_VF_LINK_STATE_AUTO; else if (vfinfo->link_up) ivi->linkstate = IFLA_VF_LINK_STATE_ENABLE; else ivi->linkstate = IFLA_VF_LINK_STATE_DISABLE; -#endif }
void hinic_clear_vf_infos(void *hwdev, u16 vf_id) @@ -3102,10 +3090,8 @@ void hinic_clear_vf_infos(void *hwdev, u16 vf_id) if (vf_infos->spoofchk) hinic_set_vf_spoofchk(hwdev, vf_id, false);
-#ifdef HAVE_NDO_SET_VF_TRUST if (vf_infos->trust) hinic_set_vf_trust(hwdev, vf_id, false); -#endif
memset(vf_infos, 0, sizeof(*vf_infos)); /* set vf_infos to default */ @@ -3225,7 +3211,6 @@ int hinic_set_vf_spoofchk(void *hwdev, u16 vf_id, bool spoofchk) return err; }
-#ifdef HAVE_NDO_SET_VF_TRUST int hinic_set_vf_trust(void *hwdev, u16 vf_id, bool trust) { struct hinic_hwdev *hw_dev = hwdev; @@ -3241,7 +3226,6 @@ int hinic_set_vf_trust(void *hwdev, u16 vf_id, bool trust)
return 0; } -#endif
bool hinic_vf_info_spoofchk(void *hwdev, int vf_id) { @@ -3251,7 +3235,6 @@ bool hinic_vf_info_spoofchk(void *hwdev, int vf_id) return spoofchk; }
-#ifdef HAVE_NDO_SET_VF_TRUST bool hinic_vf_info_trust(void *hwdev, int vf_id) { struct hinic_nic_io *nic_io = ((struct hinic_hwdev *)hwdev)->nic_io; @@ -3259,7 +3242,6 @@ bool hinic_vf_info_trust(void *hwdev, int vf_id)
return trust; } -#endif
static int hinic_set_vf_rate_limit(void *hwdev, u16 vf_id, u32 tx_rate) { diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.h b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.h index 3d98c5a7246c..89b324912879 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.h @@ -596,10 +596,8 @@ int hinic_set_vf_spoofchk(void *hwdev, u16 vf_id, bool spoofchk);
bool hinic_vf_info_spoofchk(void *hwdev, int vf_id);
-#ifdef HAVE_NDO_SET_VF_TRUST int hinic_set_vf_trust(void *hwdev, u16 vf_id, bool trust); bool hinic_vf_info_trust(void *hwdev, int vf_id); -#endif
int hinic_set_vf_tx_rate(void *hwdev, u16 vf_id, u32 max_rate, u32 min_rate);
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_dev.h b/drivers/net/ethernet/huawei/hinic/hinic_nic_dev.h index 1e050c3f8c0a..0af97bb34d7a 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_dev.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_dev.h @@ -149,11 +149,7 @@ struct hinic_nic_stats { u64 tx_carrier_off_drop; u64 tx_invalid_qid;
-#ifdef HAVE_NDO_GET_STATS64 struct u64_stats_sync syncp; -#else - struct u64_stats_sync_empty syncp; -#endif };
struct hinic_nic_dev { @@ -236,9 +232,6 @@ struct hinic_nic_dev { bool in_vm; bool is_vm_slave; int is_bm_slave; -#ifndef HAVE_NETDEV_STATS_IN_NETDEV - struct net_device_stats net_stats; -#endif struct hinic_nic_stats stats; /* lock for nic resource */ struct mutex nic_mutex; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nictool.c b/drivers/net/ethernet/huawei/hinic/hinic_nictool.c index df01088a02f8..62b1535fe8af 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nictool.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_nictool.c @@ -363,9 +363,6 @@ static int clear_func_static(struct hinic_nic_dev *nic_dev, void *buf_in, int i;
*out_size = 0; -#ifndef HAVE_NETDEV_STATS_IN_NETDEV - memset(&nic_dev->net_stats, 0, sizeof(nic_dev->net_stats)); -#endif clean_nicdev_stats(nic_dev); for (i = 0; i < nic_dev->max_qps; i++) { hinic_rxq_clean_stats(&nic_dev->rxqs[i].rxq_stats); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.h b/drivers/net/ethernet/huawei/hinic/hinic_rx.h index 9b4abfe183d4..59500b2762c1 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.h @@ -49,11 +49,8 @@ struct hinic_rxq_stats { u64 dropped;
u64 alloc_skb_err; -#ifdef HAVE_NDO_GET_STATS64 + struct u64_stats_sync syncp; -#else - struct u64_stats_sync_empty syncp; -#endif };
struct hinic_rx_info { diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c index 73ab2d716739..68a397ae73bf 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c @@ -265,7 +265,6 @@ int hinic_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) }
/*lint -save -e574 -e734*/ -#ifdef IFLA_VF_MAX static int set_hw_vf_vlan(struct hinic_sriov_info *sriov_info, u16 cur_vlanprio, int vf, u16 vlan, u8 qos) { @@ -302,12 +301,8 @@ static int set_hw_vf_vlan(struct hinic_sriov_info *sriov_info, OS_VF_ID_TO_HW(vf)); }
-#ifdef IFLA_VF_VLAN_INFO_MAX int hinic_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos, __be16 vlan_proto) -#else -int hinic_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos) -#endif { struct hinic_nic_dev *adapter = netdev_priv(netdev); struct hinic_sriov_info *sriov_info; @@ -322,10 +317,10 @@ int hinic_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos) sriov_info = hinic_get_sriov_info_by_pcidev(adapter->pdev); if (vf >= sriov_info->num_vfs || vlan > 4095 || qos > 7) return -EINVAL; -#ifdef IFLA_VF_VLAN_INFO_MAX + if (vlan_proto != htons(ETH_P_8021Q)) return -EPROTONOSUPPORT; -#endif + vlanprio = vlan | qos << HINIC_VLAN_PRIORITY_SHIFT; cur_vlanprio = hinic_vf_info_vlanprio(sriov_info->hwdev, OS_VF_ID_TO_HW(vf)); @@ -335,9 +330,7 @@ int hinic_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
return set_hw_vf_vlan(sriov_info, cur_vlanprio, vf, vlan, qos); } -#endif
-#ifdef HAVE_VF_SPOOFCHK_CONFIGURE int hinic_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting) { struct hinic_nic_dev *adapter = netdev_priv(netdev); @@ -369,9 +362,7 @@ int hinic_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting)
return err; } -#endif
-#ifdef HAVE_NDO_SET_VF_TRUST int hinic_ndo_set_vf_trust(struct net_device *netdev, int vf, bool setting) { struct hinic_nic_dev *adapter = netdev_priv(netdev); @@ -400,7 +391,6 @@ int hinic_ndo_set_vf_trust(struct net_device *netdev, int vf, bool setting)
return err; } -#endif
int hinic_ndo_get_vf_config(struct net_device *netdev, int vf, struct ifla_vf_info *ivi) @@ -458,19 +448,12 @@ int hinic_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link)
#define HINIC_TX_RATE_TABLE_FULL 12
-#ifdef HAVE_NDO_SET_VF_MIN_MAX_TX_RATE int hinic_ndo_set_vf_bw(struct net_device *netdev, int vf, int min_tx_rate, int max_tx_rate) -#else -int hinic_ndo_set_vf_bw(struct net_device *netdev, int vf, int max_tx_rate) -#endif /* HAVE_NDO_SET_VF_MIN_MAX_TX_RATE */ { struct hinic_nic_dev *adapter = netdev_priv(netdev); struct nic_port_info port_info = {0}; struct hinic_sriov_info *sriov_info; -#ifndef HAVE_NDO_SET_VF_MIN_MAX_TX_RATE - int min_tx_rate = 0; -#endif u8 link_status = 0; u32 speeds[] = {SPEED_10, SPEED_100, SPEED_1000, SPEED_10000, SPEED_25000, SPEED_40000, SPEED_100000}; @@ -532,15 +515,9 @@ int hinic_ndo_set_vf_bw(struct net_device *netdev, int vf, int max_tx_rate) return -EIO; }
-#ifdef HAVE_NDO_SET_VF_MIN_MAX_TX_RATE nicif_info(adapter, drv, netdev, "Set VF %d max tx rate %d min tx rate %d successfully\n", vf, max_tx_rate, min_tx_rate); -#else - nicif_info(adapter, drv, netdev, - "Set VF %d tx rate %d successfully\n", - vf, max_tx_rate); -#endif
return 0; } diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sriov.h b/drivers/net/ethernet/huawei/hinic/hinic_sriov.h index a1188fd40992..b2aded0190d0 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_sriov.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_sriov.h @@ -43,33 +43,19 @@ struct hinic_sriov_info { int hinic_pci_sriov_disable(struct pci_dev *dev); int hinic_pci_sriov_enable(struct pci_dev *dev, int num_vfs); int hinic_pci_sriov_configure(struct pci_dev *dev, int num_vfs); -#ifdef IFLA_VF_MAX int hinic_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac); -#ifdef IFLA_VF_VLAN_INFO_MAX int hinic_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos, __be16 vlan_proto); -#else -int hinic_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos); -#endif
int hinic_ndo_get_vf_config(struct net_device *netdev, int vf, struct ifla_vf_info *ivi);
-#ifdef HAVE_VF_SPOOFCHK_CONFIGURE int hinic_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting); -#endif
-#ifdef HAVE_NDO_SET_VF_TRUST int hinic_ndo_set_vf_trust(struct net_device *netdev, int vf, bool setting); -#endif
int hinic_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link);
-#ifdef HAVE_NDO_SET_VF_MIN_MAX_TX_RATE int hinic_ndo_set_vf_bw(struct net_device *netdev, int vf, int min_tx_rate, int max_tx_rate); -#else -int hinic_ndo_set_vf_bw(struct net_device *netdev, int vf, int max_tx_rate); -#endif /* HAVE_NDO_SET_VF_MIN_MAX_TX_RATE */ -#endif #endif diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.h b/drivers/net/ethernet/huawei/hinic/hinic_tx.h index cfbd4deb5b0b..8d95019528f9 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_tx.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.h @@ -44,11 +44,7 @@ struct hinic_txq_stats { u64 map_frag_err; u64 frag_size_err;
-#ifdef HAVE_NDO_GET_STATS64 struct u64_stats_sync syncp; -#else - struct u64_stats_sync_empty syncp; -#endif };
struct hinic_dma_len { diff --git a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h index 558ed4d9c17a..062f4f67a819 100644 --- a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h +++ b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h @@ -99,7 +99,6 @@
/*****************************************************************************/ #define ETH_TYPE_TRANS_SETS_DEV -#define HAVE_NETDEV_STATS_IN_NETDEV
/*****************************************************************************/
@@ -108,28 +107,6 @@ (RHEL_RELEASE_VERSION(7, 0) > RHEL_RELEASE_CODE)) #define HAVE_RHEL6_NET_DEVICE_EXTENDED #endif /* RHEL >= 6.2 && RHEL < 7.0 */ -#if (RHEL_RELEASE_CODE && \ - (RHEL_RELEASE_VERSION(6, 6) <= RHEL_RELEASE_CODE) && \ - (RHEL_RELEASE_VERSION(7, 0) > RHEL_RELEASE_CODE)) -#define HAVE_RHEL6_NET_DEVICE_OPS_EXT -#define HAVE_NDO_SET_FEATURES -#endif /* RHEL >= 6.6 && RHEL < 7.0 */ - -#define HAVE_NDO_GET_STATS64 - -/*****************************************************************************/ -#ifndef HAVE_SETUP_TC -#define HAVE_SETUP_TC -#endif - -#ifndef HAVE_NDO_SET_FEATURES -#define HAVE_NDO_SET_FEATURES -#endif - -/*****************************************************************************/ -#define HAVE_VF_SPOOFCHK_CONFIGURE - -#define HAVE_NDO_SET_VF_TRUST
/*****************************************************************************/ #define HAVE_NAPI_GRO_FLUSH_OLD @@ -139,42 +116,16 @@ #define HAVE_SRIOV_CONFIGURE #endif
-/*****************************************************************************/ -#define HAVE_NDO_SET_VF_LINK_STATE - /*****************************************************************************/ #define HAVE_NDO_SELECT_QUEUE_ACCEL
-#define HAVE_NDO_SELECT_QUEUE_ACCEL_FALLBACK - -/*****************************************************************************/ -#define HAVE_NDO_SET_VF_MIN_MAX_TX_RATE - /*****************************************************************************/ #define HAVE_SKBUFF_CSUM_LEVEL -#define HAVE_MULTI_VLAN_OFFLOAD_EN - -/*****************************************************************************/ -#define HAVE_NETDEVICE_MIN_MAX_MTU - -/*****************************************************************************/ -#define HAVE_VOID_NDO_GET_STATS64 - -/*****************************************************************************/ -#define HAVE_NDO_SETUP_TC_CHAIN_INDEX - -/*****************************************************************************/ -#define HAVE_NDO_SETUP_TC_REMOVE_TC_TO_NETDEV -/*****************************************************************************/
/*****************************************************************************/ #define HAVE_TIMER_SETUP /*****************************************************************************/
-/*****************************************************************************/ -#define HAVE_NDO_SELECT_QUEUE_SB_DEV -/*****************************************************************************/ - /* vxlan outer udp checksum will offload and skb->inner_transport_header * is wrong */ @@ -184,10 +135,6 @@ #define HAVE_OUTER_IPV6_TUNNEL_OFFLOAD #endif
-#define HAVE_ENCAPSULATION_TSO - -#define HAVE_ENCAPSULATION_CSUM - int local_atoi(const char *name);
#define nicif_err(priv, type, dev, fmt, args...) \