-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: hns3: create new cmdq hardware description structure hclge_comm_hw
Currently PF and VF cmdq APIs use struct hclge(vf)_hw to describe cmdq hardware information needed by hclge(vf)_cmd_send. There are a little differences between its child struct hclge_cmq_ring and hclgevf_cmq_ring. It is redundent to use two sets of structures to support same functions. So this patch creates new set of common cmdq hardware description structures(hclge_comm_hw) to unify PF and VF cmdq functions. The struct hclge_desc is still kept to avoid too many meaningless replacement. These new structures will be used to unify hclge(vf)_hw structures in PF and VF cmdq APIs in next patches. Signed-off-by: Jie Wang <wangjie125@huawei.com> Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Jie Wang
authored and
David S. Miller
committed
Dec 31, 2021
1 parent
5f20be4
commit 0a7b6d2
Showing
3 changed files
with
57 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* SPDX-License-Identifier: GPL-2.0+ */ | ||
// Copyright (c) 2021-2021 Hisilicon Limited. | ||
|
||
#ifndef __HCLGE_COMM_CMD_H | ||
#define __HCLGE_COMM_CMD_H | ||
#include <linux/types.h> | ||
|
||
#include "hnae3.h" | ||
|
||
#define HCLGE_DESC_DATA_LEN 6 | ||
struct hclge_desc { | ||
__le16 opcode; | ||
__le16 flag; | ||
__le16 retval; | ||
__le16 rsv; | ||
__le32 data[HCLGE_DESC_DATA_LEN]; | ||
}; | ||
|
||
struct hclge_comm_cmq_ring { | ||
dma_addr_t desc_dma_addr; | ||
struct hclge_desc *desc; | ||
struct pci_dev *pdev; | ||
u32 head; | ||
u32 tail; | ||
|
||
u16 buf_size; | ||
u16 desc_num; | ||
int next_to_use; | ||
int next_to_clean; | ||
u8 ring_type; /* cmq ring type */ | ||
spinlock_t lock; /* Command queue lock */ | ||
}; | ||
|
||
enum hclge_comm_cmd_status { | ||
HCLGE_COMM_STATUS_SUCCESS = 0, | ||
HCLGE_COMM_ERR_CSQ_FULL = -1, | ||
HCLGE_COMM_ERR_CSQ_TIMEOUT = -2, | ||
HCLGE_COMM_ERR_CSQ_ERROR = -3, | ||
}; | ||
|
||
struct hclge_comm_cmq { | ||
struct hclge_comm_cmq_ring csq; | ||
struct hclge_comm_cmq_ring crq; | ||
u16 tx_timeout; | ||
enum hclge_comm_cmd_status last_status; | ||
}; | ||
|
||
struct hclge_comm_hw { | ||
void __iomem *io_base; | ||
void __iomem *mem_base; | ||
struct hclge_comm_cmq cmq; | ||
unsigned long comm_state; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters