Skip to content

Commit 6befad6

Browse files
Jie Wangdavem330
authored andcommitted
net: hns3: use struct hclge_desc to replace hclgevf_desc in VF cmdq module
This patch use new common struct hclge_desc to replace struct hclgevf_desc in VF cmdq module and then delete the old struct hclgevf_desc. Signed-off-by: Jie Wang <[email protected]> Signed-off-by: Guangbin Huang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0a7b6d2 commit 6befad6

File tree

4 files changed

+28
-35
lines changed

4 files changed

+28
-35
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static void hclgevf_cmd_init_regs(struct hclgevf_hw *hw)
123123

124124
static int hclgevf_alloc_cmd_desc(struct hclgevf_cmq_ring *ring)
125125
{
126-
int size = ring->desc_num * sizeof(struct hclgevf_desc);
126+
int size = ring->desc_num * sizeof(struct hclge_desc);
127127

128128
ring->desc = dma_alloc_coherent(cmq_ring_to_dev(ring), size,
129129
&ring->desc_dma_addr, GFP_KERNEL);
@@ -135,7 +135,7 @@ static int hclgevf_alloc_cmd_desc(struct hclgevf_cmq_ring *ring)
135135

136136
static void hclgevf_free_cmd_desc(struct hclgevf_cmq_ring *ring)
137137
{
138-
int size = ring->desc_num * sizeof(struct hclgevf_desc);
138+
int size = ring->desc_num * sizeof(struct hclge_desc);
139139

140140
if (ring->desc) {
141141
dma_free_coherent(cmq_ring_to_dev(ring), size,
@@ -163,10 +163,10 @@ static int hclgevf_alloc_cmd_queue(struct hclgevf_dev *hdev, int ring_type)
163163
return ret;
164164
}
165165

166-
void hclgevf_cmd_setup_basic_desc(struct hclgevf_desc *desc,
166+
void hclgevf_cmd_setup_basic_desc(struct hclge_desc *desc,
167167
enum hclgevf_opcode_type opcode, bool is_read)
168168
{
169-
memset(desc, 0, sizeof(struct hclgevf_desc));
169+
memset(desc, 0, sizeof(struct hclge_desc));
170170
desc->opcode = cpu_to_le16(opcode);
171171
desc->flag = cpu_to_le16(HCLGEVF_CMD_FLAG_NO_INTR |
172172
HCLGEVF_CMD_FLAG_IN);
@@ -182,9 +182,9 @@ struct vf_errcode {
182182
};
183183

184184
static void hclgevf_cmd_copy_desc(struct hclgevf_hw *hw,
185-
struct hclgevf_desc *desc, int num)
185+
struct hclge_desc *desc, int num)
186186
{
187-
struct hclgevf_desc *desc_to_use;
187+
struct hclge_desc *desc_to_use;
188188
int handle = 0;
189189

190190
while (handle < num) {
@@ -224,7 +224,7 @@ static int hclgevf_cmd_convert_err_code(u16 desc_ret)
224224
}
225225

226226
static int hclgevf_cmd_check_retval(struct hclgevf_hw *hw,
227-
struct hclgevf_desc *desc, int num, int ntc)
227+
struct hclge_desc *desc, int num, int ntc)
228228
{
229229
u16 opcode, desc_ret;
230230
int handle;
@@ -247,7 +247,7 @@ static int hclgevf_cmd_check_retval(struct hclgevf_hw *hw,
247247
}
248248

249249
static int hclgevf_cmd_check_result(struct hclgevf_hw *hw,
250-
struct hclgevf_desc *desc, int num, int ntc)
250+
struct hclge_desc *desc, int num, int ntc)
251251
{
252252
struct hclgevf_dev *hdev = (struct hclgevf_dev *)hw->hdev;
253253
bool is_completed = false;
@@ -291,7 +291,7 @@ static int hclgevf_cmd_check_result(struct hclgevf_hw *hw,
291291
* This is the main send command for command queue, it
292292
* sends the queue, cleans the queue, etc
293293
*/
294-
int hclgevf_cmd_send(struct hclgevf_hw *hw, struct hclgevf_desc *desc, int num)
294+
int hclgevf_cmd_send(struct hclgevf_hw *hw, struct hclge_desc *desc, int num)
295295
{
296296
struct hclgevf_dev *hdev = (struct hclgevf_dev *)hw->hdev;
297297
struct hclgevf_cmq_ring *csq = &hw->cmq.csq;
@@ -377,7 +377,7 @@ static int hclgevf_cmd_query_version_and_capability(struct hclgevf_dev *hdev)
377377
{
378378
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev);
379379
struct hclgevf_query_version_cmd *resp;
380-
struct hclgevf_desc desc;
380+
struct hclge_desc desc;
381381
int status;
382382

383383
resp = (struct hclgevf_query_version_cmd *)desc.data;
@@ -437,7 +437,7 @@ int hclgevf_cmd_queue_init(struct hclgevf_dev *hdev)
437437
static int hclgevf_firmware_compat_config(struct hclgevf_dev *hdev, bool en)
438438
{
439439
struct hclgevf_firmware_compat_cmd *req;
440-
struct hclgevf_desc desc;
440+
struct hclge_desc desc;
441441
u32 compat = 0;
442442

443443
hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_IMP_COMPAT_CFG, false);

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <linux/io.h>
77
#include <linux/types.h>
88
#include "hnae3.h"
9+
#include "hclge_comm_cmd.h"
910

1011
#define HCLGEVF_CMDQ_TX_TIMEOUT 30000
1112
#define HCLGEVF_CMDQ_CLEAR_WAIT_TIME 200
@@ -21,14 +22,6 @@ struct hclgevf_firmware_compat_cmd {
2122
u8 rsv[20];
2223
};
2324

24-
struct hclgevf_desc {
25-
__le16 opcode;
26-
__le16 flag;
27-
__le16 retval;
28-
__le16 rsv;
29-
__le32 data[6];
30-
};
31-
3225
struct hclgevf_desc_cb {
3326
dma_addr_t dma;
3427
void *va;
@@ -37,7 +30,7 @@ struct hclgevf_desc_cb {
3730

3831
struct hclgevf_cmq_ring {
3932
dma_addr_t desc_dma_addr;
40-
struct hclgevf_desc *desc;
33+
struct hclge_desc *desc;
4134
struct hclgevf_desc_cb *desc_cb;
4235
struct hclgevf_dev *dev;
4336
u32 head;
@@ -335,8 +328,8 @@ int hclgevf_cmd_init(struct hclgevf_dev *hdev);
335328
void hclgevf_cmd_uninit(struct hclgevf_dev *hdev);
336329
int hclgevf_cmd_queue_init(struct hclgevf_dev *hdev);
337330

338-
int hclgevf_cmd_send(struct hclgevf_hw *hw, struct hclgevf_desc *desc, int num);
339-
void hclgevf_cmd_setup_basic_desc(struct hclgevf_desc *desc,
331+
int hclgevf_cmd_send(struct hclgevf_hw *hw, struct hclge_desc *desc, int num);
332+
void hclgevf_cmd_setup_basic_desc(struct hclge_desc *desc,
340333
enum hclgevf_opcode_type opcode,
341334
bool is_read);
342335
#endif

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int hclgevf_tqps_update_stats(struct hnae3_handle *handle)
106106
{
107107
struct hnae3_knic_private_info *kinfo = &handle->kinfo;
108108
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
109-
struct hclgevf_desc desc;
109+
struct hclge_desc desc;
110110
struct hclgevf_tqp *tqp;
111111
int status;
112112
int i;
@@ -611,7 +611,7 @@ static int hclgevf_set_rss_algo_key(struct hclgevf_dev *hdev,
611611
{
612612
struct hclgevf_rss_config_cmd *req;
613613
unsigned int key_offset = 0;
614-
struct hclgevf_desc desc;
614+
struct hclge_desc desc;
615615
int key_counts;
616616
int key_size;
617617
int ret;
@@ -655,7 +655,7 @@ static int hclgevf_set_rss_indir_table(struct hclgevf_dev *hdev)
655655
{
656656
const u8 *indir = hdev->rss_cfg.rss_indirection_tbl;
657657
struct hclgevf_rss_indirection_table_cmd *req;
658-
struct hclgevf_desc desc;
658+
struct hclge_desc desc;
659659
int rss_cfg_tbl_num;
660660
int status;
661661
int i, j;
@@ -692,7 +692,7 @@ static int hclgevf_set_rss_tc_mode(struct hclgevf_dev *hdev, u16 rss_size)
692692
u16 tc_offset[HCLGEVF_MAX_TC_NUM];
693693
u16 tc_valid[HCLGEVF_MAX_TC_NUM];
694694
u16 tc_size[HCLGEVF_MAX_TC_NUM];
695-
struct hclgevf_desc desc;
695+
struct hclge_desc desc;
696696
u16 roundup_size;
697697
unsigned int i;
698698
int status;
@@ -961,7 +961,7 @@ static int hclgevf_set_rss_tuple(struct hnae3_handle *handle,
961961
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
962962
struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg;
963963
struct hclgevf_rss_input_tuple_cmd *req;
964-
struct hclgevf_desc desc;
964+
struct hclge_desc desc;
965965
int ret;
966966

967967
if (hdev->ae_dev->dev_version < HNAE3_DEVICE_VERSION_V2)
@@ -1074,7 +1074,7 @@ static int hclgevf_set_rss_input_tuple(struct hclgevf_dev *hdev,
10741074
struct hclgevf_rss_cfg *rss_cfg)
10751075
{
10761076
struct hclgevf_rss_input_tuple_cmd *req;
1077-
struct hclgevf_desc desc;
1077+
struct hclge_desc desc;
10781078
int ret;
10791079

10801080
hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_RSS_INPUT_TUPLE, false);
@@ -1273,7 +1273,7 @@ static int hclgevf_tqp_enable_cmd_send(struct hclgevf_dev *hdev, u16 tqp_id,
12731273
u16 stream_id, bool enable)
12741274
{
12751275
struct hclgevf_cfg_com_tqp_queue_cmd *req;
1276-
struct hclgevf_desc desc;
1276+
struct hclge_desc desc;
12771277

12781278
req = (struct hclgevf_cfg_com_tqp_queue_cmd *)desc.data;
12791279

@@ -2572,7 +2572,7 @@ static int hclgevf_init_roce_base_info(struct hclgevf_dev *hdev)
25722572
static int hclgevf_config_gro(struct hclgevf_dev *hdev)
25732573
{
25742574
struct hclgevf_cfg_gro_status_cmd *req;
2575-
struct hclgevf_desc desc;
2575+
struct hclge_desc desc;
25762576
int ret;
25772577

25782578
if (!hnae3_dev_gro_supported(hdev))
@@ -3121,7 +3121,7 @@ static void hclgevf_pci_uninit(struct hclgevf_dev *hdev)
31213121
static int hclgevf_query_vf_resource(struct hclgevf_dev *hdev)
31223122
{
31233123
struct hclgevf_query_res_cmd *req;
3124-
struct hclgevf_desc desc;
3124+
struct hclge_desc desc;
31253125
int ret;
31263126

31273127
hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_QUERY_VF_RSRC, true);
@@ -3184,7 +3184,7 @@ static void hclgevf_set_default_dev_specs(struct hclgevf_dev *hdev)
31843184
}
31853185

31863186
static void hclgevf_parse_dev_specs(struct hclgevf_dev *hdev,
3187-
struct hclgevf_desc *desc)
3187+
struct hclge_desc *desc)
31883188
{
31893189
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev);
31903190
struct hclgevf_dev_specs_0_cmd *req0;
@@ -3220,7 +3220,7 @@ static void hclgevf_check_dev_specs(struct hclgevf_dev *hdev)
32203220

32213221
static int hclgevf_query_dev_specs(struct hclgevf_dev *hdev)
32223222
{
3223-
struct hclgevf_desc desc[HCLGEVF_QUERY_DEV_SPECS_BD_NUM];
3223+
struct hclge_desc desc[HCLGEVF_QUERY_DEV_SPECS_BD_NUM];
32243224
int ret;
32253225
int i;
32263226

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev,
9797
u8 *resp_data, u16 resp_len)
9898
{
9999
struct hclge_mbx_vf_to_pf_cmd *req;
100-
struct hclgevf_desc desc;
100+
struct hclge_desc desc;
101101
int status;
102102

103103
req = (struct hclge_mbx_vf_to_pf_cmd *)desc.data;
@@ -213,7 +213,7 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev)
213213
{
214214
struct hclge_mbx_pf_to_vf_cmd *req;
215215
struct hclgevf_cmq_ring *crq;
216-
struct hclgevf_desc *desc;
216+
struct hclge_desc *desc;
217217
u16 flag;
218218

219219
crq = &hdev->hw.cmq.crq;

0 commit comments

Comments
 (0)