提交 d528114b 编写于 作者: D David S. Miller

Merge branch 'hns3-misc-cleanups'

Salil Mehta says:

====================
Misc. cleanups for HNS3 ethernet driver

This patch-set presents some cleanups for HNS3 Ethernet Driver.
====================
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016-2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/list.h> #include <linux/list.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016-2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __HNAE3_H #ifndef __HNAE3_H
#define __HNAE3_H #define __HNAE3_H
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016-2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include "hnae3.h" #include "hnae3.h"
#include "hns3_enet.h" #include "hns3_enet.h"
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016~2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
...@@ -62,9 +56,9 @@ static const struct pci_device_id hns3_pci_tbl[] = { ...@@ -62,9 +56,9 @@ static const struct pci_device_id hns3_pci_tbl[] = {
}; };
MODULE_DEVICE_TABLE(pci, hns3_pci_tbl); MODULE_DEVICE_TABLE(pci, hns3_pci_tbl);
static irqreturn_t hns3_irq_handle(int irq, void *dev) static irqreturn_t hns3_irq_handle(int irq, void *vector)
{ {
struct hns3_enet_tqp_vector *tqp_vector = dev; struct hns3_enet_tqp_vector *tqp_vector = vector;
napi_schedule(&tqp_vector->napi); napi_schedule(&tqp_vector->napi);
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __HNS3_ENET_H #ifndef __HNS3_ENET_H
#define __HNS3_ENET_H #define __HNS3_ENET_H
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016~2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/string.h> #include <linux/string.h>
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016~2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -72,7 +66,7 @@ static int hclge_alloc_cmd_queue(struct hclge_dev *hdev, int ring_type) ...@@ -72,7 +66,7 @@ static int hclge_alloc_cmd_queue(struct hclge_dev *hdev, int ring_type)
(ring_type == HCLGE_TYPE_CSQ) ? &hw->cmq.csq : &hw->cmq.crq; (ring_type == HCLGE_TYPE_CSQ) ? &hw->cmq.csq : &hw->cmq.crq;
int ret; int ret;
ring->flag = ring_type; ring->ring_type = ring_type;
ring->dev = hdev; ring->dev = hdev;
ret = hclge_alloc_cmd_desc(ring); ret = hclge_alloc_cmd_desc(ring);
...@@ -111,7 +105,7 @@ static void hclge_cmd_config_regs(struct hclge_cmq_ring *ring) ...@@ -111,7 +105,7 @@ static void hclge_cmd_config_regs(struct hclge_cmq_ring *ring)
struct hclge_dev *hdev = ring->dev; struct hclge_dev *hdev = ring->dev;
struct hclge_hw *hw = &hdev->hw; struct hclge_hw *hw = &hdev->hw;
if (ring->flag == HCLGE_TYPE_CSQ) { if (ring->ring_type == HCLGE_TYPE_CSQ) {
hclge_write_dev(hw, HCLGE_NIC_CSQ_BASEADDR_L_REG, hclge_write_dev(hw, HCLGE_NIC_CSQ_BASEADDR_L_REG,
lower_32_bits(dma)); lower_32_bits(dma));
hclge_write_dev(hw, HCLGE_NIC_CSQ_BASEADDR_H_REG, hclge_write_dev(hw, HCLGE_NIC_CSQ_BASEADDR_H_REG,
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016~2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __HCLGE_CMD_H #ifndef __HCLGE_CMD_H
#define __HCLGE_CMD_H #define __HCLGE_CMD_H
...@@ -27,17 +21,10 @@ struct hclge_desc { ...@@ -27,17 +21,10 @@ struct hclge_desc {
__le32 data[6]; __le32 data[6];
}; };
struct hclge_desc_cb {
dma_addr_t dma;
void *va;
u32 length;
};
struct hclge_cmq_ring { struct hclge_cmq_ring {
dma_addr_t desc_dma_addr; dma_addr_t desc_dma_addr;
struct hclge_desc *desc; struct hclge_desc *desc;
struct hclge_desc_cb *desc_cb; struct hclge_dev *dev;
struct hclge_dev *dev;
u32 head; u32 head;
u32 tail; u32 tail;
...@@ -45,7 +32,7 @@ struct hclge_cmq_ring { ...@@ -45,7 +32,7 @@ struct hclge_cmq_ring {
u16 desc_num; u16 desc_num;
int next_to_use; int next_to_use;
int next_to_clean; int next_to_clean;
u8 flag; u8 ring_type; /* cmq ring type */
spinlock_t lock; /* Command queue lock */ spinlock_t lock; /* Command queue lock */
}; };
...@@ -71,26 +58,19 @@ struct hclge_misc_vector { ...@@ -71,26 +58,19 @@ struct hclge_misc_vector {
struct hclge_cmq { struct hclge_cmq {
struct hclge_cmq_ring csq; struct hclge_cmq_ring csq;
struct hclge_cmq_ring crq; struct hclge_cmq_ring crq;
u16 tx_timeout; /* Tx timeout */ u16 tx_timeout;
enum hclge_cmd_status last_status; enum hclge_cmd_status last_status;
}; };
#define HCLGE_CMD_FLAG_IN_VALID_SHIFT 0 #define HCLGE_CMD_FLAG_IN BIT(0)
#define HCLGE_CMD_FLAG_OUT_VALID_SHIFT 1 #define HCLGE_CMD_FLAG_OUT BIT(1)
#define HCLGE_CMD_FLAG_NEXT_SHIFT 2 #define HCLGE_CMD_FLAG_NEXT BIT(2)
#define HCLGE_CMD_FLAG_WR_OR_RD_SHIFT 3 #define HCLGE_CMD_FLAG_WR BIT(3)
#define HCLGE_CMD_FLAG_NO_INTR_SHIFT 4 #define HCLGE_CMD_FLAG_NO_INTR BIT(4)
#define HCLGE_CMD_FLAG_ERR_INTR_SHIFT 5 #define HCLGE_CMD_FLAG_ERR_INTR BIT(5)
#define HCLGE_CMD_FLAG_IN BIT(HCLGE_CMD_FLAG_IN_VALID_SHIFT)
#define HCLGE_CMD_FLAG_OUT BIT(HCLGE_CMD_FLAG_OUT_VALID_SHIFT)
#define HCLGE_CMD_FLAG_NEXT BIT(HCLGE_CMD_FLAG_NEXT_SHIFT)
#define HCLGE_CMD_FLAG_WR BIT(HCLGE_CMD_FLAG_WR_OR_RD_SHIFT)
#define HCLGE_CMD_FLAG_NO_INTR BIT(HCLGE_CMD_FLAG_NO_INTR_SHIFT)
#define HCLGE_CMD_FLAG_ERR_INTR BIT(HCLGE_CMD_FLAG_ERR_INTR_SHIFT)
enum hclge_opcode_type { enum hclge_opcode_type {
/* Generic command */ /* Generic commands */
HCLGE_OPC_QUERY_FW_VER = 0x0001, HCLGE_OPC_QUERY_FW_VER = 0x0001,
HCLGE_OPC_CFG_RST_TRIGGER = 0x0020, HCLGE_OPC_CFG_RST_TRIGGER = 0x0020,
HCLGE_OPC_GBL_RST_STATUS = 0x0021, HCLGE_OPC_GBL_RST_STATUS = 0x0021,
...@@ -106,18 +86,16 @@ enum hclge_opcode_type { ...@@ -106,18 +86,16 @@ enum hclge_opcode_type {
HCLGE_OPC_QUERY_REG_NUM = 0x0040, HCLGE_OPC_QUERY_REG_NUM = 0x0040,
HCLGE_OPC_QUERY_32_BIT_REG = 0x0041, HCLGE_OPC_QUERY_32_BIT_REG = 0x0041,
HCLGE_OPC_QUERY_64_BIT_REG = 0x0042, HCLGE_OPC_QUERY_64_BIT_REG = 0x0042,
/* Device management command */
/* MAC commond */ /* MAC command */
HCLGE_OPC_CONFIG_MAC_MODE = 0x0301, HCLGE_OPC_CONFIG_MAC_MODE = 0x0301,
HCLGE_OPC_CONFIG_AN_MODE = 0x0304, HCLGE_OPC_CONFIG_AN_MODE = 0x0304,
HCLGE_OPC_QUERY_AN_RESULT = 0x0306, HCLGE_OPC_QUERY_AN_RESULT = 0x0306,
HCLGE_OPC_QUERY_LINK_STATUS = 0x0307, HCLGE_OPC_QUERY_LINK_STATUS = 0x0307,
HCLGE_OPC_CONFIG_MAX_FRM_SIZE = 0x0308, HCLGE_OPC_CONFIG_MAX_FRM_SIZE = 0x0308,
HCLGE_OPC_CONFIG_SPEED_DUP = 0x0309, HCLGE_OPC_CONFIG_SPEED_DUP = 0x0309,
/* MACSEC command */
/* PFC/Pause CMD*/ /* PFC/Pause commands */
HCLGE_OPC_CFG_MAC_PAUSE_EN = 0x0701, HCLGE_OPC_CFG_MAC_PAUSE_EN = 0x0701,
HCLGE_OPC_CFG_PFC_PAUSE_EN = 0x0702, HCLGE_OPC_CFG_PFC_PAUSE_EN = 0x0702,
HCLGE_OPC_CFG_MAC_PARA = 0x0703, HCLGE_OPC_CFG_MAC_PARA = 0x0703,
...@@ -148,7 +126,7 @@ enum hclge_opcode_type { ...@@ -148,7 +126,7 @@ enum hclge_opcode_type {
HCLGE_OPC_TM_QS_SCH_MODE_CFG = 0x0814, HCLGE_OPC_TM_QS_SCH_MODE_CFG = 0x0814,
HCLGE_OPC_TM_BP_TO_QSET_MAPPING = 0x0815, HCLGE_OPC_TM_BP_TO_QSET_MAPPING = 0x0815,
/* Packet buffer allocate command */ /* Packet buffer allocate commands */
HCLGE_OPC_TX_BUFF_ALLOC = 0x0901, HCLGE_OPC_TX_BUFF_ALLOC = 0x0901,
HCLGE_OPC_RX_PRIV_BUFF_ALLOC = 0x0902, HCLGE_OPC_RX_PRIV_BUFF_ALLOC = 0x0902,
HCLGE_OPC_RX_PRIV_WL_ALLOC = 0x0903, HCLGE_OPC_RX_PRIV_WL_ALLOC = 0x0903,
...@@ -156,11 +134,10 @@ enum hclge_opcode_type { ...@@ -156,11 +134,10 @@ enum hclge_opcode_type {
HCLGE_OPC_RX_COM_WL_ALLOC = 0x0905, HCLGE_OPC_RX_COM_WL_ALLOC = 0x0905,
HCLGE_OPC_RX_GBL_PKT_CNT = 0x0906, HCLGE_OPC_RX_GBL_PKT_CNT = 0x0906,
/* PTP command */
/* TQP management command */ /* TQP management command */
HCLGE_OPC_SET_TQP_MAP = 0x0A01, HCLGE_OPC_SET_TQP_MAP = 0x0A01,
/* TQP command */ /* TQP commands */
HCLGE_OPC_CFG_TX_QUEUE = 0x0B01, HCLGE_OPC_CFG_TX_QUEUE = 0x0B01,
HCLGE_OPC_QUERY_TX_POINTER = 0x0B02, HCLGE_OPC_QUERY_TX_POINTER = 0x0B02,
HCLGE_OPC_QUERY_TX_STATUS = 0x0B03, HCLGE_OPC_QUERY_TX_STATUS = 0x0B03,
...@@ -172,10 +149,10 @@ enum hclge_opcode_type { ...@@ -172,10 +149,10 @@ enum hclge_opcode_type {
HCLGE_OPC_CFG_COM_TQP_QUEUE = 0x0B20, HCLGE_OPC_CFG_COM_TQP_QUEUE = 0x0B20,
HCLGE_OPC_RESET_TQP_QUEUE = 0x0B22, HCLGE_OPC_RESET_TQP_QUEUE = 0x0B22,
/* TSO cmd */ /* TSO command */
HCLGE_OPC_TSO_GENERIC_CONFIG = 0x0C01, HCLGE_OPC_TSO_GENERIC_CONFIG = 0x0C01,
/* RSS cmd */ /* RSS commands */
HCLGE_OPC_RSS_GENERIC_CONFIG = 0x0D01, HCLGE_OPC_RSS_GENERIC_CONFIG = 0x0D01,
HCLGE_OPC_RSS_INDIR_TABLE = 0x0D07, HCLGE_OPC_RSS_INDIR_TABLE = 0x0D07,
HCLGE_OPC_RSS_TC_MODE = 0x0D08, HCLGE_OPC_RSS_TC_MODE = 0x0D08,
...@@ -184,15 +161,15 @@ enum hclge_opcode_type { ...@@ -184,15 +161,15 @@ enum hclge_opcode_type {
/* Promisuous mode command */ /* Promisuous mode command */
HCLGE_OPC_CFG_PROMISC_MODE = 0x0E01, HCLGE_OPC_CFG_PROMISC_MODE = 0x0E01,
/* Vlan offload command */ /* Vlan offload commands */
HCLGE_OPC_VLAN_PORT_TX_CFG = 0x0F01, HCLGE_OPC_VLAN_PORT_TX_CFG = 0x0F01,
HCLGE_OPC_VLAN_PORT_RX_CFG = 0x0F02, HCLGE_OPC_VLAN_PORT_RX_CFG = 0x0F02,
/* Interrupts cmd */ /* Interrupts commands */
HCLGE_OPC_ADD_RING_TO_VECTOR = 0x1503, HCLGE_OPC_ADD_RING_TO_VECTOR = 0x1503,
HCLGE_OPC_DEL_RING_TO_VECTOR = 0x1504, HCLGE_OPC_DEL_RING_TO_VECTOR = 0x1504,
/* MAC command */ /* MAC commands */
HCLGE_OPC_MAC_VLAN_ADD = 0x1000, HCLGE_OPC_MAC_VLAN_ADD = 0x1000,
HCLGE_OPC_MAC_VLAN_REMOVE = 0x1001, HCLGE_OPC_MAC_VLAN_REMOVE = 0x1001,
HCLGE_OPC_MAC_VLAN_TYPE_ID = 0x1002, HCLGE_OPC_MAC_VLAN_TYPE_ID = 0x1002,
...@@ -201,13 +178,13 @@ enum hclge_opcode_type { ...@@ -201,13 +178,13 @@ enum hclge_opcode_type {
HCLGE_OPC_MAC_ETHTYPE_REMOVE = 0x1011, HCLGE_OPC_MAC_ETHTYPE_REMOVE = 0x1011,
HCLGE_OPC_MAC_VLAN_MASK_SET = 0x1012, HCLGE_OPC_MAC_VLAN_MASK_SET = 0x1012,
/* Multicast linear table cmd */ /* Multicast linear table commands */
HCLGE_OPC_MTA_MAC_MODE_CFG = 0x1020, HCLGE_OPC_MTA_MAC_MODE_CFG = 0x1020,
HCLGE_OPC_MTA_MAC_FUNC_CFG = 0x1021, HCLGE_OPC_MTA_MAC_FUNC_CFG = 0x1021,
HCLGE_OPC_MTA_TBL_ITEM_CFG = 0x1022, HCLGE_OPC_MTA_TBL_ITEM_CFG = 0x1022,
HCLGE_OPC_MTA_TBL_ITEM_QUERY = 0x1023, HCLGE_OPC_MTA_TBL_ITEM_QUERY = 0x1023,
/* VLAN command */ /* VLAN commands */
HCLGE_OPC_VLAN_FILTER_CTRL = 0x1100, HCLGE_OPC_VLAN_FILTER_CTRL = 0x1100,
HCLGE_OPC_VLAN_FILTER_PF_CFG = 0x1101, HCLGE_OPC_VLAN_FILTER_PF_CFG = 0x1101,
HCLGE_OPC_VLAN_FILTER_VF_CFG = 0x1102, HCLGE_OPC_VLAN_FILTER_VF_CFG = 0x1102,
...@@ -215,7 +192,7 @@ enum hclge_opcode_type { ...@@ -215,7 +192,7 @@ enum hclge_opcode_type {
/* MDIO command */ /* MDIO command */
HCLGE_OPC_MDIO_CONFIG = 0x1900, HCLGE_OPC_MDIO_CONFIG = 0x1900,
/* QCN command */ /* QCN commands */
HCLGE_OPC_QCN_MOD_CFG = 0x1A01, HCLGE_OPC_QCN_MOD_CFG = 0x1A01,
HCLGE_OPC_QCN_GRP_TMPLT_CFG = 0x1A02, HCLGE_OPC_QCN_GRP_TMPLT_CFG = 0x1A02,
HCLGE_OPC_QCN_SHAPPING_IR_CFG = 0x1A03, HCLGE_OPC_QCN_SHAPPING_IR_CFG = 0x1A03,
...@@ -225,7 +202,7 @@ enum hclge_opcode_type { ...@@ -225,7 +202,7 @@ enum hclge_opcode_type {
HCLGE_OPC_QCN_AJUST_INIT = 0x1A07, HCLGE_OPC_QCN_AJUST_INIT = 0x1A07,
HCLGE_OPC_QCN_DFX_CNT_STATUS = 0x1A08, HCLGE_OPC_QCN_DFX_CNT_STATUS = 0x1A08,
/* Mailbox cmd */ /* Mailbox command */
HCLGEVF_OPC_MBX_PF_TO_VF = 0x2000, HCLGEVF_OPC_MBX_PF_TO_VF = 0x2000,
/* Led command */ /* Led command */
...@@ -382,7 +359,7 @@ struct hclge_pf_res_cmd { ...@@ -382,7 +359,7 @@ struct hclge_pf_res_cmd {
__le16 msixcap_localid_ba_nic; __le16 msixcap_localid_ba_nic;
__le16 msixcap_localid_ba_rocee; __le16 msixcap_localid_ba_rocee;
#define HCLGE_PF_VEC_NUM_S 0 #define HCLGE_PF_VEC_NUM_S 0
#define HCLGE_PF_VEC_NUM_M (0xff << HCLGE_PF_VEC_NUM_S) #define HCLGE_PF_VEC_NUM_M GENMASK(7, 0)
__le16 pf_intr_vector_number; __le16 pf_intr_vector_number;
__le16 pf_own_fun_number; __le16 pf_own_fun_number;
__le32 rsv[3]; __le32 rsv[3];
...@@ -471,8 +448,8 @@ struct hclge_rss_tc_mode_cmd { ...@@ -471,8 +448,8 @@ struct hclge_rss_tc_mode_cmd {
u8 rsv[8]; u8 rsv[8];
}; };
#define HCLGE_LINK_STS_B 0 #define HCLGE_LINK_STATUS_UP_B 0
#define HCLGE_LINK_STATUS BIT(HCLGE_LINK_STS_B) #define HCLGE_LINK_STATUS_UP_M BIT(HCLGE_LINK_STATUS_UP_B)
struct hclge_link_status_cmd { struct hclge_link_status_cmd {
u8 status; u8 status;
u8 rsv[23]; u8 rsv[23];
...@@ -582,13 +559,13 @@ enum hclge_mac_vlan_tbl_opcode { ...@@ -582,13 +559,13 @@ enum hclge_mac_vlan_tbl_opcode {
HCLGE_MAC_VLAN_LKUP, /* Lookup a entry through mac_vlan key */ HCLGE_MAC_VLAN_LKUP, /* Lookup a entry through mac_vlan key */
}; };
#define HCLGE_MAC_VLAN_BIT0_EN_B 0x0 #define HCLGE_MAC_VLAN_BIT0_EN_B 0
#define HCLGE_MAC_VLAN_BIT1_EN_B 0x1 #define HCLGE_MAC_VLAN_BIT1_EN_B 1
#define HCLGE_MAC_EPORT_SW_EN_B 0xc #define HCLGE_MAC_EPORT_SW_EN_B 12
#define HCLGE_MAC_EPORT_TYPE_B 0xb #define HCLGE_MAC_EPORT_TYPE_B 11
#define HCLGE_MAC_EPORT_VFID_S 0x3 #define HCLGE_MAC_EPORT_VFID_S 3
#define HCLGE_MAC_EPORT_VFID_M GENMASK(10, 3) #define HCLGE_MAC_EPORT_VFID_M GENMASK(10, 3)
#define HCLGE_MAC_EPORT_PFID_S 0x0 #define HCLGE_MAC_EPORT_PFID_S 0
#define HCLGE_MAC_EPORT_PFID_M GENMASK(2, 0) #define HCLGE_MAC_EPORT_PFID_M GENMASK(2, 0)
struct hclge_mac_vlan_tbl_entry_cmd { struct hclge_mac_vlan_tbl_entry_cmd {
u8 flags; u8 flags;
...@@ -604,7 +581,7 @@ struct hclge_mac_vlan_tbl_entry_cmd { ...@@ -604,7 +581,7 @@ struct hclge_mac_vlan_tbl_entry_cmd {
u8 rsv2[6]; u8 rsv2[6];
}; };
#define HCLGE_VLAN_MASK_EN_B 0x0 #define HCLGE_VLAN_MASK_EN_B 0
struct hclge_mac_vlan_mask_entry_cmd { struct hclge_mac_vlan_mask_entry_cmd {
u8 rsv0[2]; u8 rsv0[2];
u8 vlan_mask; u8 vlan_mask;
...@@ -635,23 +612,23 @@ struct hclge_mac_mgr_tbl_entry_cmd { ...@@ -635,23 +612,23 @@ struct hclge_mac_mgr_tbl_entry_cmd {
u8 rsv3[2]; u8 rsv3[2];
}; };
#define HCLGE_CFG_MTA_MAC_SEL_S 0x0 #define HCLGE_CFG_MTA_MAC_SEL_S 0
#define HCLGE_CFG_MTA_MAC_SEL_M GENMASK(1, 0) #define HCLGE_CFG_MTA_MAC_SEL_M GENMASK(1, 0)
#define HCLGE_CFG_MTA_MAC_EN_B 0x7 #define HCLGE_CFG_MTA_MAC_EN_B 7
struct hclge_mta_filter_mode_cmd { struct hclge_mta_filter_mode_cmd {
u8 dmac_sel_en; /* Use lowest 2 bit as sel_mode, bit 7 as enable */ u8 dmac_sel_en; /* Use lowest 2 bit as sel_mode, bit 7 as enable */
u8 rsv[23]; u8 rsv[23];
}; };
#define HCLGE_CFG_FUNC_MTA_ACCEPT_B 0x0 #define HCLGE_CFG_FUNC_MTA_ACCEPT_B 0
struct hclge_cfg_func_mta_filter_cmd { struct hclge_cfg_func_mta_filter_cmd {
u8 accept; /* Only used lowest 1 bit */ u8 accept; /* Only used lowest 1 bit */
u8 function_id; u8 function_id;
u8 rsv[22]; u8 rsv[22];
}; };
#define HCLGE_CFG_MTA_ITEM_ACCEPT_B 0x0 #define HCLGE_CFG_MTA_ITEM_ACCEPT_B 0
#define HCLGE_CFG_MTA_ITEM_IDX_S 0x0 #define HCLGE_CFG_MTA_ITEM_IDX_S 0
#define HCLGE_CFG_MTA_ITEM_IDX_M GENMASK(11, 0) #define HCLGE_CFG_MTA_ITEM_IDX_M GENMASK(11, 0)
struct hclge_cfg_func_mta_item_cmd { struct hclge_cfg_func_mta_item_cmd {
__le16 item_idx; /* Only used lowest 12 bit */ __le16 item_idx; /* Only used lowest 12 bit */
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016-2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include "hclge_main.h" #include "hclge_main.h"
#include "hclge_tm.h" #include "hclge_tm.h"
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016~2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __HCLGE_DCB_H__ #ifndef __HCLGE_DCB_H__
#define __HCLGE_DCB_H__ #define __HCLGE_DCB_H__
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016-2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -1108,12 +1102,12 @@ static int hclge_get_cfg(struct hclge_dev *hdev, struct hclge_cfg *hcfg) ...@@ -1108,12 +1102,12 @@ static int hclge_get_cfg(struct hclge_dev *hdev, struct hclge_cfg *hcfg)
ret = hclge_cmd_send(&hdev->hw, desc, HCLGE_PF_CFG_DESC_NUM); ret = hclge_cmd_send(&hdev->hw, desc, HCLGE_PF_CFG_DESC_NUM);
if (ret) { if (ret) {
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev, "get config failed %d.\n", ret);
"get config failed %d.\n", ret);
return ret; return ret;
} }
hclge_parse_cfg(hcfg, desc); hclge_parse_cfg(hcfg, desc);
return 0; return 0;
} }
...@@ -1130,13 +1124,10 @@ static int hclge_get_cap(struct hclge_dev *hdev) ...@@ -1130,13 +1124,10 @@ static int hclge_get_cap(struct hclge_dev *hdev)
/* get pf resource */ /* get pf resource */
ret = hclge_query_pf_resource(hdev); ret = hclge_query_pf_resource(hdev);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev, "query pf resource error %d.\n", ret);
"query pf resource error %d.\n", ret);
return ret;
}
return 0; return ret;
} }
static int hclge_configure(struct hclge_dev *hdev) static int hclge_configure(struct hclge_dev *hdev)
...@@ -1265,13 +1256,10 @@ static int hclge_map_tqps_to_func(struct hclge_dev *hdev, u16 func_id, ...@@ -1265,13 +1256,10 @@ static int hclge_map_tqps_to_func(struct hclge_dev *hdev, u16 func_id,
req->tqp_vid = cpu_to_le16(tqp_vid); req->tqp_vid = cpu_to_le16(tqp_vid);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, "TQP map failed %d.\n", dev_err(&hdev->pdev->dev, "TQP map failed %d.\n", ret);
ret);
return ret;
}
return 0; return ret;
} }
static int hclge_assign_tqp(struct hclge_vport *vport, static int hclge_assign_tqp(struct hclge_vport *vport,
...@@ -1330,12 +1318,10 @@ static int hclge_knic_setup(struct hclge_vport *vport, u16 num_tqps) ...@@ -1330,12 +1318,10 @@ static int hclge_knic_setup(struct hclge_vport *vport, u16 num_tqps)
return -ENOMEM; return -ENOMEM;
ret = hclge_assign_tqp(vport, kinfo->tqp, kinfo->num_tqps); ret = hclge_assign_tqp(vport, kinfo->tqp, kinfo->num_tqps);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, "fail to assign TQPs %d.\n", ret); dev_err(&hdev->pdev->dev, "fail to assign TQPs %d.\n", ret);
return -EINVAL;
}
return 0; return ret;
} }
static int hclge_map_tqp_to_vport(struct hclge_dev *hdev, static int hclge_map_tqp_to_vport(struct hclge_dev *hdev,
...@@ -1487,13 +1473,11 @@ static int hclge_cmd_alloc_tx_buff(struct hclge_dev *hdev, ...@@ -1487,13 +1473,11 @@ static int hclge_cmd_alloc_tx_buff(struct hclge_dev *hdev,
} }
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, "tx buffer alloc cmd failed %d.\n", dev_err(&hdev->pdev->dev, "tx buffer alloc cmd failed %d.\n",
ret); ret);
return ret;
}
return 0; return ret;
} }
static int hclge_tx_buffer_alloc(struct hclge_dev *hdev, static int hclge_tx_buffer_alloc(struct hclge_dev *hdev,
...@@ -1501,13 +1485,10 @@ static int hclge_tx_buffer_alloc(struct hclge_dev *hdev, ...@@ -1501,13 +1485,10 @@ static int hclge_tx_buffer_alloc(struct hclge_dev *hdev,
{ {
int ret = hclge_cmd_alloc_tx_buff(hdev, buf_alloc); int ret = hclge_cmd_alloc_tx_buff(hdev, buf_alloc);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev, "tx buffer alloc failed %d\n", ret);
"tx buffer alloc failed %d\n", ret);
return ret;
}
return 0; return ret;
} }
static int hclge_get_tc_num(struct hclge_dev *hdev) static int hclge_get_tc_num(struct hclge_dev *hdev)
...@@ -1825,13 +1806,11 @@ static int hclge_rx_priv_buf_alloc(struct hclge_dev *hdev, ...@@ -1825,13 +1806,11 @@ static int hclge_rx_priv_buf_alloc(struct hclge_dev *hdev,
(1 << HCLGE_TC0_PRI_BUF_EN_B)); (1 << HCLGE_TC0_PRI_BUF_EN_B));
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"rx private buffer alloc cmd failed %d\n", ret); "rx private buffer alloc cmd failed %d\n", ret);
return ret;
}
return 0; return ret;
} }
static int hclge_rx_priv_wl_config(struct hclge_dev *hdev, static int hclge_rx_priv_wl_config(struct hclge_dev *hdev,
...@@ -1871,13 +1850,11 @@ static int hclge_rx_priv_wl_config(struct hclge_dev *hdev, ...@@ -1871,13 +1850,11 @@ static int hclge_rx_priv_wl_config(struct hclge_dev *hdev,
/* Send 2 descriptor at one time */ /* Send 2 descriptor at one time */
ret = hclge_cmd_send(&hdev->hw, desc, 2); ret = hclge_cmd_send(&hdev->hw, desc, 2);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"rx private waterline config cmd failed %d\n", "rx private waterline config cmd failed %d\n",
ret); ret);
return ret; return ret;
}
return 0;
} }
static int hclge_common_thrd_config(struct hclge_dev *hdev, static int hclge_common_thrd_config(struct hclge_dev *hdev,
...@@ -1917,12 +1894,10 @@ static int hclge_common_thrd_config(struct hclge_dev *hdev, ...@@ -1917,12 +1894,10 @@ static int hclge_common_thrd_config(struct hclge_dev *hdev,
/* Send 2 descriptors at one time */ /* Send 2 descriptors at one time */
ret = hclge_cmd_send(&hdev->hw, desc, 2); ret = hclge_cmd_send(&hdev->hw, desc, 2);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"common threshold config cmd failed %d\n", ret); "common threshold config cmd failed %d\n", ret);
return ret; return ret;
}
return 0;
} }
static int hclge_common_wl_config(struct hclge_dev *hdev, static int hclge_common_wl_config(struct hclge_dev *hdev,
...@@ -1943,13 +1918,11 @@ static int hclge_common_wl_config(struct hclge_dev *hdev, ...@@ -1943,13 +1918,11 @@ static int hclge_common_wl_config(struct hclge_dev *hdev,
req->com_wl.low |= cpu_to_le16(BIT(HCLGE_RX_PRIV_EN_B)); req->com_wl.low |= cpu_to_le16(BIT(HCLGE_RX_PRIV_EN_B));
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"common waterline config cmd failed %d\n", ret); "common waterline config cmd failed %d\n", ret);
return ret;
}
return 0; return ret;
} }
int hclge_buffer_alloc(struct hclge_dev *hdev) int hclge_buffer_alloc(struct hclge_dev *hdev)
...@@ -2196,13 +2169,11 @@ static int hclge_query_mac_an_speed_dup(struct hclge_dev *hdev, int *speed, ...@@ -2196,13 +2169,11 @@ static int hclge_query_mac_an_speed_dup(struct hclge_dev *hdev, int *speed,
HCLGE_QUERY_SPEED_S); HCLGE_QUERY_SPEED_S);
ret = hclge_parse_speed(speed_tmp, speed); ret = hclge_parse_speed(speed_tmp, speed);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"could not parse speed(=%d), %d\n", speed_tmp, ret); "could not parse speed(=%d), %d\n", speed_tmp, ret);
return -EIO;
}
return 0; return ret;
} }
static int hclge_set_autoneg_en(struct hclge_dev *hdev, bool enable) static int hclge_set_autoneg_en(struct hclge_dev *hdev, bool enable)
...@@ -2219,13 +2190,11 @@ static int hclge_set_autoneg_en(struct hclge_dev *hdev, bool enable) ...@@ -2219,13 +2190,11 @@ static int hclge_set_autoneg_en(struct hclge_dev *hdev, bool enable)
req->cfg_an_cmd_flag = cpu_to_le32(flag); req->cfg_an_cmd_flag = cpu_to_le32(flag);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, "auto neg set cmd failed %d.\n", dev_err(&hdev->pdev->dev, "auto neg set cmd failed %d.\n",
ret); ret);
return ret;
}
return 0; return ret;
} }
static int hclge_set_autoneg(struct hnae3_handle *handle, bool enable) static int hclge_set_autoneg(struct hnae3_handle *handle, bool enable)
...@@ -2331,13 +2300,11 @@ static int hclge_mac_init(struct hclge_dev *hdev) ...@@ -2331,13 +2300,11 @@ static int hclge_mac_init(struct hclge_dev *hdev)
mtu = ETH_DATA_LEN; mtu = ETH_DATA_LEN;
ret = hclge_set_mtu(handle, mtu); ret = hclge_set_mtu(handle, mtu);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"set mtu failed ret=%d\n", ret); "set mtu failed ret=%d\n", ret);
return ret;
}
return 0; return ret;
} }
static void hclge_mbx_task_schedule(struct hclge_dev *hdev) static void hclge_mbx_task_schedule(struct hclge_dev *hdev)
...@@ -2376,7 +2343,7 @@ static int hclge_get_mac_link_status(struct hclge_dev *hdev) ...@@ -2376,7 +2343,7 @@ static int hclge_get_mac_link_status(struct hclge_dev *hdev)
} }
req = (struct hclge_link_status_cmd *)desc.data; req = (struct hclge_link_status_cmd *)desc.data;
link_status = req->status & HCLGE_LINK_STATUS; link_status = req->status & HCLGE_LINK_STATUS_UP_M;
return !!link_status; return !!link_status;
} }
...@@ -3121,13 +3088,11 @@ static int hclge_set_rss_tc_mode(struct hclge_dev *hdev, u16 *tc_valid, ...@@ -3121,13 +3088,11 @@ static int hclge_set_rss_tc_mode(struct hclge_dev *hdev, u16 *tc_valid,
} }
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"Configure rss tc mode fail, status = %d\n", ret); "Configure rss tc mode fail, status = %d\n", ret);
return ret;
}
return 0; return ret;
} }
static int hclge_set_rss_input_tuple(struct hclge_dev *hdev) static int hclge_set_rss_input_tuple(struct hclge_dev *hdev)
...@@ -3150,13 +3115,10 @@ static int hclge_set_rss_input_tuple(struct hclge_dev *hdev) ...@@ -3150,13 +3115,10 @@ static int hclge_set_rss_input_tuple(struct hclge_dev *hdev)
req->ipv6_sctp_en = hdev->vport[0].rss_tuple_sets.ipv6_sctp_en; req->ipv6_sctp_en = hdev->vport[0].rss_tuple_sets.ipv6_sctp_en;
req->ipv6_fragment_en = hdev->vport[0].rss_tuple_sets.ipv6_fragment_en; req->ipv6_fragment_en = hdev->vport[0].rss_tuple_sets.ipv6_fragment_en;
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"Configure rss input fail, status = %d\n", ret); "Configure rss input fail, status = %d\n", ret);
return ret; return ret;
}
return 0;
} }
static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir, static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir,
...@@ -3604,12 +3566,11 @@ int hclge_cmd_set_promisc_mode(struct hclge_dev *hdev, ...@@ -3604,12 +3566,11 @@ int hclge_cmd_set_promisc_mode(struct hclge_dev *hdev,
HCLGE_PROMISC_TX_EN_B | HCLGE_PROMISC_RX_EN_B; HCLGE_PROMISC_TX_EN_B | HCLGE_PROMISC_RX_EN_B;
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"Set promisc mode fail, status is %d.\n", ret); "Set promisc mode fail, status is %d.\n", ret);
return ret;
} return ret;
return 0;
} }
void hclge_promisc_param_init(struct hclge_promisc_param *param, bool en_uc, void hclge_promisc_param_init(struct hclge_promisc_param *param, bool en_uc,
...@@ -3960,14 +3921,12 @@ static int hclge_set_mta_filter_mode(struct hclge_dev *hdev, ...@@ -3960,14 +3921,12 @@ static int hclge_set_mta_filter_mode(struct hclge_dev *hdev,
HCLGE_CFG_MTA_MAC_SEL_S, mta_mac_sel); HCLGE_CFG_MTA_MAC_SEL_S, mta_mac_sel);
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"Config mat filter mode failed for cmd_send, ret =%d.\n", "Config mat filter mode failed for cmd_send, ret =%d.\n",
ret); ret);
return ret;
}
return 0; return ret;
} }
int hclge_cfg_func_mta_filter(struct hclge_dev *hdev, int hclge_cfg_func_mta_filter(struct hclge_dev *hdev,
...@@ -3986,14 +3945,12 @@ int hclge_cfg_func_mta_filter(struct hclge_dev *hdev, ...@@ -3986,14 +3945,12 @@ int hclge_cfg_func_mta_filter(struct hclge_dev *hdev,
req->function_id = func_id; req->function_id = func_id;
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"Config func_id enable failed for cmd_send, ret =%d.\n", "Config func_id enable failed for cmd_send, ret =%d.\n",
ret); ret);
return ret;
}
return 0; return ret;
} }
static int hclge_set_mta_table_item(struct hclge_vport *vport, static int hclge_set_mta_table_item(struct hclge_vport *vport,
...@@ -4325,7 +4282,7 @@ static int hclge_add_mc_addr(struct hnae3_handle *handle, ...@@ -4325,7 +4282,7 @@ static int hclge_add_mc_addr(struct hnae3_handle *handle,
{ {
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
return hclge_add_mc_addr_common(vport, addr); return hclge_add_mc_addr_common(vport, addr);
} }
int hclge_add_mc_addr_common(struct hclge_vport *vport, int hclge_add_mc_addr_common(struct hclge_vport *vport,
...@@ -4598,13 +4555,11 @@ static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type, ...@@ -4598,13 +4555,11 @@ static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type,
req->vlan_fe = filter_en; req->vlan_fe = filter_en;
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, "set vlan filter fail, ret =%d.\n", dev_err(&hdev->pdev->dev, "set vlan filter fail, ret =%d.\n",
ret); ret);
return ret;
}
return 0; return ret;
} }
#define HCLGE_FILTER_TYPE_VF 0 #define HCLGE_FILTER_TYPE_VF 0
...@@ -4996,14 +4951,12 @@ static int hclge_set_mac_mtu(struct hclge_dev *hdev, int new_mtu) ...@@ -4996,14 +4951,12 @@ static int hclge_set_mac_mtu(struct hclge_dev *hdev, int new_mtu)
req->min_frm_size = HCLGE_MAC_MIN_FRAME; req->min_frm_size = HCLGE_MAC_MIN_FRAME;
ret = hclge_cmd_send(&hdev->hw, &desc, 1); ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, "set mtu fail, ret =%d.\n", ret); dev_err(&hdev->pdev->dev, "set mtu fail, ret =%d.\n", ret);
return ret; else
} hdev->mps = max_frm_size;
hdev->mps = max_frm_size;
return 0; return ret;
} }
static int hclge_set_mtu(struct hnae3_handle *handle, int new_mtu) static int hclge_set_mtu(struct hnae3_handle *handle, int new_mtu)
...@@ -5595,8 +5548,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) ...@@ -5595,8 +5548,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
hdev->pdev = pdev; hdev->pdev = pdev;
hdev->ae_dev = ae_dev; hdev->ae_dev = ae_dev;
hdev->reset_type = HNAE3_NONE_RESET; hdev->reset_type = HNAE3_NONE_RESET;
hdev->reset_request = 0;
hdev->reset_pending = 0;
ae_dev->priv = hdev; ae_dev->priv = hdev;
ret = hclge_pci_init(hdev); ret = hclge_pci_init(hdev);
...@@ -5909,6 +5860,7 @@ static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num) ...@@ -5909,6 +5860,7 @@ static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num)
u32 *rss_indir; u32 *rss_indir;
int ret, i; int ret, i;
/* Free old tqps, and reallocate with new tqp number when nic setup */
hclge_release_tqp(vport); hclge_release_tqp(vport);
ret = hclge_knic_setup(vport, new_tqps_num); ret = hclge_knic_setup(vport, new_tqps_num);
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016~2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __HCLGE_MAIN_H #ifndef __HCLGE_MAIN_H
#define __HCLGE_MAIN_H #define __HCLGE_MAIN_H
...@@ -40,7 +34,7 @@ ...@@ -40,7 +34,7 @@
#define HCLGE_RSS_HASH_ALGO_TOEPLITZ 0 #define HCLGE_RSS_HASH_ALGO_TOEPLITZ 0
#define HCLGE_RSS_HASH_ALGO_SIMPLE 1 #define HCLGE_RSS_HASH_ALGO_SIMPLE 1
#define HCLGE_RSS_HASH_ALGO_SYMMETRIC 2 #define HCLGE_RSS_HASH_ALGO_SYMMETRIC 2
#define HCLGE_RSS_HASH_ALGO_MASK 0xf #define HCLGE_RSS_HASH_ALGO_MASK GENMASK(3, 0)
#define HCLGE_RSS_CFG_TBL_NUM \ #define HCLGE_RSS_CFG_TBL_NUM \
(HCLGE_RSS_IND_TBL_SIZE / HCLGE_RSS_CFG_TBL_SIZE) (HCLGE_RSS_IND_TBL_SIZE / HCLGE_RSS_CFG_TBL_SIZE)
...@@ -77,11 +71,11 @@ ...@@ -77,11 +71,11 @@
/* Copper Specific Status Register */ /* Copper Specific Status Register */
#define HCLGE_PHY_CSS_REG 17 #define HCLGE_PHY_CSS_REG 17
#define HCLGE_PHY_MDIX_CTRL_S (5) #define HCLGE_PHY_MDIX_CTRL_S 5
#define HCLGE_PHY_MDIX_CTRL_M GENMASK(6, 5) #define HCLGE_PHY_MDIX_CTRL_M GENMASK(6, 5)
#define HCLGE_PHY_MDIX_STATUS_B (6) #define HCLGE_PHY_MDIX_STATUS_B 6
#define HCLGE_PHY_SPEED_DUP_RESOLVE_B (11) #define HCLGE_PHY_SPEED_DUP_RESOLVE_B 11
/* Factor used to calculate offset and bitmap of VF num */ /* Factor used to calculate offset and bitmap of VF num */
#define HCLGE_VF_NUM_PER_CMD 64 #define HCLGE_VF_NUM_PER_CMD 64
...@@ -91,8 +85,8 @@ ...@@ -91,8 +85,8 @@
#define HCLGE_MISC_RESET_STS_REG 0x20700 #define HCLGE_MISC_RESET_STS_REG 0x20700
#define HCLGE_MISC_VECTOR_INT_STS 0x20800 #define HCLGE_MISC_VECTOR_INT_STS 0x20800
#define HCLGE_GLOBAL_RESET_REG 0x20A00 #define HCLGE_GLOBAL_RESET_REG 0x20A00
#define HCLGE_GLOBAL_RESET_BIT 0x0 #define HCLGE_GLOBAL_RESET_BIT 0
#define HCLGE_CORE_RESET_BIT 0x1 #define HCLGE_CORE_RESET_BIT 1
#define HCLGE_FUN_RST_ING 0x20C00 #define HCLGE_FUN_RST_ING 0x20C00
#define HCLGE_FUN_RST_ING_B 0 #define HCLGE_FUN_RST_ING_B 0
...@@ -140,12 +134,6 @@ enum hclge_evt_cause { ...@@ -140,12 +134,6 @@ enum hclge_evt_cause {
}; };
#define HCLGE_MPF_ENBALE 1 #define HCLGE_MPF_ENBALE 1
struct hclge_caps {
u16 num_tqp;
u16 num_buffer_cell;
u32 flag;
u16 vmdq;
};
enum HCLGE_MAC_SPEED { enum HCLGE_MAC_SPEED {
HCLGE_MAC_SPEED_10M = 10, /* 10 Mbps */ HCLGE_MAC_SPEED_10M = 10, /* 10 Mbps */
...@@ -191,7 +179,6 @@ struct hclge_hw { ...@@ -191,7 +179,6 @@ struct hclge_hw {
struct hclge_mac mac; struct hclge_mac mac;
int num_vec; int num_vec;
struct hclge_cmq cmq; struct hclge_cmq cmq;
struct hclge_caps caps;
}; };
/* TQP stats */ /* TQP stats */
...@@ -203,7 +190,10 @@ struct hlcge_tqp_stats { ...@@ -203,7 +190,10 @@ struct hlcge_tqp_stats {
}; };
struct hclge_tqp { struct hclge_tqp {
struct device *dev; /* Device for DMA mapping */ /* copy of device pointer from pci_dev,
* used when perform DMA mapping
*/
struct device *dev;
struct hnae3_queue q; struct hnae3_queue q;
struct hlcge_tqp_stats tqp_stats; struct hlcge_tqp_stats tqp_stats;
u16 index; /* Global index in a NIC controller */ u16 index; /* Global index in a NIC controller */
...@@ -493,13 +483,11 @@ struct hclge_dev { ...@@ -493,13 +483,11 @@ struct hclge_dev {
u16 num_tqps; /* Num task queue pairs of this PF */ u16 num_tqps; /* Num task queue pairs of this PF */
u16 num_req_vfs; /* Num VFs requested for this PF */ u16 num_req_vfs; /* Num VFs requested for this PF */
/* Base task tqp physical id of this PF */ u16 base_tqp_pid; /* Base task tqp physical id of this PF */
u16 base_tqp_pid;
u16 alloc_rss_size; /* Allocated RSS task queue */ u16 alloc_rss_size; /* Allocated RSS task queue */
u16 rss_size_max; /* HW defined max RSS task queue */ u16 rss_size_max; /* HW defined max RSS task queue */
/* Num of guaranteed filters for this PF */ u16 fdir_pf_filter_count; /* Num of guaranteed filters for this PF */
u16 fdir_pf_filter_count;
u16 num_alloc_vport; /* Num vports this driver supports */ u16 num_alloc_vport; /* Num vports this driver supports */
u32 numa_node_mask; u32 numa_node_mask;
u16 rx_buf_len; u16 rx_buf_len;
...@@ -561,7 +549,7 @@ struct hclge_dev { ...@@ -561,7 +549,7 @@ struct hclge_dev {
u32 mps; /* Max packet size */ u32 mps; /* Max packet size */
enum hclge_mta_dmac_sel_type mta_mac_sel_type; enum hclge_mta_dmac_sel_type mta_mac_sel_type;
bool enable_mta; /* Mutilcast filter enable */ bool enable_mta; /* Multicast filter enable */
struct hclge_vlan_type_cfg vlan_type_cfg; struct hclge_vlan_type_cfg vlan_type_cfg;
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016~2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016-2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __HCLGE_MDIO_H #ifndef __HCLGE_MDIO_H
#define __HCLGE_MDIO_H #define __HCLGE_MDIO_H
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016~2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
......
/* // SPDX-License-Identifier: GPL-2.0+
* Copyright (c) 2016~2017 Hisilicon Limited. // Copyright (c) 2016-2017 Hisilicon Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __HCLGE_TM_H #ifndef __HCLGE_TM_H
#define __HCLGE_TM_H #define __HCLGE_TM_H
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册