From: Chiqijun chiqijun@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
Delete unused functions and macro definitions in ossl.
Signed-off-by: Chiqijun chiqijun@huawei.com Reviewed-by: Zengweiliang zengweiliang.zengweiliang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/huawei/hinic/ossl_knl.h | 16 -- .../ethernet/huawei/hinic/ossl_knl_linux.c | 85 ------ .../ethernet/huawei/hinic/ossl_knl_linux.h | 255 ------------------ .../net/ethernet/huawei/hinic/ossl_types.h | 41 --- 4 files changed, 397 deletions(-) delete mode 100644 drivers/net/ethernet/huawei/hinic/ossl_types.h
diff --git a/drivers/net/ethernet/huawei/hinic/ossl_knl.h b/drivers/net/ethernet/huawei/hinic/ossl_knl.h index 7f19deba7d4c..1dae5ca63d04 100644 --- a/drivers/net/ethernet/huawei/hinic/ossl_knl.h +++ b/drivers/net/ethernet/huawei/hinic/ossl_knl.h @@ -18,22 +18,6 @@
#include "ossl_knl_linux.h"
-#if defined(__WIN__) || defined(__VMWARE__) -#define __WIN_OR_VMWARE__ -#endif - -#if defined(__WIN__) || defined(__VMWARE__) || defined(__UEFI__) -#define __WIN_OR_VMWARE_OR_UEFI__ -#endif - -#if (defined(__WIN__) || defined(__VMWARE__)) && !defined(__HIFC__) -#define __WIN_OR_VMWARE_AND_NONHIFC__ -#endif - -#if defined(__WIN__) || defined(__UEFI__) -#define __WIN_OR_UEFI__ -#endif - #define sdk_err(dev, format, ...) \ dev_err(dev, "[COMM]"format, ##__VA_ARGS__) #define sdk_warn(dev, format, ...) \ diff --git a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.c b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.c index 798faa6f401d..daed2eca32c1 100644 --- a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.c +++ b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.c @@ -17,91 +17,6 @@
#include "ossl_knl_linux.h"
-#define OSSL_MINUTE_BASE (60) - -sdk_file *file_creat(const char *file_name) -{ - return filp_open(file_name, O_CREAT | O_RDWR | O_APPEND, 0); -} - -sdk_file *file_open(const char *file_name) -{ - return filp_open(file_name, O_RDONLY, 0); -} - -void file_close(sdk_file *file_handle) -{ - (void)filp_close(file_handle, NULL); -} - -u32 get_file_size(sdk_file *file_handle) -{ - struct inode *file_inode; - - file_inode = file_handle->f_inode; - - return (u32)(file_inode->i_size); -} - -void set_file_position(sdk_file *file_handle, u32 position) -{ - file_handle->f_pos = position; -} - -int file_read(sdk_file *file_handle, char *log_buffer, - u32 rd_length, u32 *file_pos) -{ - return (int)file_handle->f_op->read(file_handle, log_buffer, - rd_length, &file_handle->f_pos); -} - -u32 file_write(sdk_file *file_handle, char *log_buffer, u32 wr_length) -{ - return (u32)file_handle->f_op->write(file_handle, log_buffer, - wr_length, &file_handle->f_pos); -} - -static int _linux_thread_func(void *thread) -{ - struct sdk_thread_info *info = (struct sdk_thread_info *)thread; - - while (!kthread_should_stop()) - info->thread_fn(info->data); - - return 0; -} - -int creat_thread(struct sdk_thread_info *thread_info) -{ - thread_info->thread_obj = kthread_run(_linux_thread_func, - thread_info, thread_info->name); - if (!thread_info->thread_obj) - return -EFAULT; - - return 0; -} - -void stop_thread(struct sdk_thread_info *thread_info) -{ - if (thread_info->thread_obj) - (void)kthread_stop(thread_info->thread_obj); -} - -void utctime_to_localtime(u64 utctime, u64 *localtime) -{ - *localtime = utctime - sys_tz.tz_minuteswest * OSSL_MINUTE_BASE; -} - -#ifndef HAVE_TIMER_SETUP -void initialize_timer(void *adapter_hdl, struct timer_list *timer) -{ - if (!adapter_hdl || !timer) - return; - - init_timer(timer); -} -#endif - void add_to_timer(struct timer_list *timer, long period) { if (!timer) diff --git a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h index f99e1dbf3fda..dd5d0fc949d7 100644 --- a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h +++ b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h @@ -29,16 +29,6 @@ #include <linux/udp.h> #include <linux/highmem.h>
-/* UTS_RELEASE is in a different header starting in kernel 2.6.18 */ -#ifndef UTS_RELEASE -/* utsrelease.h changed locations in 2.6.33 */ -#include <generated/utsrelease.h> -#endif - -#ifndef NETIF_F_SCTP_CSUM -#define NETIF_F_SCTP_CSUM 0 -#endif - #ifndef __GFP_COLD #define __GFP_COLD 0 #endif @@ -74,99 +64,15 @@ #define ADVERTISED_25000baseCR_Full 0 #endif
-#ifndef ETHTOOL_GLINKSETTINGS -enum ethtool_link_mode_bit_indices { - ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17, - ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19, - ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23, - ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24, - ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 31, - ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 32, - ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT = 36, - ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT = 38, -}; -#endif - #ifndef RHEL_RELEASE_VERSION #define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b)) #endif -#ifndef AX_RELEASE_VERSION -#define AX_RELEASE_VERSION(a, b) (((a) << 8) + (b)) -#endif - -#ifndef AX_RELEASE_CODE -#define AX_RELEASE_CODE 0 -#endif - -#if (AX_RELEASE_CODE && AX_RELEASE_CODE == AX_RELEASE_VERSION(3, 0)) -#define RHEL_RELEASE_CODE RHEL_RELEASE_VERSION(5, 0) -#elif (AX_RELEASE_CODE && AX_RELEASE_CODE == AX_RELEASE_VERSION(3, 1)) -#define RHEL_RELEASE_CODE RHEL_RELEASE_VERSION(5, 1) -#elif (AX_RELEASE_CODE && AX_RELEASE_CODE == AX_RELEASE_VERSION(3, 2)) -#define RHEL_RELEASE_CODE RHEL_RELEASE_VERSION(5, 3) -#endif
#ifndef RHEL_RELEASE_CODE /* NOTE: RHEL_RELEASE_* introduced in RHEL4.5. */ #define RHEL_RELEASE_CODE 0 #endif
-/* RHEL 7 didn't backport the parameter change in - * create_singlethread_workqueue. - * If/when RH corrects this we will want to tighten up the version check. - */ -#if (RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 0)) -#undef create_singlethread_workqueue -#define create_singlethread_workqueue(name) \ - alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name) -#endif - -/* Ubuntu Release ABI is the 4th digit of their kernel version. You can find - * it in /usr/src/linux/$(uname -r)/include/generated/utsrelease.h for new - * enough versions of Ubuntu. Otherwise you can simply see it in the output of - * uname as the 4th digit of the kernel. The UTS_UBUNTU_RELEASE_ABI is not in - * the linux-source package, but in the linux-headers package. It begins to - * appear in later releases of 14.04 and 14.10. - * - * Ex: - * <Ubuntu 14.04.1> - * $uname -r - * 3.13.0-45-generic - * ABI is 45 - * - * <Ubuntu 14.10> - * $uname -r - * 3.16.0-23-generic - * ABI is 23. - */ -#ifndef UTS_UBUNTU_RELEASE_ABI -#define UTS_UBUNTU_RELEASE_ABI 0 -#define UBUNTU_VERSION_CODE 0 -#else - -#if UTS_UBUNTU_RELEASE_ABI > 255 -#error UTS_UBUNTU_RELEASE_ABI is too large... -#endif /* UTS_UBUNTU_RELEASE_ABI > 255 */ - -#endif - -/* Note that the 3rd digit is always zero, and will be ignored. This is - * because Ubuntu kernels are based on x.y.0-ABI values, and while their linux - * version codes are 3 digit, this 3rd digit is superseded by the ABI value. - */ -#define UBUNTU_VERSION(a, b, c, d) ((KERNEL_VERSION(a, b, 0) << 8) + (d)) - -#ifndef DEEPIN_PRODUCT_VERSION -#define DEEPIN_PRODUCT_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) -#endif - -#ifdef CONFIG_DEEPIN_KERNEL -#endif - -#ifndef DEEPIN_VERSION_CODE -#define DEEPIN_VERSION_CODE 0 -#endif - /* SuSE version macros are the same as Linux kernel version macro. */ #ifndef SLE_VERSION #define SLE_VERSION(a, b, c) KERNEL_VERSION(a, b, c) @@ -199,13 +105,6 @@ enum ethtool_link_mode_bit_indices { #define SLE_LOCALVERSION_CODE 0 #endif /* SLE_LOCALVERSION_CODE */
-#ifndef ALIGN_DOWN -#ifndef __ALIGN_KERNEL -#define __ALIGN_KERNEL(x, a) __ALIGN_MASK(x, (typeof(x))(a) - 1) -#endif -#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) -#endif - /*****************************************************************************/ #define ETH_TYPE_TRANS_SETS_DEV #define HAVE_NETDEV_STATS_IN_NETDEV @@ -224,23 +123,9 @@ enum ethtool_link_mode_bit_indices { #define HAVE_NDO_SET_FEATURES #endif /* RHEL >= 6.6 && RHEL < 7.0 */
-/*****************************************************************************/ - -/*****************************************************************************/ -#ifndef HAVE_SET_RX_MODE -#define HAVE_SET_RX_MODE -#endif -#define HAVE_INET6_IFADDR_LIST - -/*****************************************************************************/ - #define HAVE_NDO_GET_STATS64
/*****************************************************************************/ - -#ifndef HAVE_MQPRIO -#define HAVE_MQPRIO -#endif #ifndef HAVE_SETUP_TC #define HAVE_SETUP_TC #endif @@ -248,45 +133,21 @@ enum ethtool_link_mode_bit_indices { #ifndef HAVE_NDO_SET_FEATURES #define HAVE_NDO_SET_FEATURES #endif -#define HAVE_IRQ_AFFINITY_NOTIFY
/*****************************************************************************/ #define HAVE_ETHTOOL_SET_PHYS_ID
/*****************************************************************************/ -#define HAVE_NETDEV_WANTED_FEAUTES - -/*****************************************************************************/ -#ifndef HAVE_PCI_DEV_FLAGS_ASSIGNED -#define HAVE_PCI_DEV_FLAGS_ASSIGNED #define HAVE_VF_SPOOFCHK_CONFIGURE -#endif -#ifndef HAVE_SKB_L4_RXHASH -#define HAVE_SKB_L4_RXHASH -#endif
#define HAVE_NDO_SET_VF_TRUST
-/*****************************************************************************/ -#define HAVE_ETHTOOL_GRXFHINDIR_SIZE -#define HAVE_INT_NDO_VLAN_RX_ADD_VID -#ifdef ETHTOOL_SRXNTUPLE -#undef ETHTOOL_SRXNTUPLE -#endif - /*****************************************************************************/ #include <linux/kconfig.h>
#define _kc_kmap_atomic(page) kmap_atomic(page) #define _kc_kunmap_atomic(addr) kunmap_atomic(addr)
-/*****************************************************************************/ -#include <linux/of_net.h> -#define HAVE_FDB_OPS -#define HAVE_ETHTOOL_GET_TS_INFO - -/*****************************************************************************/ - /*****************************************************************************/ #define HAVE_NAPI_GRO_FLUSH_OLD
@@ -295,62 +156,11 @@ enum ethtool_link_mode_bit_indices { #define HAVE_SRIOV_CONFIGURE #endif
-/*****************************************************************************/ -#define HAVE_ENCAP_TSO_OFFLOAD -#define HAVE_SKB_INNER_NETWORK_HEADER -#if (RHEL_RELEASE_CODE && \ - (RHEL_RELEASE_VERSION(7, 0) <= RHEL_RELEASE_CODE) && \ - (RHEL_RELEASE_VERSION(8, 0) > RHEL_RELEASE_CODE)) -#define HAVE_RHEL7_PCI_DRIVER_RH -#if (RHEL_RELEASE_VERSION(7, 2) <= RHEL_RELEASE_CODE) -#define HAVE_RHEL7_PCI_RESET_NOTIFY -#endif /* RHEL >= 7.2 */ -#if (RHEL_RELEASE_VERSION(7, 3) <= RHEL_RELEASE_CODE) -#define HAVE_GENEVE_RX_OFFLOAD -#if !defined(HAVE_UDP_ENC_TUNNEL) && IS_ENABLED(CONFIG_GENEVE) -#define HAVE_UDP_ENC_TUNNEL -#endif -#ifdef ETHTOOL_GLINKSETTINGS -/* pay attention pangea platform when use this micro */ -#define HAVE_ETHTOOL_25G_BITS -#endif /* ETHTOOL_GLINKSETTINGS */ -#endif /* RHEL >= 7.3 */ - -/* new hooks added to net_device_ops_extended in RHEL7.4 */ -#if (RHEL_RELEASE_VERSION(7, 4) <= RHEL_RELEASE_CODE) -#define HAVE_RHEL7_NETDEV_OPS_EXT_NDO_UDP_TUNNEL -#define HAVE_UDP_ENC_RX_OFFLOAD -#endif /* RHEL >= 7.4 */ - -#if (RHEL_RELEASE_VERSION(7, 5) <= RHEL_RELEASE_CODE) -#define HAVE_NDO_SETUP_TC_REMOVE_TC_TO_NETDEV -#endif /* RHEL > 7.5 */ - -#endif /* RHEL >= 7.0 && RHEL < 8.0 */ - /*****************************************************************************/ #define HAVE_NDO_SET_VF_LINK_STATE -#define HAVE_SKB_INNER_PROTOCOL -#define HAVE_MPLS_FEATURES
/*****************************************************************************/ -#if (SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(12, 0, 0)) -#define HAVE_NDO_SELECT_QUEUE_ACCEL_FALLBACK -#endif -#define HAVE_NDO_GET_PHYS_PORT_ID -#define HAVE_NETIF_SET_XPS_QUEUE_CONST_MASK - -/*****************************************************************************/ -#define HAVE_VXLAN_CHECKS -#if (UBUNTU_VERSION_CODE && UBUNTU_VERSION_CODE >= UBUNTU_VERSION(3, 13, 0, 24)) -#define HAVE_NDO_SELECT_QUEUE_ACCEL_FALLBACK -#else #define HAVE_NDO_SELECT_QUEUE_ACCEL -#endif -#define HAVE_NET_GET_RANDOM_ONCE -#define HAVE_HWMON_DEVICE_REGISTER_WITH_GROUPS - -/*****************************************************************************/
#define HAVE_NDO_SELECT_QUEUE_ACCEL_FALLBACK
@@ -364,32 +174,14 @@ enum ethtool_link_mode_bit_indices { /*****************************************************************************/ #define HAVE_RXFH_HASHFUNC
-/*****************************************************************************/ - -/****************************************************************/ - -/****************************************************************/ - -/****************************************************************/ - -/****************************************************************/ - -/****************************************************************/ - -#define HAVE_IO_MAP_WC_SIZE - /*****************************************************************************/ #define HAVE_NETDEVICE_MIN_MAX_MTU
/*****************************************************************************/ #define HAVE_VOID_NDO_GET_STATS64 -#define HAVE_VM_OPS_FAULT_NO_VMA
/*****************************************************************************/ -#define HAVE_HWTSTAMP_FILTER_NTP_ALL #define HAVE_NDO_SETUP_TC_CHAIN_INDEX -#define HAVE_PCI_ERROR_HANDLER_RESET_PREPARE -#define HAVE_PTP_CLOCK_DO_AUX_WORK
/*****************************************************************************/ #define HAVE_NDO_SETUP_TC_REMOVE_TC_TO_NETDEV @@ -416,56 +208,9 @@ enum ethtool_link_mode_bit_indices {
#define HAVE_ENCAPSULATION_CSUM
-#ifndef eth_zero_addr -static inline void __kc_eth_zero_addr(u8 *addr) -{ - memset(addr, 0x00, ETH_ALEN); -} - -#define eth_zero_addr(_addr) __kc_eth_zero_addr(_addr) -#endif - -#ifndef netdev_hw_addr_list_for_each -#define netdev_hw_addr_list_for_each(ha, l) \ - list_for_each_entry(ha, &(l)->list, list) -#endif - #define spin_lock_deinit(lock)
-typedef struct file sdk_file; - -sdk_file *file_creat(const char *file_name); - -sdk_file *file_open(const char *file_name); - -void file_close(sdk_file *file_handle); - -u32 get_file_size(sdk_file *file_handle); - -void set_file_position(sdk_file *file_handle, u32 position); - -int file_read(sdk_file *file_handle, char *log_buffer, - u32 rd_length, u32 *file_pos); - -u32 file_write(sdk_file *file_handle, char *log_buffer, u32 wr_length); - -struct sdk_thread_info { - struct task_struct *thread_obj; - char *name; - void (*thread_fn)(void *x); - void *thread_event; - void *data; -}; - -int creat_thread(struct sdk_thread_info *thread_info); - -void stop_thread(struct sdk_thread_info *thread_info); - #define destroy_work(work) -void utctime_to_localtime(u64 utctime, u64 *localtime); -#ifndef HAVE_TIMER_SETUP -void initialize_timer(void *adapter_hdl, struct timer_list *timer); -#endif void add_to_timer(struct timer_list *timer, long period); void stop_timer(struct timer_list *timer); void delete_timer(struct timer_list *timer); diff --git a/drivers/net/ethernet/huawei/hinic/ossl_types.h b/drivers/net/ethernet/huawei/hinic/ossl_types.h deleted file mode 100644 index b8591541bb7c..000000000000 --- a/drivers/net/ethernet/huawei/hinic/ossl_types.h +++ /dev/null @@ -1,41 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0*/ -/* Huawei HiNIC PCI Express Linux driver - * Copyright(c) 2017 Huawei Technologies Co., Ltd - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * Statement: - * It must include "ossl_knl.h" or "ossl_user.h" before include "ossl_types.h" - */ - -#ifndef _OSSL_TYPES_H -#define _OSSL_TYPES_H - -#undef NULL -#if defined(__cplusplus) -#define NULL 0 -#else -#define NULL ((void *)0) -#endif - -#define uda_handle void * - -#define UDA_TRUE 1 -#define UDA_FALSE 0 - -#ifndef UINT8_MAX -#define UINT8_MAX (u8)(~((u8)0)) /* 0xFF */ -#define UINT16_MAX (u16)(~((u16)0)) /* 0xFFFF */ -#define UINT32_MAX (u32)(~((u32)0)) /* 0xFFFFFFFF */ -#define UINT64_MAX (u64)(~((u64)0)) /* 0xFFFFFFFFFFFFFFFF */ -#define ASCII_MAX (0x7F) -#endif - -#endif /* OSSL_TYPES_H */
From: Chiqijun chiqijun@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
Semaphore, spin_lock, etc. in linux do not need to be deinitialized, remove these useless definitions. Directly use the linux interface, the driver no longer encapsulates functions.
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_api_cmd.c | 20 ++------------ drivers/net/ethernet/huawei/hinic/hinic_cfg.c | 13 ---------- .../net/ethernet/huawei/hinic/hinic_cmdq.c | 6 ----- .../net/ethernet/huawei/hinic/hinic_hwdev.c | 7 ++--- .../net/ethernet/huawei/hinic/hinic_hwif.c | 2 -- .../net/ethernet/huawei/hinic/hinic_mbox.c | 13 ---------- .../net/ethernet/huawei/hinic/hinic_mgmt.c | 11 -------- .../net/ethernet/huawei/hinic/hinic_nic_cfg.c | 3 --- drivers/net/ethernet/huawei/hinic/hinic_rx.c | 3 +-- drivers/net/ethernet/huawei/hinic/hinic_tx.c | 4 +-- drivers/net/ethernet/huawei/hinic/hinic_wq.c | 2 -- .../ethernet/huawei/hinic/ossl_knl_linux.c | 22 ---------------- .../ethernet/huawei/hinic/ossl_knl_linux.h | 26 ------------------- 13 files changed, 7 insertions(+), 125 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_api_cmd.c b/drivers/net/ethernet/huawei/hinic/hinic_api_cmd.c index e611faa945b2..5a1e8655be38 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_api_cmd.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_api_cmd.c @@ -971,15 +971,13 @@ static int api_chain_init(struct hinic_api_cmd_chain *chain, cell_ctxt_size = chain->num_cells * sizeof(*chain->cell_ctxt); if (!cell_ctxt_size) { sdk_err(dev, "Api chain cell size cannot be zero\n"); - err = -EINVAL; - goto alloc_cell_ctxt_err; + return -EINVAL; }
chain->cell_ctxt = kzalloc(cell_ctxt_size, GFP_KERNEL); if (!chain->cell_ctxt) { sdk_err(dev, "Failed to allocate cell contexts for a chain\n"); - err = -ENOMEM; - goto alloc_cell_ctxt_err; + return -ENOMEM; }
chain->wb_status = dma_zalloc_coherent(dev, @@ -1032,13 +1030,6 @@ static int api_chain_init(struct hinic_api_cmd_chain *chain, alloc_wb_status_err: kfree(chain->cell_ctxt);
-/*lint -save -e548*/ -alloc_cell_ctxt_err: - if (chain->chain_type == HINIC_API_CMD_WRITE_ASYNC_TO_MGMT_CPU) - spin_lock_deinit(&chain->async_lock); - else - sema_deinit(&chain->sem); -/*lint -restore*/ return err; }
@@ -1055,13 +1046,6 @@ static void api_chain_free(struct hinic_api_cmd_chain *chain) dma_free_coherent(dev, sizeof(*chain->wb_status), chain->wb_status, chain->wb_status_paddr); kfree(chain->cell_ctxt); - -/*lint -save -e548*/ - if (chain->chain_type == HINIC_API_CMD_WRITE_ASYNC_TO_MGMT_CPU) - spin_lock_deinit(&chain->async_lock); - else - sema_deinit(&chain->sem); -/*lint -restore*/ }
/** diff --git a/drivers/net/ethernet/huawei/hinic/hinic_cfg.c b/drivers/net/ethernet/huawei/hinic/hinic_cfg.c index 68149027e403..05f9a58d2ec9 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_cfg.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_cfg.c @@ -1485,12 +1485,10 @@ int init_cfg_mgmt(struct hinic_hwdev *dev)
free_interrupt_mem: kfree(cfg_mgmt->irq_param_info.alloc_info); - mutex_deinit(&((cfg_mgmt->irq_param_info).irq_mutex)); cfg_mgmt->irq_param_info.alloc_info = NULL;
free_eq_mem: kfree(cfg_mgmt->eq_info.eq); - mutex_deinit(&cfg_mgmt->eq_info.eq_mutex); cfg_mgmt->eq_info.eq = NULL;
free_mgmt_mem: @@ -1524,11 +1522,9 @@ void free_cfg_mgmt(struct hinic_hwdev *dev)
kfree(cfg_mgmt->irq_param_info.alloc_info); cfg_mgmt->irq_param_info.alloc_info = NULL; - mutex_deinit(&((cfg_mgmt->irq_param_info).irq_mutex));
kfree(cfg_mgmt->eq_info.eq); cfg_mgmt->eq_info.eq = NULL; - mutex_deinit(&cfg_mgmt->eq_info.eq_mutex);
kfree(cfg_mgmt); } @@ -2141,16 +2137,11 @@ static int hinic_os_dep_init(struct hinic_hwdev *hwdev)
static void hinic_os_dep_deinit(struct hinic_hwdev *hwdev) { - destroy_work(&hwdev->fault_work); - destroy_workqueue(hwdev->workq);
down(&hwdev->fault_list_sem);
up(&hwdev->fault_list_sem); - - sema_deinit(&hwdev->fault_list_sem); - sema_deinit(&hwdev->recover_sem); }
void hinic_ppf_hwdev_unreg(void *hwdev) @@ -2335,8 +2326,6 @@ int hinic_init_hwdev(struct hinic_init_para *para) vfree(hwdev->chip_fault_stats);
alloc_chip_fault_stats_err: - sema_deinit(&hwdev->func_sem); - sema_deinit(&hwdev->ppf_sem); kfree(hwdev); *para->hwdev = NULL;
@@ -2406,8 +2395,6 @@ void hinic_free_hwdev(void *hwdev) clear_bit(HINIC_HWDEV_NONE_INITED, &dev->func_state); hinic_free_hwif(dev); vfree(dev->chip_fault_stats); - sema_deinit(&dev->func_sem); - sema_deinit(&dev->ppf_sem); kfree(dev); }
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_cmdq.c b/drivers/net/ethernet/huawei/hinic/hinic_cmdq.c index 38b54860e4bc..d7802caca0a6 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_cmdq.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_cmdq.c @@ -672,12 +672,10 @@ static int cmdq_sync_cmd_direct_resp(struct hinic_cmdq *cmdq, sdk_err(cmdq->hwdev->dev_hdl, "Cmdq sync command timeout, prod idx: 0x%x\n", curr_prod_idx); hinic_dump_ceq_info(cmdq->hwdev); - destroy_completion(&done); return -ETIMEDOUT; }
timeout_check_ok: - destroy_completion(&done); smp_rmb(); /* read error code after completion */
if (errcode > 1) @@ -803,12 +801,10 @@ static int cmdq_sync_cmd_detail_resp(struct hinic_cmdq *cmdq, sdk_err(cmdq->hwdev->dev_hdl, "Cmdq sync command timeout, prod idx: 0x%x\n", curr_prod_idx); hinic_dump_ceq_info(cmdq->hwdev); - destroy_completion(&done); return -ETIMEDOUT; }
timeout_check_ok: - destroy_completion(&done); smp_rmb(); /* read error code after completion */
if (errcode > 1) @@ -1354,7 +1350,6 @@ static int init_cmdq(struct hinic_cmdq *cmdq, struct hinic_hwdev *hwdev, kfree(cmdq->cmd_infos);
cmd_infos_err: - spin_lock_deinit(&cmdq->cmdq_lock);
return err; } @@ -1363,7 +1358,6 @@ static void free_cmdq(struct hinic_hwdev *hwdev, struct hinic_cmdq *cmdq) { hinic_free_db_addr(hwdev, cmdq->db_base, NULL); kfree(cmdq->cmd_infos); - spin_lock_deinit(&cmdq->cmdq_lock); }
int hinic_set_cmdq_ctxts(struct hinic_hwdev *hwdev) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c b/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c index 3ae6e215b907..1d56349c0c11 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c @@ -4677,7 +4677,6 @@ static void hinic_heartbeat_timer_handler(unsigned long data) if (__detect_heartbeat_ehd_lost(hwdev) || !hinic_get_heartbeat_status(hwdev)) { hwdev->heartbeat_lost = 1; - stop_timer(&hwdev->heartbeat_timer); queue_work(hwdev->workq, &hwdev->timer_work); } else { mod_timer(&hwdev->heartbeat_timer, @@ -4697,16 +4696,14 @@ void hinic_init_heartbeat(struct hinic_hwdev *hwdev) hwdev->heartbeat_timer.expires = jiffies + msecs_to_jiffies(HINIC_HEARTBEAT_START_EXPIRE);
- add_to_timer(&hwdev->heartbeat_timer, HINIC_HEARTBEAT_PERIOD); + add_timer(&hwdev->heartbeat_timer);
INIT_WORK(&hwdev->timer_work, hinic_heartbeat_event_handler); }
void hinic_destroy_heartbeat(struct hinic_hwdev *hwdev) { - destroy_work(&hwdev->timer_work); - stop_timer(&hwdev->heartbeat_timer); - delete_timer(&hwdev->heartbeat_timer); + del_timer_sync(&hwdev->heartbeat_timer); }
u8 hinic_nic_sw_aeqe_handler(void *handle, u8 event, u64 data) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hwif.c b/drivers/net/ethernet/huawei/hinic/hinic_hwif.c index b267084d3672..dcb7471227cf 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hwif.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hwif.c @@ -622,7 +622,6 @@ int hinic_init_hwif(struct hinic_hwdev *hwdev, void *cfg_reg_base, return 0;
hwif_ready_err: - spin_lock_deinit(&hwif->free_db_area.idx_lock); kfree(hwif);
return err; @@ -634,7 +633,6 @@ int hinic_init_hwif(struct hinic_hwdev *hwdev, void *cfg_reg_base, */ void hinic_free_hwif(struct hinic_hwdev *hwdev) { - spin_lock_deinit(&hwdev->hwif->free_db_area.idx_lock); kfree(hwdev->hwif); }
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_mbox.c b/drivers/net/ethernet/huawei/hinic/hinic_mbox.c index add76893055d..bbc16cc38b33 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_mbox.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_mbox.c @@ -699,8 +699,6 @@ static void recv_func_mbox_work_handler(struct work_struct *work) recv_func_mbox_handler(mbox_work->func_to_func, mbox_work->recv_mbox, mbox_work->src_func_idx);
- destroy_work(&mbox_work->work); - kfree(mbox_work); }
@@ -840,8 +838,6 @@ static void update_random_id_work_handler(struct work_struct *work) sdk_warn(func_to_func->hwdev->dev_hdl, "Update vf id(0x%x) random id fail\n", mbox_work->src_func_idx);
- destroy_work(&mbox_work->work); - kfree(mbox_work); }
@@ -1087,10 +1083,8 @@ static int send_mbox_seg(struct hinic_mbox_func_to_func *func_to_func, if (!wait_for_completion_timeout(done, jif)) { sdk_err(hwdev->dev_hdl, "Send mailbox segment timeout\n"); dump_mox_reg(hwdev); - destroy_completion(done); return -ETIMEDOUT; } - destroy_completion(done);
wb_status = get_mbox_status(send_mbox); } @@ -1247,7 +1241,6 @@ int hinic_mbox_to_func(struct hinic_mbox_func_to_func *func_to_func, }
send_err: - destroy_completion(&mbox_for_resp->recv_done); up(&func_to_func->mbox_send_sem);
return err; @@ -1670,9 +1663,6 @@ int hinic_func_to_func_init(struct hinic_hwdev *hwdev) destroy_workqueue(func_to_func->workq);
create_mbox_workq_err: - spin_lock_deinit(&func_to_func->mbox_lock); - sema_deinit(&func_to_func->msg_send_sem); - sema_deinit(&func_to_func->mbox_send_sem); kfree(func_to_func);
return err; @@ -1690,9 +1680,6 @@ void hinic_func_to_func_free(struct hinic_hwdev *hwdev) free_mbox_wb_status(func_to_func); free_mbox_info(func_to_func->mbox_resp); free_mbox_info(func_to_func->mbox_send); - spin_lock_deinit(&func_to_func->mbox_lock); - sema_deinit(&func_to_func->mbox_send_sem); - sema_deinit(&func_to_func->msg_send_sem);
kfree(func_to_func); } diff --git a/drivers/net/ethernet/huawei/hinic/hinic_mgmt.c b/drivers/net/ethernet/huawei/hinic/hinic_mgmt.c index ac9988710cad..510f5365baa7 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_mgmt.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_mgmt.c @@ -461,7 +461,6 @@ int hinic_pf_to_mgmt_sync(void *hwdev, enum hinic_mod_type mod, u8 cmd, pf_to_mgmt_send_event_set(pf_to_mgmt, SEND_EVENT_END);
if (!(((struct hinic_hwdev *)hwdev)->chip_present_flag)) { - destroy_completion(recv_done); up(&pf_to_mgmt->sync_msg_lock); return -ETIMEDOUT; } @@ -481,7 +480,6 @@ int hinic_pf_to_mgmt_sync(void *hwdev, enum hinic_mod_type mod, u8 cmd, }
unlock_sync_msg: - destroy_completion(recv_done); up(&pf_to_mgmt->sync_msg_lock);
return err; @@ -1113,8 +1111,6 @@ static void recv_mgmt_msg_work_handler(struct work_struct *work) mgmt_work->msg_len, mgmt_work->msg_id, !mgmt_work->async_mgmt_to_pf);
- destroy_work(&mgmt_work->work); - kfree(mgmt_work->msg); kfree(mgmt_work); } @@ -1387,9 +1383,6 @@ int hinic_pf_to_mgmt_init(struct hinic_hwdev *hwdev) destroy_workqueue(pf_to_mgmt->workq);
create_mgmt_workq_err: - spin_lock_deinit(&pf_to_mgmt->sync_event_lock); - spin_lock_deinit(&pf_to_mgmt->async_msg_lock); - sema_deinit(&pf_to_mgmt->sync_msg_lock); kfree(pf_to_mgmt);
return err; @@ -1409,9 +1402,6 @@ void hinic_pf_to_mgmt_free(struct hinic_hwdev *hwdev) destroy_workqueue(pf_to_mgmt->workq); hinic_api_cmd_free(pf_to_mgmt->cmd_chain); free_msg_buf(pf_to_mgmt); - spin_lock_deinit(&pf_to_mgmt->sync_event_lock); - spin_lock_deinit(&pf_to_mgmt->async_msg_lock); - sema_deinit(&pf_to_mgmt->sync_msg_lock); kfree(pf_to_mgmt); }
@@ -1451,7 +1441,6 @@ void hinic_clp_pf_to_mgmt_free(struct hinic_hwdev *hwdev) { struct hinic_clp_pf_to_mgmt *clp_pf_to_mgmt = hwdev->clp_pf_to_mgmt;
- sema_deinit(&clp_pf_to_mgmt->clp_msg_lock); kfree(clp_pf_to_mgmt->clp_msg_buf); kfree(clp_pf_to_mgmt); } diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c index fb94588daa30..9acde2025cd6 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c @@ -2922,7 +2922,6 @@ int hinic_vf_func_init(struct hinic_hwdev *hwdev) kfree(nic_io->vf_infos);
out_free_nic_io: - sema_deinit(&hwdev->nic_io->nic_cfg.cfg_lock); kfree(hwdev->nic_io); hwdev->nic_io = NULL;
@@ -2950,8 +2949,6 @@ void hinic_vf_func_free(struct hinic_hwdev *hwdev) } }
- sema_deinit(&hwdev->nic_io->nic_cfg.cfg_lock); - kfree(hwdev->nic_io); hwdev->nic_io = NULL; } diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.c b/drivers/net/ethernet/huawei/hinic/hinic_rx.c index c8cbcdfd5883..977f816e7258 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.c @@ -67,8 +67,7 @@ static bool rx_alloc_mapped_page(struct hinic_rxq *rxq, return true;
/* alloc new page for storage */ - page = alloc_pages_node(NUMA_NO_NODE, GFP_ATOMIC | __GFP_COLD | - __GFP_COMP, nic_dev->page_order); + page = alloc_pages_node(NUMA_NO_NODE, GFP_ATOMIC, nic_dev->page_order); if (unlikely(!page)) { nicif_err(nic_dev, drv, netdev, "Alloc rxq: %d page failed\n", rxq->q_id); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.c b/drivers/net/ethernet/huawei/hinic/hinic_tx.c index 3d9d9d0d6d0c..be57be78feee 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_tx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.c @@ -155,9 +155,9 @@ static int tx_map_skb(struct hinic_nic_dev *nic_dev, struct sk_buff *skb, frag = &skb_shinfo(skb)->frags[i - 1]; nsize = skb_frag_size(frag);
- vaddr = _kc_kmap_atomic(skb_frag_page(frag)); + vaddr = kmap_atomic(skb_frag_page(frag)); memcpy(cpy_buff, vaddr + frag->page_offset, nsize); - _kc_kunmap_atomic(vaddr); + kunmap_atomic(vaddr); cpy_buff += nsize; } } diff --git a/drivers/net/ethernet/huawei/hinic/hinic_wq.c b/drivers/net/ethernet/huawei/hinic/hinic_wq.c index 4d8180c6b271..032b28332a65 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_wq.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_wq.c @@ -528,8 +528,6 @@ void hinic_wqs_free(struct hinic_wqs *wqs) { u32 page_idx;
- spin_lock_deinit(&wqs->alloc_blocks_lock); - for (page_idx = 0; page_idx < wqs->num_pages; page_idx++) wqs_free_page(wqs, page_idx);
diff --git a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.c b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.c index daed2eca32c1..1aa09e55c64e 100644 --- a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.c +++ b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.c @@ -13,30 +13,8 @@ * */
-#include <linux/pci_regs.h> - #include "ossl_knl_linux.h"
-void add_to_timer(struct timer_list *timer, long period) -{ - if (!timer) - return; - - add_timer(timer); -} - -void stop_timer(struct timer_list *timer) -{ -} - -void delete_timer(struct timer_list *timer) -{ - if (!timer) - return; - - del_timer_sync(timer); -} - int local_atoi(const char *name) { int val = 0; diff --git a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h index dd5d0fc949d7..c15958aecd9a 100644 --- a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h +++ b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h @@ -29,14 +29,6 @@ #include <linux/udp.h> #include <linux/highmem.h>
-#ifndef __GFP_COLD -#define __GFP_COLD 0 -#endif - -#ifndef __GFP_COMP -#define __GFP_COMP 0 -#endif - #ifndef SUPPORTED_100000baseKR4_Full #define SUPPORTED_100000baseKR4_Full 0 #define ADVERTISED_100000baseKR4_Full 0 @@ -142,12 +134,6 @@
#define HAVE_NDO_SET_VF_TRUST
-/*****************************************************************************/ -#include <linux/kconfig.h> - -#define _kc_kmap_atomic(page) kmap_atomic(page) -#define _kc_kunmap_atomic(addr) kunmap_atomic(addr) - /*****************************************************************************/ #define HAVE_NAPI_GRO_FLUSH_OLD
@@ -208,13 +194,6 @@
#define HAVE_ENCAPSULATION_CSUM
-#define spin_lock_deinit(lock) - -#define destroy_work(work) -void add_to_timer(struct timer_list *timer, long period); -void stop_timer(struct timer_list *timer); -void delete_timer(struct timer_list *timer); - int local_atoi(const char *name);
#define nicif_err(priv, type, dev, fmt, args...) \ @@ -228,11 +207,6 @@ int local_atoi(const char *name); #define nicif_dbg(priv, type, dev, fmt, args...) \ netif_level(dbg, priv, type, dev, "[NIC]"fmt, ##args)
-#define destroy_completion(completion) -#define sema_deinit(lock) -#define mutex_deinit(lock) -#define rwlock_deinit(lock) - #define tasklet_state(tasklet) ((tasklet)->state)
#endif
From: Chiqijun chiqijun@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
Delete the old kernel version adaptation interface in ethtool 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 | 213 ------------------ .../ethernet/huawei/hinic/ossl_knl_linux.h | 6 - 2 files changed, 219 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c index 78d32ea5cc88..0c0189b63a0d 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c @@ -682,8 +682,6 @@ static int hinic_get_settings(struct net_device *netdev, return 0; }
-#ifdef ETHTOOL_GLINKSETTINGS -#ifndef XENSERVER_HAVE_NEW_ETHTOOL_OPS static int hinic_get_link_ksettings(struct net_device *netdev, struct ethtool_link_ksettings *link_settings) { @@ -712,8 +710,6 @@ static int hinic_get_link_ksettings(struct net_device *netdev,
return 0; } -#endif -#endif
static int hinic_is_speed_legal(struct hinic_nic_dev *nic_dev, u32 speed) { @@ -870,8 +866,6 @@ static int hinic_set_settings(struct net_device *netdev, ethtool_cmd_speed(link_settings)); }
-#ifdef ETHTOOL_GLINKSETTINGS -#ifndef XENSERVER_HAVE_NEW_ETHTOOL_OPS static int hinic_set_link_ksettings(struct net_device *netdev, const struct ethtool_link_ksettings *link_settings) { @@ -879,8 +873,6 @@ static int hinic_set_link_ksettings(struct net_device *netdev, return set_link_settings(netdev, link_settings->base.autoneg, link_settings->base.speed); } -#endif -#endif
static void hinic_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *info) @@ -1545,7 +1537,6 @@ static int hinic_set_coalesce(struct net_device *netdev, return __hinic_set_coalesce(netdev, coal, COALESCE_ALL_QUEUE); }
-#if defined(ETHTOOL_PERQUEUE) && defined(ETHTOOL_GCOALESCE) static int hinic_get_per_queue_coalesce(struct net_device *netdev, u32 queue, struct ethtool_coalesce *coal) { @@ -1557,7 +1548,6 @@ static int hinic_set_per_queue_coalesce(struct net_device *netdev, u32 queue, { return __hinic_set_coalesce(netdev, coal, queue); } -#endif
static void get_drv_queue_stats(struct hinic_nic_dev *nic_dev, u64 *data) { @@ -1734,7 +1724,6 @@ static void hinic_get_strings(struct net_device *netdev, } }
-#ifdef HAVE_ETHTOOL_SET_PHYS_ID static int hinic_set_phys_id(struct net_device *netdev, enum ethtool_phys_id_state state) { @@ -1782,16 +1771,6 @@ static int hinic_set_phys_id(struct net_device *netdev, else return 0; } -#else -static int hinic_phys_id(struct net_device *netdev, u32 data) -{ - struct hinic_nic_dev *nic_dev = netdev_priv(netdev); - - nicif_err(nic_dev, drv, netdev, "Not support to set phys id\n"); - - return -EOPNOTSUPP; -} -#endif
static void hinic_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) @@ -2039,7 +2018,6 @@ static void hinic_diag_test(struct net_device *netdev, hinic_lp_test(netdev, eth_test, data, 0); }
-#ifdef ETHTOOL_GMODULEEEPROM static int hinic_get_module_info(struct net_device *netdev, struct ethtool_modinfo *modinfo) { @@ -2105,7 +2083,6 @@ static int hinic_get_module_eeprom(struct net_device *netdev,
return 0; } -#endif /* ETHTOOL_GMODULEEEPROM */
static int set_l4_rss_hash_ops(struct ethtool_rxnfc *cmd, struct nic_rss_type *rss_type) @@ -2297,12 +2274,10 @@ static int hinic_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd) return err; }
-#ifndef NOT_HAVE_GET_RXFH_INDIR_SIZE static u32 hinic_get_rxfh_indir_size(struct net_device *netdev) { return HINIC_RSS_INDIR_SIZE; } -#endif
static int __set_rss_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key) @@ -2378,18 +2353,13 @@ static int __set_rss_rxfh(struct net_device *netdev, return 0; }
-#if defined(ETHTOOL_GRSSH) && defined(ETHTOOL_SRSSH) static u32 hinic_get_rxfh_key_size(struct net_device *netdev) { return HINIC_RSS_KEY_SIZE; }
-#ifdef HAVE_RXFH_HASHFUNC static int hinic_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc) -#else -static int hinic_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key) -#endif { struct hinic_nic_dev *nic_dev = netdev_priv(netdev); int err = 0; @@ -2397,7 +2367,6 @@ static int hinic_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key) if (!test_bit(HINIC_RSS_ENABLE, &nic_dev->flags)) return -EOPNOTSUPP;
-#ifdef HAVE_RXFH_HASHFUNC if (hfunc) { u8 hash_engine_type = 0;
@@ -2409,7 +2378,6 @@ static int hinic_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
*hfunc = hash_engine_type ? ETH_RSS_HASH_TOP : ETH_RSS_HASH_XOR; } -#endif
if (indir) { err = hinic_rss_get_indir_tbl(nic_dev->hwdev, @@ -2425,17 +2393,8 @@ static int hinic_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key) return err; }
-#ifdef HAVE_RXFH_HASHFUNC static int hinic_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key, const u8 hfunc) -#else -#ifdef HAVE_RXFH_NONCONST -static int hinic_set_rxfh(struct net_device *netdev, u32 *indir, u8 *key) -#else -static int hinic_set_rxfh(struct net_device *netdev, const u32 *indir, - const u8 *key) -#endif -#endif /* HAVE_RXFH_HASHFUNC */ { struct hinic_nic_dev *nic_dev = netdev_priv(netdev); int err = 0; @@ -2452,7 +2411,6 @@ static int hinic_set_rxfh(struct net_device *netdev, const u32 *indir, return -EOPNOTSUPP; }
-#ifdef HAVE_RXFH_HASHFUNC if (hfunc != ETH_RSS_HASH_NO_CHANGE) { if (hfunc != ETH_RSS_HASH_TOP && hfunc != ETH_RSS_HASH_XOR) { nicif_err(nic_dev, drv, netdev, @@ -2473,99 +2431,15 @@ static int hinic_set_rxfh(struct net_device *netdev, const u32 *indir, "Change hfunc to RSS_HASH_%s success\n", (hfunc == ETH_RSS_HASH_XOR) ? "XOR" : "TOP"); } -#endif
err = __set_rss_rxfh(netdev, indir, key);
return err; }
-#else /* !(defined(ETHTOOL_GRSSH) && defined(ETHTOOL_SRSSH)) */ - -#ifdef NOT_HAVE_GET_RXFH_INDIR_SIZE -static int hinic_get_rxfh_indir(struct net_device *netdev, - struct ethtool_rxfh_indir *indir1) -#else -static int hinic_get_rxfh_indir(struct net_device *netdev, u32 *indir) -#endif -{ - struct hinic_nic_dev *nic_dev = netdev_priv(netdev); - int err = 0; -#ifdef NOT_HAVE_GET_RXFH_INDIR_SIZE - u32 *indir; - - /* In a low version kernel(eg:suse 11.2), call the interface twice. - * First call to get the size value, - * and second call to get the rxfh indir according to the size value. - */ - if (indir1->size == 0) { - indir1->size = HINIC_RSS_INDIR_SIZE; - return 0; - } - - if (indir1->size < HINIC_RSS_INDIR_SIZE) { - nicif_err(nic_dev, drv, nic_dev->netdev, - "Failed to get rss indir, hinic rss size(%d) is more than system rss size(%u).\n", - HINIC_RSS_INDIR_SIZE, indir1->size); - return -EINVAL; - } - - indir = indir1->ring_index; -#endif - if (!test_bit(HINIC_RSS_ENABLE, &nic_dev->flags)) - return -EOPNOTSUPP; - - if (indir) - err = hinic_rss_get_indir_tbl(nic_dev->hwdev, - nic_dev->rss_tmpl_idx, indir); - - return err; -} - -#ifdef NOT_HAVE_GET_RXFH_INDIR_SIZE -static int hinic_set_rxfh_indir(struct net_device *netdev, - const struct ethtool_rxfh_indir *indir1) -#else -static int hinic_set_rxfh_indir(struct net_device *netdev, const u32 *indir) -#endif -{ - struct hinic_nic_dev *nic_dev = netdev_priv(netdev); -#ifdef NOT_HAVE_GET_RXFH_INDIR_SIZE - const u32 *indir; - - if (indir1->size != HINIC_RSS_INDIR_SIZE) { - nicif_err(nic_dev, drv, nic_dev->netdev, - "Failed to set rss indir, hinic rss size(%d) is more than system rss size(%u).\n", - HINIC_RSS_INDIR_SIZE, indir1->size); - return -EINVAL; - } - - indir = indir1->ring_index; -#endif - - if (!test_bit(HINIC_RSS_ENABLE, &nic_dev->flags)) { - nicif_err(nic_dev, drv, nic_dev->netdev, - "Not support to set rss indir when rss is disable\n"); - return -EOPNOTSUPP; - } - - if (test_bit(HINIC_DCB_ENABLE, &nic_dev->flags) && indir) { - nicif_err(nic_dev, drv, netdev, - "Not support to set indir when DCB is enabled\n"); - return -EOPNOTSUPP; - } - - return __set_rss_rxfh(netdev, indir, NULL); -} -#endif /* defined(ETHTOOL_GRSSH) && defined(ETHTOOL_SRSSH) */ - static const struct ethtool_ops hinic_ethtool_ops = { -#ifdef ETHTOOL_GLINKSETTINGS -#ifndef XENSERVER_HAVE_NEW_ETHTOOL_OPS .get_link_ksettings = hinic_get_link_ksettings, .set_link_ksettings = hinic_set_link_ksettings, -#endif -#endif .get_settings = hinic_get_settings, .set_settings = hinic_set_settings, .get_drvinfo = hinic_get_drvinfo, @@ -2580,77 +2454,26 @@ static const struct ethtool_ops hinic_ethtool_ops = { .get_sset_count = hinic_get_sset_count, .get_coalesce = hinic_get_coalesce, .set_coalesce = hinic_set_coalesce, -#if defined(ETHTOOL_PERQUEUE) && defined(ETHTOOL_GCOALESCE) .get_per_queue_coalesce = hinic_get_per_queue_coalesce, .set_per_queue_coalesce = hinic_set_per_queue_coalesce, -#endif .get_ethtool_stats = hinic_get_ethtool_stats, .get_strings = hinic_get_strings, -#ifndef HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT -#ifdef HAVE_ETHTOOL_SET_PHYS_ID .set_phys_id = hinic_set_phys_id, -#else - .phys_id = hinic_phys_id, -#endif -#endif .self_test = hinic_diag_test, .get_rxnfc = hinic_get_rxnfc, .set_rxnfc = hinic_set_rxnfc, - -#ifndef HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT - .get_channels = hinic_get_channels, - .set_channels = hinic_set_channels, -#ifdef ETHTOOL_GMODULEEEPROM - .get_module_info = hinic_get_module_info, - .get_module_eeprom = hinic_get_module_eeprom, -#endif -#ifndef NOT_HAVE_GET_RXFH_INDIR_SIZE - .get_rxfh_indir_size = hinic_get_rxfh_indir_size, -#endif -#if defined(ETHTOOL_GRSSH) && defined(ETHTOOL_SRSSH) - .get_rxfh_key_size = hinic_get_rxfh_key_size, - .get_rxfh = hinic_get_rxfh, - .set_rxfh = hinic_set_rxfh, -#else - .get_rxfh_indir = hinic_get_rxfh_indir, - .set_rxfh_indir = hinic_set_rxfh_indir, -#endif -#endif /* HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT */ -}; - -#ifdef HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT -static const struct ethtool_ops_ext hinic_ethtool_ops_ext = { - .size = sizeof(struct ethtool_ops_ext), - .set_phys_id = hinic_set_phys_id, .get_channels = hinic_get_channels, .set_channels = hinic_set_channels, -#ifdef ETHTOOL_GMODULEEEPROM .get_module_info = hinic_get_module_info, .get_module_eeprom = hinic_get_module_eeprom, -#endif - -#ifndef NOT_HAVE_GET_RXFH_INDIR_SIZE .get_rxfh_indir_size = hinic_get_rxfh_indir_size, -#endif -#if defined(ETHTOOL_GRSSH) && defined(ETHTOOL_SRSSH) .get_rxfh_key_size = hinic_get_rxfh_key_size, .get_rxfh = hinic_get_rxfh, .set_rxfh = hinic_set_rxfh, -#else - .get_rxfh_indir = hinic_get_rxfh_indir, - .set_rxfh_indir = hinic_set_rxfh_indir, -#endif }; -#endif /* HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT */
static const struct ethtool_ops hinicvf_ethtool_ops = { -#ifdef ETHTOOL_GLINKSETTINGS -#ifndef XENSERVER_HAVE_NEW_ETHTOOL_OPS .get_link_ksettings = hinic_get_link_ksettings, -#endif -#else - .get_settings = hinic_get_settings, -#endif .get_drvinfo = hinic_get_drvinfo, .get_msglevel = hinic_get_msglevel, .set_msglevel = hinic_set_msglevel, @@ -2660,63 +2483,27 @@ static const struct ethtool_ops hinicvf_ethtool_ops = { .get_sset_count = hinic_get_sset_count, .get_coalesce = hinic_get_coalesce, .set_coalesce = hinic_set_coalesce, -#if defined(ETHTOOL_PERQUEUE) && defined(ETHTOOL_GCOALESCE) .get_per_queue_coalesce = hinic_get_per_queue_coalesce, .set_per_queue_coalesce = hinic_set_per_queue_coalesce, -#endif .get_ethtool_stats = hinic_get_ethtool_stats, .get_strings = hinic_get_strings, .get_rxnfc = hinic_get_rxnfc, .set_rxnfc = hinic_set_rxnfc,
-#ifndef HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT .get_channels = hinic_get_channels, .set_channels = hinic_set_channels, -#ifndef NOT_HAVE_GET_RXFH_INDIR_SIZE .get_rxfh_indir_size = hinic_get_rxfh_indir_size, -#endif -#if defined(ETHTOOL_GRSSH) && defined(ETHTOOL_SRSSH) - .get_rxfh_key_size = hinic_get_rxfh_key_size, - .get_rxfh = hinic_get_rxfh, - .set_rxfh = hinic_set_rxfh, -#else - .get_rxfh_indir = hinic_get_rxfh_indir, - .set_rxfh_indir = hinic_set_rxfh_indir, -#endif -#endif /* HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT */ -}; - -#ifdef HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT -static const struct ethtool_ops_ext hinicvf_ethtool_ops_ext = { - .size = sizeof(struct ethtool_ops_ext), - .get_channels = hinic_get_channels, - .set_channels = hinic_set_channels, -#ifndef NOT_HAVE_GET_RXFH_INDIR_SIZE - .get_rxfh_indir_size = hinic_get_rxfh_indir_size, -#endif -#if defined(ETHTOOL_GRSSH) && defined(ETHTOOL_SRSSH) .get_rxfh_key_size = hinic_get_rxfh_key_size, .get_rxfh = hinic_get_rxfh, .set_rxfh = hinic_set_rxfh, -#else - .get_rxfh_indir = hinic_get_rxfh_indir, - .set_rxfh_indir = hinic_set_rxfh_indir, -#endif }; -#endif /* HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT */
void hinic_set_ethtool_ops(struct net_device *netdev) { SET_ETHTOOL_OPS(netdev, &hinic_ethtool_ops); -#ifdef HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT - set_ethtool_ops_ext(netdev, &hinic_ethtool_ops_ext); -#endif /* HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT */ }
void hinicvf_set_ethtool_ops(struct net_device *netdev) { SET_ETHTOOL_OPS(netdev, &hinicvf_ethtool_ops); -#ifdef HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT - set_ethtool_ops_ext(netdev, &hinicvf_ethtool_ops_ext); -#endif /* HAVE_RHEL6_ETHTOOL_OPS_EXT_STRUCT */ } /*lint -e766*/ diff --git a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h index c15958aecd9a..558ed4d9c17a 100644 --- a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h +++ b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h @@ -126,9 +126,6 @@ #define HAVE_NDO_SET_FEATURES #endif
-/*****************************************************************************/ -#define HAVE_ETHTOOL_SET_PHYS_ID - /*****************************************************************************/ #define HAVE_VF_SPOOFCHK_CONFIGURE
@@ -157,9 +154,6 @@ #define HAVE_SKBUFF_CSUM_LEVEL #define HAVE_MULTI_VLAN_OFFLOAD_EN
-/*****************************************************************************/ -#define HAVE_RXFH_HASHFUNC - /*****************************************************************************/ #define HAVE_NETDEVICE_MIN_MAX_MTU
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...) \
From: Chiqijun chiqijun@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
Delete the remaining old linux kernel adaptation interface.
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_ctx_def.h | 11 --- .../ethernet/huawei/hinic/hinic_dbgtool_knl.h | 2 - drivers/net/ethernet/huawei/hinic/hinic_dcb.c | 8 -- .../net/ethernet/huawei/hinic/hinic_dfx_def.h | 11 --- drivers/net/ethernet/huawei/hinic/hinic_hw.h | 17 ---- .../net/ethernet/huawei/hinic/hinic_hwdev.c | 15 +--- drivers/net/ethernet/huawei/hinic/hinic_lld.c | 53 ------------- .../net/ethernet/huawei/hinic/hinic_main.c | 28 +------ .../net/ethernet/huawei/hinic/hinic_nictool.c | 2 +- .../net/ethernet/huawei/hinic/hinic_nictool.h | 19 +---- .../ethernet/huawei/hinic/hinic_port_cmd.h | 11 --- .../net/ethernet/huawei/hinic/hinic_qe_def.h | 12 --- drivers/net/ethernet/huawei/hinic/hinic_qp.h | 9 --- drivers/net/ethernet/huawei/hinic/hinic_rx.c | 17 ---- .../ethernet/huawei/hinic/hinic_sml_counter.c | 18 ++--- .../net/ethernet/huawei/hinic/hinic_sml_lt.c | 18 ++--- .../net/ethernet/huawei/hinic/hinic_sriov.c | 69 ---------------- .../net/ethernet/huawei/hinic/hinic_sriov.h | 10 --- drivers/net/ethernet/huawei/hinic/hinic_tx.c | 58 -------------- .../ethernet/huawei/hinic/ossl_knl_linux.h | 79 ------------------- 20 files changed, 18 insertions(+), 449 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_ctx_def.h b/drivers/net/ethernet/huawei/hinic/hinic_ctx_def.h index 4dc759d6e51d..68071411833b 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_ctx_def.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_ctx_def.h @@ -16,12 +16,6 @@ #ifndef __HINIC_CTX_DEF_H__ #define __HINIC_CTX_DEF_H__
-#ifdef __cplusplus - #if __cplusplus -extern "C"{ - #endif -#endif /* __cplusplus */ - #define MASKED_SQ_IDX(sq, idx) ((idx) & (sq)->wq->mask)
#define HINIC_CEQE_QN_MASK 0x3FFU @@ -245,9 +239,4 @@ enum cfg_svc_type_en { #define IS_HWPT_TYPE(dev) \ ((dev)->cfg_mgmt->svc_cap.chip_svc_type & CFG_SVC_HWPT_BIT10)
-#ifdef __cplusplus - #if __cplusplus -} - #endif -#endif /* __cplusplus */ #endif /* __HINIC_CTX_DEF_H__ */ diff --git a/drivers/net/ethernet/huawei/hinic/hinic_dbgtool_knl.h b/drivers/net/ethernet/huawei/hinic/hinic_dbgtool_knl.h index 6cd33d795a00..2cfc43dedd34 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_dbgtool_knl.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_dbgtool_knl.h @@ -107,9 +107,7 @@ struct dbgtool_param { char chip_name[16]; };
-#ifndef MAX_CARD_NUM #define MAX_CARD_NUM 64 -#endif #define DBGTOOL_PAGE_ORDER 10
int dbgtool_knl_init(void *vhwdev, void *chip_node); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_dcb.c b/drivers/net/ethernet/huawei/hinic/hinic_dcb.c index b356d025c476..e17a91f8bd59 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_dcb.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_dcb.c @@ -1422,11 +1422,7 @@ static int hinic_dcbnl_ieee_set_pfc(struct net_device *netdev, return 0; }
-#ifdef NUMTCS_RETURNS_U8 -static u8 hinic_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) -#else static int hinic_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) -#endif { struct hinic_nic_dev *nic_dev = netdev_priv(netdev); struct hinic_dcb_config *dcb_cfg = &nic_dev->dcb_cfg; @@ -1448,11 +1444,7 @@ static int hinic_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) return 0; }
-#ifdef NUMTCS_RETURNS_U8 -static u8 hinic_dcbnl_setnumtcs(struct net_device *netdev, int tcid, u8 num) -#else static int hinic_dcbnl_setnumtcs(struct net_device *netdev, int tcid, u8 num) -#endif { return -EINVAL; } diff --git a/drivers/net/ethernet/huawei/hinic/hinic_dfx_def.h b/drivers/net/ethernet/huawei/hinic/hinic_dfx_def.h index dcad813d216b..95cb7c40bf12 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_dfx_def.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_dfx_def.h @@ -16,12 +16,6 @@ #ifndef __HINIC_DFX_DEF_H__ #define __HINIC_DFX_DEF_H__
-#ifdef __cplusplus - #if __cplusplus -extern "C"{ - #endif -#endif /* __cplusplus */ - enum module_name { SEND_TO_NIC_DRIVER = 1, SEND_TO_HW_DRIVER, @@ -145,9 +139,4 @@ struct hinic_show_item { #define UCODE_COMP_TIME_OUT_VAL 0xFF00000 #define NIC_TOOL_MAGIC 'x'
-#ifdef __cplusplus - #if __cplusplus -} - #endif -#endif /* __cplusplus */ #endif /* __HINIC_DFX_DEF_H__ */ diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw.h b/drivers/net/ethernet/huawei/hinic/hinic_hw.h index 6e8a277e33fb..6afe31c9b80e 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw.h @@ -16,20 +16,6 @@ #ifndef HINIC_HW_H_ #define HINIC_HW_H_
-#ifndef __BIG_ENDIAN__ -#define __BIG_ENDIAN__ 0x4321 -#endif - -#ifndef __LITTLE_ENDIAN__ -#define __LITTLE_ENDIAN__ 0x1234 -#endif - -#ifdef __BYTE_ORDER__ -#undef __BYTE_ORDER__ -#endif -/* X86 */ -#define __BYTE_ORDER__ __LITTLE_ENDIAN__ - enum hinic_mod_type { HINIC_MOD_COMM = 0, /* HW communication module */ HINIC_MOD_L2NIC = 1, /* L2NIC module */ @@ -254,9 +240,6 @@ struct hinic_init_para { void *ppf_hwdev; };
-#ifndef IFNAMSIZ -#define IFNAMSIZ 16 -#endif #define MAX_FUNCTION_NUM 512 #define HINIC_MAX_PF_NUM 16 #define HINIC_MAX_COS 8 diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c b/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c index 1d56349c0c11..058939d05346 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c @@ -4662,17 +4662,9 @@ static bool __detect_heartbeat_ehd_lost(struct hinic_hwdev *hwdev) return hb_ehd_lost; }
-#ifdef HAVE_TIMER_SETUP static void hinic_heartbeat_timer_handler(struct timer_list *t) -#else -static void hinic_heartbeat_timer_handler(unsigned long data) -#endif { -#ifdef HAVE_TIMER_SETUP struct hinic_hwdev *hwdev = from_timer(hwdev, t, heartbeat_timer); -#else - struct hinic_hwdev *hwdev = (struct hinic_hwdev *)data; -#endif
if (__detect_heartbeat_ehd_lost(hwdev) || !hinic_get_heartbeat_status(hwdev)) { @@ -4686,13 +4678,8 @@ static void hinic_heartbeat_timer_handler(unsigned long data)
void hinic_init_heartbeat(struct hinic_hwdev *hwdev) { -#ifdef HAVE_TIMER_SETUP timer_setup(&hwdev->heartbeat_timer, hinic_heartbeat_timer_handler, 0); -#else - initialize_timer(hwdev->adapter_hdl, &hwdev->heartbeat_timer); - hwdev->heartbeat_timer.data = (unsigned long)hwdev; - hwdev->heartbeat_timer.function = hinic_heartbeat_timer_handler; -#endif + hwdev->heartbeat_timer.expires = jiffies + msecs_to_jiffies(HINIC_HEARTBEAT_START_EXPIRE);
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_lld.c b/drivers/net/ethernet/huawei/hinic/hinic_lld.c index 20e3b0bde8ef..044d0df996e5 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_lld.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_lld.c @@ -60,25 +60,6 @@ MODULE_DESCRIPTION(HINIC_DRV_DESC); MODULE_VERSION(HINIC_DRV_VERSION); MODULE_LICENSE("GPL");
-#if !(defined(HAVE_SRIOV_CONFIGURE) || defined(HAVE_RHEL6_SRIOV_CONFIGURE)) -static DEVICE_ATTR(sriov_numvfs, 0664, - hinic_sriov_numvfs_show, hinic_sriov_numvfs_store); -static DEVICE_ATTR(sriov_totalvfs, 0444, - hinic_sriov_totalvfs_show, NULL); -#endif /* !(HAVE_SRIOV_CONFIGURE || HAVE_RHEL6_SRIOV_CONFIGURE) */ - -static struct attribute *hinic_attributes[] = { -#if !(defined(HAVE_SRIOV_CONFIGURE) || defined(HAVE_RHEL6_SRIOV_CONFIGURE)) - &dev_attr_sriov_numvfs.attr, - &dev_attr_sriov_totalvfs.attr, -#endif /* !(HAVE_SRIOV_CONFIGURE || HAVE_RHEL6_SRIOV_CONFIGURE) */ - NULL -}; - -static const struct attribute_group hinic_attr_group = { - .attrs = hinic_attributes, -}; - #ifdef CONFIG_PCI_IOV static bool disable_vf_load; module_param(disable_vf_load, bool, 0444); @@ -353,7 +334,6 @@ static void detach_uld(struct hinic_pcidev *dev, enum hinic_service_type type) mutex_unlock(&dev->pdev_mutex); }
-#ifndef __HIFC_PANGEA__ static void attach_ulds(struct hinic_pcidev *dev) { enum hinic_service_type type; @@ -363,7 +343,6 @@ static void attach_ulds(struct hinic_pcidev *dev) attach_uld(dev, type, &g_uld_info[type]); } } -#endif
static void detach_ulds(struct hinic_pcidev *dev) { @@ -2376,25 +2355,7 @@ static int hinic_func_init(struct pci_dev *pdev, if (err) return err;
-#ifndef __HIFC_PANGEA__ attach_ulds(pci_adapter); -#else - if (g_uld_info[SERVICE_T_FC].probe) { - err = attach_uld(pci_adapter, SERVICE_T_FC, - &g_uld_info[SERVICE_T_FC]); - if (err) { - sdk_err(&pdev->dev, "Failed to initialize FC\n"); - return err; - } - } -#endif - if (!HINIC_FUNC_IS_VF(pci_adapter->hwdev)) { - err = sysfs_create_group(&pdev->dev.kobj, &hinic_attr_group); - if (err) { - sdk_err(&pdev->dev, "Failed to create sysfs group\n"); - return -EFAULT; - } - }
#ifdef CONFIG_X86 cfg_order_reg(pci_adapter); @@ -2501,8 +2462,6 @@ static void hinic_remove(struct pci_dev *pdev)
switch (pci_adapter->init_state) { case HINIC_INIT_STATE_ALL_INITED: - if (!HINIC_FUNC_IS_VF(pci_adapter->hwdev)) - sysfs_remove_group(&pdev->dev.kobj, &hinic_attr_group); /*lint -fallthrough*/ case HINIC_INIT_STATE_NIC_INITED: /* Don't support hotplug when SR-IOV is enabled now. @@ -2751,12 +2710,6 @@ static void hinic_shutdown(struct pci_dev *pdev) hinic_set_api_stop(pci_adapter->hwdev); }
-#ifdef HAVE_RHEL6_SRIOV_CONFIGURE -static struct pci_driver_rh hinic_driver_rh = { - .sriov_configure = hinic_pci_sriov_configure, -}; -#endif - /* Cause we only need error detecting not error handling, so only error_detected * callback is enough. */ @@ -2770,13 +2723,7 @@ static struct pci_driver hinic_driver = { .probe = hinic_probe, .remove = hinic_remove, .shutdown = hinic_shutdown, - -#if defined(HAVE_SRIOV_CONFIGURE) .sriov_configure = hinic_pci_sriov_configure, -#elif defined(HAVE_RHEL6_SRIOV_CONFIGURE) - .rh_reserved = &hinic_driver_rh, -#endif - .err_handler = &hinic_err_handler };
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/ethernet/huawei/hinic/hinic_main.c index 7b9c38c4db93..8dc7b555f0bf 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -1387,13 +1387,8 @@ static int set_features(struct hinic_nic_dev *nic_dev, netdev_features_t features, bool force_change) { netdev_features_t changed = force_change ? ~0 : pre_features ^ features; -#ifdef NETIF_F_HW_VLAN_CTAG_RX u8 rxvlan_changed = !!(changed & NETIF_F_HW_VLAN_CTAG_RX); u8 rxvlan_en = !!(features & NETIF_F_HW_VLAN_CTAG_RX); -#else - u8 rxvlan_changed = !!(changed & NETIF_F_HW_VLAN_RX); - u8 rxvlan_en = !!(features & NETIF_F_HW_VLAN_RX); -#endif u32 lro_timer, lro_buf_size; int err = 0;
@@ -1976,10 +1971,8 @@ static const struct net_device_ops hinic_netdev_ops = { .ndo_change_mtu = hinic_change_mtu, .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
.ndo_set_vf_mac = hinic_ndo_set_vf_mac, .ndo_set_vf_vlan = hinic_ndo_set_vf_vlan, @@ -2010,10 +2003,8 @@ static const struct net_device_ops hinicvf_netdev_ops = { .ndo_change_mtu = hinic_change_mtu, .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 CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = hinic_netpoll, @@ -2045,17 +2036,8 @@ static void netdev_feature_init(struct net_device *netdev) NETIF_F_GSO_UDP_TUNNEL_CSUM;
if (FUNC_SUPPORT_HW_VLAN(nic_dev->hwdev)) { -#if defined(NETIF_F_HW_VLAN_CTAG_TX) netdev->features |= NETIF_F_HW_VLAN_CTAG_TX; -#elif defined(NETIF_F_HW_VLAN_TX) - netdev->features |= NETIF_F_HW_VLAN_TX; -#endif - -#if defined(NETIF_F_HW_VLAN_CTAG_RX) netdev->features |= NETIF_F_HW_VLAN_CTAG_RX; -#elif defined(NETIF_F_HW_VLAN_RX) - netdev->features |= NETIF_F_HW_VLAN_RX; -#endif }
/* copy netdev features into list of user selectable features */ @@ -2074,16 +2056,12 @@ static void netdev_feature_init(struct net_device *netdev)
netdev->hw_features = hw_features;
-/* Set after hw_features because this could not be part of hw_features */ -#if defined(NETIF_F_HW_VLAN_CTAG_FILTER) + /* Set after hw_features because this could not be part of + * hw_features + */ netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; -#elif defined(NETIF_F_HW_VLAN_FILTER) - netdev->features |= NETIF_F_HW_VLAN_FILTER; -#endif
-#ifdef IFF_UNICAST_FLT netdev->priv_flags |= IFF_UNICAST_FLT; -#endif
if (FUNC_SUPPORT_ENCAP_TSO_CSUM(nic_dev->hwdev)) { netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nictool.c b/drivers/net/ethernet/huawei/hinic/hinic_nictool.c index 62b1535fe8af..01653891b72c 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nictool.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_nictool.c @@ -1703,7 +1703,7 @@ static int api_csr_write(void *hwdev, struct msg_module *nt_msg,
static u32 get_up_timeout_val(enum hinic_mod_type mod, u8 cmd) { - if (mod == HINIC_MOD_L2NIC && cmd == NIC_UP_CMD_UPDATE_FW) + if (mod == HINIC_MOD_L2NIC && cmd == HINIC_PORT_CMD_UPDATE_FW) return UP_UPDATEFW_TIME_OUT_VAL; else return UP_COMP_TIME_OUT_VAL; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nictool.h b/drivers/net/ethernet/huawei/hinic/hinic_nictool.h index e8eccaff37ce..3b8259a7b973 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nictool.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_nictool.h @@ -17,9 +17,6 @@ #define HINIC_NICTOOL_H_
#include "hinic_dfx_def.h" -#ifndef IFNAMSIZ -#define IFNAMSIZ 16 -#endif /* completion timeout interval, unit is jiffies*/ #define UP_COMP_TIME_OUT_VAL 10000U
@@ -207,18 +204,14 @@ struct hinic_dbg_rq_info { u32 msix_vector; };
-#ifndef BUSINFO_LEN -#define BUSINFO_LEN (32) -#endif +#define BUSINFO_LEN 32 struct pf_info { char name[IFNAMSIZ]; char bus_info[BUSINFO_LEN]; u32 pf_type; };
-#ifndef MAX_SIZE -#define MAX_SIZE (16) -#endif +#define MAX_SIZE 16 struct card_info { struct pf_info pf[MAX_SIZE]; u32 pf_num; @@ -242,13 +235,7 @@ struct hinic_card_func_info { struct func_pdev_info pdev_info[MAX_SIZE]; };
-#ifndef NIC_UP_CMD_UPDATE_FW -#define NIC_UP_CMD_UPDATE_FW (114) -#endif - -#ifndef MAX_CARD_NUM -#define MAX_CARD_NUM (64) -#endif +#define MAX_CARD_NUM 64 extern void *g_card_node_array[MAX_CARD_NUM]; extern void *g_card_vir_addr[MAX_CARD_NUM]; extern u64 g_card_phy_addr[MAX_CARD_NUM]; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_port_cmd.h b/drivers/net/ethernet/huawei/hinic/hinic_port_cmd.h index d428f48a5bb0..0b13ba9d2f26 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_port_cmd.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_port_cmd.h @@ -16,12 +16,6 @@ #ifndef __HINIC_PORT_CMD_H__ #define __HINIC_PORT_CMD_H__
-#ifdef __cplusplus - #if __cplusplus -extern "C"{ - #endif -#endif /* __cplusplus */ - /* cmd of mgmt CPU message for NIC module */ enum hinic_port_cmd { HINIC_PORT_CMD_VF_REGISTER = 0x0, @@ -544,9 +538,4 @@ enum hinic_pf_status { #define HINIC_PCI_MSIX_ENTRY_VECTOR_CTRL 12 #define HINIC_PCI_MSIX_ENTRY_CTRL_MASKBIT 1
-#ifdef __cplusplus - #if __cplusplus -} - #endif -#endif /* __cplusplus */ #endif /* __HINIC_PORT_CMD_H__ */ diff --git a/drivers/net/ethernet/huawei/hinic/hinic_qe_def.h b/drivers/net/ethernet/huawei/hinic/hinic_qe_def.h index db6e4597ab00..6e55b505dbb5 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_qe_def.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_qe_def.h @@ -16,12 +16,6 @@ #ifndef __HINIC_QE_DEF_H__ #define __HINIC_QE_DEF_H__
-#ifdef __cplusplus - #if __cplusplus -extern "C"{ - #endif -#endif /* __cplusplus */ - #define HINIC_SQ_WQEBB_SIZE 64 #define HINIC_RQ_WQE_SIZE 32 #define HINIC_SQ_WQEBB_SHIFT 6 @@ -462,10 +456,4 @@ enum rq_completion_fmt { RQ_COMPLETE_SGE = 1 };
- -#ifdef __cplusplus - #if __cplusplus -} - #endif -#endif /* __cplusplus */ #endif /* __HINIC_QE_DEF_H__ */ diff --git a/drivers/net/ethernet/huawei/hinic/hinic_qp.h b/drivers/net/ethernet/huawei/hinic/hinic_qp.h index 8789272b4fcb..005aaf130440 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_qp.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_qp.h @@ -103,10 +103,6 @@ void hinic_clear_rx_done(struct hinic_rq_cqe *cqe, u32 status_old); void hinic_prepare_rq_wqe(void *wqe, u16 pi, dma_addr_t buf_addr, dma_addr_t cqe_dma);
-#ifdef static -#undef static -#define LLT_STATIC_DEF_SAVED -#endif static inline void hinic_task_set_outter_l3(struct hinic_sq_task *task, enum sq_l3_type l3_type, u32 network_len) @@ -131,11 +127,6 @@ static inline void hinic_task_set_inner_l3(struct hinic_sq_task *task, task->pkt_info1 |= SQ_TASK_INFO1_SET(network_len, INNER_L3LEN); }
-#ifdef LLT_STATIC_DEF_SAVED -#define static -#undef LLT_STATIC_DEF_SAVED -#endif - void hinic_set_cs_inner_l4(struct hinic_sq_task *task, u32 *queue_info, enum sq_l4offload_type l4_offload, u32 l4_len, u32 offset); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.c b/drivers/net/ethernet/huawei/hinic/hinic_rx.c index 977f816e7258..9031186ede95 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.c @@ -264,11 +264,7 @@ static bool hinic_add_rx_frag(struct hinic_rxq *rxq, /* flip page offset to other buffer */ rx_info->page_offset ^= rxq->buf_len;
-#ifdef HAVE_PAGE_COUNT - atomic_add(1, &page->_count); -#else page_ref_inc(page); -#endif
return true; } @@ -464,7 +460,6 @@ static void hinic_rx_csum(struct hinic_rxq *rxq, u32 status, } }
-#ifdef HAVE_SKBUFF_CSUM_LEVEL static void hinic_rx_gro(struct hinic_rxq *rxq, u32 offload_type, struct sk_buff *skb) { @@ -481,7 +476,6 @@ static void hinic_rx_gro(struct hinic_rxq *rxq, u32 offload_type, /* If we checked the outer header let the stack know */ skb->csum_level = 1; } -#endif /* HAVE_SKBUFF_CSUM_LEVEL */
#define HINIC_RX_BP_THD 128
@@ -565,17 +559,10 @@ int recv_one_pkt(struct hinic_rxq *rxq, struct hinic_rq_cqe *rx_cqe, hinic_rx_csum(rxq, status, skb);
offload_type = be32_to_cpu(rx_cqe->offload_type); -#ifdef HAVE_SKBUFF_CSUM_LEVEL hinic_rx_gro(rxq, offload_type, skb); -#endif
-#if defined(NETIF_F_HW_VLAN_CTAG_RX) if ((netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && HINIC_GET_RX_VLAN_OFFLOAD_EN(offload_type)) { -#else - if ((netdev->features & NETIF_F_HW_VLAN_RX) && - HINIC_GET_RX_VLAN_OFFLOAD_EN(offload_type)) { -#endif u16 vid = HINIC_GET_RX_VLAN_TAG(vlan_len);
/* if the packet is a vlan pkt, the vid may be 0 */ @@ -589,11 +576,7 @@ int recv_one_pkt(struct hinic_rxq *rxq, struct hinic_rq_cqe *rx_cqe, skb->protocol = eth_type_trans(skb, netdev);
if (skb_has_frag_list(skb)) { -#ifdef HAVE_NAPI_GRO_FLUSH_OLD napi_gro_flush(&rxq->irq_cfg->napi, false); -#else - napi_gro_flush(&rxq->irq_cfg->napi); -#endif netif_receive_skb(skb); } else { napi_gro_receive(&rxq->irq_cfg->napi, skb); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sml_counter.c b/drivers/net/ethernet/huawei/hinic/hinic_sml_counter.c index eb35df6d9312..a790d9457342 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_sml_counter.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_sml_counter.c @@ -20,20 +20,12 @@ #include "hinic_hwdev.h" #include "hinic_sml_counter.h"
-#ifndef HTONL -#define HTONL(x) \ - ((((x) & 0x000000ff) << 24) \ - | (((x) & 0x0000ff00) << 8) \ - | (((x) & 0x00ff0000) >> 8) \ - | (((x) & 0xff000000) >> 24)) -#endif - static void sml_ctr_htonl_n(u32 *node, u32 ulLen) { u32 i;
for (i = 0; i < ulLen; i++) { - *node = HTONL(*node); + *node = cpu_to_be32(*node); node++; } } @@ -46,10 +38,10 @@ static void hinic_sml_ctr_read_build_req(chipif_sml_ctr_rd_req_s *msg, msg->head.bs.instance = instance_id; msg->head.bs.op_id = op_id; msg->head.bs.ack = ack; - msg->head.value = HTONL(msg->head.value); + msg->head.value = cpu_to_be32(msg->head.value);
msg->ctr_id = ctr_id; - msg->ctr_id = HTONL(msg->ctr_id); + msg->ctr_id = cpu_to_be32(msg->ctr_id);
msg->initial = init_val; } @@ -63,10 +55,10 @@ static void hinic_sml_ctr_write_build_req(chipif_sml_ctr_wr_req_s *msg, msg->head.bs.instance = instance_id; msg->head.bs.op_id = op_id; msg->head.bs.ack = ack; - msg->head.value = HTONL(msg->head.value); + msg->head.value = cpu_to_be32(msg->head.value);
msg->ctr_id = ctr_id; - msg->ctr_id = HTONL(msg->ctr_id); + msg->ctr_id = cpu_to_be32(msg->ctr_id);
msg->value1_h = val1 >> 32; msg->value1_l = val1 & 0xFFFFFFFF; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sml_lt.c b/drivers/net/ethernet/huawei/hinic/hinic_sml_lt.c index 246ceead5fed..ad13f70d0ffa 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_sml_lt.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_sml_lt.c @@ -35,14 +35,6 @@ #define LT_LOAD16_API_SIZE (16 + 4) #define LT_STORE16_API_SIZE (32 + 4)
-#ifndef HTONL -#define HTONL(x) \ - ((((x) & 0x000000ff) << 24) \ - | (((x) & 0x0000ff00) << 8) \ - | (((x) & 0x00ff0000) >> 8) \ - | (((x) & 0xff000000) >> 24)) -#endif - static inline void sm_lt_build_head(sml_lt_req_head_u *head, u8 instance_id, u8 op_id, u8 ack, @@ -56,7 +48,7 @@ static inline void sm_lt_build_head(sml_lt_req_head_u *head, head->bs.abuf_flg = 0; head->bs.bc = 1; head->bs.offset = offset; - head->value = HTONL((head->value)); + head->value = cpu_to_be32(head->value); }
static inline void sm_lt_load_build_req(sml_lt_load_req_s *req, @@ -68,7 +60,7 @@ static inline void sm_lt_load_build_req(sml_lt_load_req_s *req, sm_lt_build_head(&req->head, instance_id, op_id, ack, offset, num); req->extra = 0; req->index = lt_index; - req->index = HTONL(req->index); + req->index = cpu_to_be32(req->index); }
static inline void sm_lt_store_build_req(sml_lt_store_req_s *req, @@ -84,11 +76,11 @@ static inline void sm_lt_store_build_req(sml_lt_store_req_s *req, { sm_lt_build_head(&req->head, instance_id, op_id, ack, offset, num); req->index = lt_index; - req->index = HTONL(req->index); + req->index = cpu_to_be32(req->index); req->extra = 0; req->byte_enb[0] = (u32)(byte_enb3); - req->byte_enb[0] = HTONL(req->byte_enb[0]); - req->byte_enb[1] = HTONL((((u32)byte_enb2) << 16) | byte_enb1); + req->byte_enb[0] = cpu_to_be32(req->byte_enb[0]); + req->byte_enb[1] = cpu_to_be32((((u32)byte_enb2) << 16) | byte_enb1); sml_lt_store_memcpy((u32 *)req->write_data, (u32 *)(void *)data, num); }
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c index 68a397ae73bf..047023267ead 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c @@ -26,75 +26,6 @@ #include "hinic_sriov.h" #include "hinic_lld.h"
-#if !(defined(HAVE_SRIOV_CONFIGURE) || defined(HAVE_RHEL6_SRIOV_CONFIGURE)) -ssize_t hinic_sriov_totalvfs_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct pci_dev *pdev = to_pci_dev(dev); - - return sprintf(buf, "%d\n", pci_sriov_get_totalvfs(pdev)); -} - -ssize_t hinic_sriov_numvfs_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct pci_dev *pdev = to_pci_dev(dev); - - return sprintf(buf, "%d\n", pci_num_vf(pdev)); -} - -/*lint -save -e713*/ -ssize_t hinic_sriov_numvfs_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct pci_dev *pdev = to_pci_dev(dev); - int ret; - u16 num_vfs; - int cur_vfs, total_vfs; - - ret = kstrtou16(buf, 0, &num_vfs); - if (ret < 0) - return ret; - - cur_vfs = pci_num_vf(pdev); - total_vfs = pci_sriov_get_totalvfs(pdev); - - if (num_vfs > total_vfs) - return -ERANGE; - - if (num_vfs == cur_vfs) - return count; /* no change */ - - if (num_vfs == 0) { - /* disable VFs */ - ret = hinic_pci_sriov_configure(pdev, 0); - if (ret < 0) - return ret; - return count; - } - - /* enable VFs */ - if (cur_vfs) { - nic_warn(&pdev->dev, "%d VFs already enabled. Disable before enabling %d VFs\n", - cur_vfs, num_vfs); - return -EBUSY; - } - - ret = hinic_pci_sriov_configure(pdev, num_vfs); - if (ret < 0) - return ret; - - if (ret != num_vfs) - nic_warn(&pdev->dev, "%d VFs requested; only %d enabled\n", - num_vfs, ret); - - return count; -} - -/*lint -restore*/ -#endif /* !(HAVE_SRIOV_CONFIGURE || HAVE_RHEL6_SRIOV_CONFIGURE) */ - int hinic_pci_sriov_disable(struct pci_dev *dev) { #ifdef CONFIG_PCI_IOV diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sriov.h b/drivers/net/ethernet/huawei/hinic/hinic_sriov.h index b2aded0190d0..67b3174f09f0 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_sriov.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_sriov.h @@ -16,16 +16,6 @@ #ifndef HINIC_SRIOV_H #define HINIC_SRIOV_H
-#if !(defined(HAVE_SRIOV_CONFIGURE) || defined(HAVE_RHEL6_SRIOV_CONFIGURE)) -ssize_t hinic_sriov_totalvfs_show(struct device *dev, - struct device_attribute *attr, char *buf); -ssize_t hinic_sriov_numvfs_show(struct device *dev, - struct device_attribute *attr, char *buf); -ssize_t hinic_sriov_numvfs_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count); -#endif /* !(HAVE_SRIOV_CONFIGURE || HAVE_RHEL6_SRIOV_CONFIGURE) */ - enum hinic_sriov_state { HINIC_SRIOV_DISABLE, HINIC_SRIOV_ENABLE, diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.c b/drivers/net/ethernet/huawei/hinic/hinic_tx.c index be57be78feee..c60b3326708b 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_tx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.c @@ -280,30 +280,14 @@ static void get_inner_l3_l4_type(struct sk_buff *skb, union hinic_ip *ip, *l3_type = (offload_type == TX_OFFLOAD_CSUM) ? IPV4_PKT_NO_CHKSUM_OFFLOAD : IPV4_PKT_WITH_CHKSUM_OFFLOAD; *l4_proto = ip->v4->protocol; - -#ifdef HAVE_OUTER_IPV6_TUNNEL_OFFLOAD - /* inner_transport_header is wrong in centos7.0 and suse12.1 */ - l4->hdr = ip->hdr + ((u8)ip->v4->ihl << 2); -#endif } else if (ip->v4->version == 6) { *l3_type = IPV6_PKT; exthdr = ip->hdr + sizeof(*ip->v6); *l4_proto = ip->v6->nexthdr; if (exthdr != l4->hdr) { __be16 frag_off = 0; -#ifndef HAVE_OUTER_IPV6_TUNNEL_OFFLOAD ipv6_skip_exthdr(skb, (int)(exthdr - skb->data), l4_proto, &frag_off); -#else - int pld_off = 0; - - pld_off = ipv6_skip_exthdr(skb, - (int)(exthdr - skb->data), - l4_proto, &frag_off); - l4->hdr = skb->data + pld_off; - } else { - l4->hdr = exthdr; -#endif } } else { *l3_type = UNKNOWN_L3TYPE; @@ -380,9 +364,6 @@ static int hinic_tx_csum(struct hinic_sq_task *task, u32 *queue_info, __be16 frag_off;
l3_type = IPV6_PKT; -#ifdef HAVE_OUTER_IPV6_TUNNEL_OFFLOAD - tunnel_type = TUNNEL_UDP_CSUM; -#endif exthdr = ip.hdr + sizeof(*ip.v6); l4_proto = ip.v6->nexthdr; l4.hdr = skb_transport_header(skb); @@ -424,22 +405,6 @@ static int hinic_tx_csum(struct hinic_sq_task *task, u32 *queue_info, get_inner_l4_info(skb, &l4, TX_OFFLOAD_CSUM, l4_proto, &l4_offload, &l4_len, &offset);
-#ifdef HAVE_OUTER_IPV6_TUNNEL_OFFLOAD - /* get wrong network header length using skb_network_header_len */ - if (unlikely(l3_type == UNKNOWN_L3TYPE)) - network_hdr_len = 0; - else - network_hdr_len = l4.hdr - ip.hdr; - - /* payload offset must be setted */ - if (unlikely(!offset)) { - if (l3_type == UNKNOWN_L3TYPE) - offset = ip.hdr - skb->data; - else if (l4_offload == OFFLOAD_DISABLE) - offset = ip.hdr - skb->data + network_hdr_len; - } -#endif - hinic_task_set_inner_l3(task, l3_type, network_hdr_len);
hinic_set_cs_inner_l4(task, queue_info, l4_offload, l4_len, offset); @@ -497,16 +462,7 @@ static int hinic_tso(struct hinic_sq_task *task, u32 *queue_info, l4.udp->check = ~csum_magic(&ip, IPPROTO_UDP); tunnel_type = TUNNEL_UDP_CSUM; } else if (gso_type & SKB_GSO_UDP_TUNNEL) { -#ifdef HAVE_OUTER_IPV6_TUNNEL_OFFLOAD - if (l3_type == IPV6_PKT) { - tunnel_type = TUNNEL_UDP_CSUM; - l4.udp->check = ~csum_magic(&ip, IPPROTO_UDP); - } else { - tunnel_type = TUNNEL_UDP_NO_CSUM; - } -#else tunnel_type = TUNNEL_UDP_NO_CSUM; -#endif }
l4_tunnel_len = skb_inner_network_offset(skb) - @@ -535,20 +491,6 @@ static int hinic_tso(struct hinic_sq_task *task, u32 *queue_info, get_inner_l4_info(skb, &l4, TX_OFFLOAD_TSO, l4_proto, &l4_offload, &l4_len, &offset);
-#ifdef HAVE_OUTER_IPV6_TUNNEL_OFFLOAD - if (unlikely(l3_type == UNKNOWN_L3TYPE)) - network_hdr_len = 0; - else - network_hdr_len = l4.hdr - ip.hdr; - - if (unlikely(!offset)) { - if (l3_type == UNKNOWN_L3TYPE) - offset = ip.hdr - skb->data; - else if (l4_offload == OFFLOAD_DISABLE) - offset = ip.hdr - skb->data + network_hdr_len; - } -#endif - hinic_task_set_inner_l3(task, l3_type, network_hdr_len);
hinic_set_tso_inner_l4(task, queue_info, l4_offload, l4_len, diff --git a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h index 062f4f67a819..acd5f200b487 100644 --- a/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h +++ b/drivers/net/ethernet/huawei/hinic/ossl_knl_linux.h @@ -56,85 +56,6 @@ #define ADVERTISED_25000baseCR_Full 0 #endif
-#ifndef RHEL_RELEASE_VERSION -#define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b)) -#endif - -#ifndef RHEL_RELEASE_CODE -/* NOTE: RHEL_RELEASE_* introduced in RHEL4.5. */ -#define RHEL_RELEASE_CODE 0 -#endif - -/* SuSE version macros are the same as Linux kernel version macro. */ -#ifndef SLE_VERSION -#define SLE_VERSION(a, b, c) KERNEL_VERSION(a, b, c) -#endif -#define SLE_LOCALVERSION(a, b, c) KERNEL_VERSION(a, b, c) -#ifdef CONFIG_SUSE_KERNEL -#if (KERNEL_VERSION(92, 0, 0) <= SLE_LOCALVERSION_CODE && \ - KERNEL_VERSION(93, 0, 0) > SLE_LOCALVERSION_CODE) -/* SLES12 SP2 GA is 4.4.21-69. - * SLES12 SP2 updates before SLES12 SP3 are: 4.4.{21,38,49,59} - * SLES12 SP2 updates after SLES12 SP3 are: 4.4.{74,90,103,114,120} - * but they all use a SLE_LOCALVERSION_CODE matching 92.nn.y - */ -#define SLE_VERSION_CODE SLE_VERSION(12, 2, 0) -#else -/* SLES15 Beta1 is 4.12.14-2. - * SLES12 SP4 will also use 4.12.14-nn.xx.y - */ -#define SLE_VERSION_CODE SLE_VERSION(15, 0, 0) -/* new SLES kernels must be added here with >= based on kernel - * the idea is to order from newest to oldest and just catch all - * of them using the >= - */ -#endif /* LINUX_VERSION_CODE == KERNEL VERSION(x,y,z) */ -#endif /* CONFIG_SUSE_KERNEL */ -#ifndef SLE_VERSION_CODE -#define SLE_VERSION_CODE 0 -#endif /* SLE_VERSION_CODE */ -#ifndef SLE_LOCALVERSION_CODE -#define SLE_LOCALVERSION_CODE 0 -#endif /* SLE_LOCALVERSION_CODE */ - -/*****************************************************************************/ -#define ETH_TYPE_TRANS_SETS_DEV - -/*****************************************************************************/ - -#if (RHEL_RELEASE_CODE && \ - (RHEL_RELEASE_VERSION(6, 2) <= RHEL_RELEASE_CODE) && \ - (RHEL_RELEASE_VERSION(7, 0) > RHEL_RELEASE_CODE)) -#define HAVE_RHEL6_NET_DEVICE_EXTENDED -#endif /* RHEL >= 6.2 && RHEL < 7.0 */ - -/*****************************************************************************/ -#define HAVE_NAPI_GRO_FLUSH_OLD - -/*****************************************************************************/ -#ifndef HAVE_SRIOV_CONFIGURE -#define HAVE_SRIOV_CONFIGURE -#endif - -/*****************************************************************************/ -#define HAVE_NDO_SELECT_QUEUE_ACCEL - -/*****************************************************************************/ -#define HAVE_SKBUFF_CSUM_LEVEL - -/*****************************************************************************/ -#define HAVE_TIMER_SETUP -/*****************************************************************************/ - -/* vxlan outer udp checksum will offload and skb->inner_transport_header - * is wrong - */ -#if (SLE_VERSION_CODE && ((SLE_VERSION(12, 1, 0) == SLE_VERSION_CODE) || \ - (SLE_VERSION(12, 0, 0) == SLE_VERSION_CODE))) || \ - (RHEL_RELEASE_CODE && (RHEL_RELEASE_VERSION(7, 0) == RHEL_RELEASE_CODE)) -#define HAVE_OUTER_IPV6_TUNNEL_OFFLOAD -#endif - int local_atoi(const char *name);
#define nicif_err(priv, type, dev, fmt, args...) \
From: Chiqijun chiqijun@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
Delete unused UFO codes.
Signed-off-by: Chiqijun chiqijun@huawei.com Reviewed-by: Zengweiliang zengweiliang.zengweiliang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/huawei/hinic/hinic_tx.c | 157 ------------------- 1 file changed, 157 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.c b/drivers/net/ethernet/huawei/hinic/hinic_tx.c index c60b3326708b..b242b7ddde04 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_tx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.c @@ -482,11 +482,6 @@ static int hinic_tso(struct hinic_sq_task *task, u32 *queue_info,
if (l4_proto == IPPROTO_TCP) l4.tcp->check = ~csum_magic(&ip, IPPROTO_TCP); -#ifdef HAVE_IP6_FRAG_ID_ENABLE_UFO - else if (l4_proto == IPPROTO_UDP && ip.v4->version == 6) - ip_identify = be32_to_cpu(skb_shinfo(skb)->ip6_frag_id); - /* changed to big endiant is just to keep the same code style here */ -#endif
get_inner_l4_info(skb, &l4, TX_OFFLOAD_TSO, l4_proto, &l4_offload, &l4_len, &offset); @@ -615,119 +610,6 @@ static void *__try_to_get_wqe(struct net_device *netdev, u16 q_id, return wqe; }
-#ifdef HAVE_IP6_FRAG_ID_ENABLE_UFO -static int hinic_ufo_avoidance(struct sk_buff *skb, struct sk_buff **ufo_skb, - struct net_device *netdev, struct hinic_txq *txq) -{ - __be32 ip6_frag_id = skb_shinfo(skb)->ip6_frag_id; - u16 gso_size = skb_shinfo(skb)->gso_size; - struct frag_hdr ipv6_fhdr = {0}; - union hinic_ip ip; - u32 l2_l3_hlen, l3_payload_len, extra_len; - u32 skb_len, nsize, frag_data_len = 0; - u16 ipv6_fhl_ext = sizeof(struct frag_hdr); - __wsum frag_data_csum = 0; - u16 frag_offset = 0; - u8 *tmp = NULL; - int err; - - ip.hdr = skb_network_header(skb); - if (ip.v6->version == 6 && ip.v6->nexthdr != NEXTHDR_UDP) { - TXQ_STATS_INC(txq, ufo_pkt_unsupport); - return -EPROTONOSUPPORT; - } - - /* linearize the big ufo packet */ - err = skb_linearize(skb); - if (err) { - TXQ_STATS_INC(txq, ufo_linearize_err); - return err; - } - - extra_len = skb->len - HINIC_GSO_MAX_SIZE; - l2_l3_hlen = (u32)(skb_transport_header(skb) - skb_mac_header(skb)); - l3_payload_len = skb->len - l2_l3_hlen; - frag_data_len += extra_len + - ((l3_payload_len - extra_len) % gso_size); - skb_len = skb->len - frag_data_len; - - /* ipv6 need external frag header */ - if (ip.v6->version == 6) - nsize = frag_data_len + l2_l3_hlen + ipv6_fhl_ext; - else - nsize = frag_data_len + l2_l3_hlen; - - *ufo_skb = netdev_alloc_skb_ip_align(netdev, nsize); - if (!*ufo_skb) { - TXQ_STATS_INC(txq, ufo_alloc_skb_err); - return -ENOMEM; - } - - /* copy l2_l3 layer header from original skb to ufo_skb */ - skb_copy_from_linear_data_offset(skb, 0, skb_put(*ufo_skb, l2_l3_hlen), - l2_l3_hlen); - - /* reserve ipv6 external frag header for ufo_skb */ - if (ip.v6->version == 6) { - ipv6_fhdr.nexthdr = NEXTHDR_UDP; - ipv6_fhdr.reserved = 0; - frag_offset = (u16)(l3_payload_len - frag_data_len); - ipv6_fhdr.frag_off = htons(frag_offset); - ipv6_fhdr.identification = ip6_frag_id; - tmp = skb_put(*ufo_skb, ipv6_fhl_ext); - memcpy(tmp, &ipv6_fhdr, ipv6_fhl_ext); - } - - /* split original one skb to two parts: skb and ufo_skb */ - skb_split(skb, (*ufo_skb), skb_len); - - /* modify skb ip total len */ - ip.hdr = skb_network_header(skb); - if (ip.v4->version == 4) - ip.v4->tot_len = htons(ntohs(ip.v4->tot_len) - - (u16)frag_data_len); - else - ip.v6->payload_len = htons(ntohs(ip.v6->payload_len) - - (u16)frag_data_len); - - /* set ufo_skb network header */ - skb_set_network_header(*ufo_skb, skb_network_offset(skb)); - - /* set vlan offload feature */ - (*ufo_skb)->vlan_tci = skb->vlan_tci; - - /* modify ufo_skb ip total len, flag, frag_offset and compute csum */ - ip.hdr = skb_network_header(*ufo_skb); - if (ip.v4->version == 4) { - /* compute ufo_skb data csum and put into skb udp csum */ - tmp = (*ufo_skb)->data + l2_l3_hlen; - frag_data_csum = csum_partial(tmp, (int)frag_data_len, 0); - udp_hdr(skb)->check = - (__sum16)csum_add(~csum_fold(frag_data_csum), - udp_hdr(skb)->check); - - ip.v4->tot_len = htons((u16)(skb_network_header_len(skb) + - frag_data_len)); - ip.v4->frag_off = 0; - frag_offset = (u16)((l3_payload_len - frag_data_len) >> 3); - ip.v4->frag_off = htons(frag_offset); - ip_send_check(ip.v4); - } else { - /* compute ufo_skb data csum and put into skb udp csum */ - tmp = (*ufo_skb)->data + l2_l3_hlen + ipv6_fhl_ext; - frag_data_csum = csum_partial(tmp, (int)frag_data_len, 0); - udp_hdr(skb)->check = - (__sum16)csum_add(~csum_fold(frag_data_csum), - udp_hdr(skb)->check); - - ip.v6->payload_len = htons(ipv6_fhl_ext + (u16)frag_data_len); - ip.v6->nexthdr = NEXTHDR_FRAGMENT; - } - - return 0; -} -#endif - #define HINIC_FRAG_STATUS_OK 0 #define HINIC_FRAG_STATUS_IGNORE 1
@@ -895,10 +777,6 @@ netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) u16 q_id = skb_get_queue_mapping(skb); struct hinic_txq *txq; u8 flag = 0; -#ifdef HAVE_IP6_FRAG_ID_ENABLE_UFO - struct sk_buff *ufo_skb; - int err; -#endif
if (unlikely(!netif_carrier_ok(netdev) || !nic_dev->heart_status)) { @@ -914,41 +792,6 @@ netdev_tx_t hinic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) } txq = &nic_dev->txqs[q_id];
-#ifdef HAVE_IP6_FRAG_ID_ENABLE_UFO - /* UFO avoidance */ - if (unlikely(skb->len > HINIC_GSO_MAX_SIZE && - (skb_shinfo(skb)->gso_type & SKB_GSO_UDP))) { - TXQ_STATS_INC(txq, big_udp_pkts); - - err = hinic_ufo_avoidance(skb, &ufo_skb, netdev, txq); - if (err) - goto tx_drop_pkts; - - err = hinic_send_one_skb(skb, netdev, txq, &flag, - HINIC_TX_UFO_AVD); - if (err == NETDEV_TX_BUSY) { - dev_kfree_skb_any(ufo_skb); - return NETDEV_TX_BUSY; - } - - if (flag == HINIC_TX_DROPED) { - nicif_err(nic_dev, drv, netdev, "Send first skb failed for HINIC_TX_SKB_DROPED\n"); - dev_kfree_skb_any(ufo_skb); - return NETDEV_TX_OK; - } - - err = hinic_send_one_skb(ufo_skb, netdev, txq, &flag, - HINIC_TX_NON_AVD); - if (err == NETDEV_TX_BUSY) { - nicif_err(nic_dev, drv, netdev, "Send second skb failed for NETDEV_TX_BUSY\n"); - dev_kfree_skb_any(ufo_skb); - return NETDEV_TX_OK; - } - - return NETDEV_TX_OK; - } -#endif - return hinic_send_one_skb(skb, netdev, txq, &flag, HINIC_TX_NON_AVD);
tx_drop_pkts: