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...) \