Skip to content

Commit

Permalink
Merge branch 'cleanup-in-huawei-hinic-driver'
Browse files Browse the repository at this point in the history
Zhengchao Shao says:

====================
cleanup in Huawei hinic driver

Do code cleanup in Huawei hinic driver.
====================

Link: https://lore.kernel.org/r/20220921123358.63442-1-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Sep 23, 2022
2 parents 3f5b606 + c706df6 commit bcff1a3
Show file tree
Hide file tree
Showing 22 changed files with 23 additions and 147 deletions.
1 change: 0 additions & 1 deletion drivers/net/ethernet/huawei/hinic/hinic_debugfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#define TBL_ID_FUNC_CFG_SM_INST 1

#define HINIC_FUNCTION_CONFIGURE_TABLE_SIZE 64
#define HINIC_FUNCTION_CONFIGURE_TABLE 1

struct hinic_cmd_lt_rd {
u8 status;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
#define COALESCE_ALL_QUEUE 0xFFFF
#define COALESCE_MAX_PENDING_LIMIT (255 * COALESCE_PENDING_LIMIT_UNIT)
#define COALESCE_MAX_TIMER_CFG (255 * COALESCE_TIMER_CFG_UNIT)
#define OBJ_STR_MAX_LEN 32

struct hw2ethtool_link_mode {
enum ethtool_link_mode_bit_indices link_mode_bit;
Expand Down
9 changes: 2 additions & 7 deletions drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@
struct hinic_func_to_io, \
cmdqs)

enum cmdq_wqe_type {
WQE_LCMD_TYPE = 0,
WQE_SCMD_TYPE = 1,
};

enum completion_format {
COMPLETE_DIRECT = 0,
COMPLETE_SGE = 1,
Expand Down Expand Up @@ -509,8 +504,8 @@ int hinic_cmdq_direct_resp(struct hinic_cmdqs *cmdqs,
*
* Return 0 - Success, negative - Failure
**/
int hinic_set_arm_bit(struct hinic_cmdqs *cmdqs,
enum hinic_set_arm_qtype q_type, u32 q_id)
static int hinic_set_arm_bit(struct hinic_cmdqs *cmdqs,
enum hinic_set_arm_qtype q_type, u32 q_id)
{
struct hinic_cmdq *cmdq = &cmdqs->cmdq[HINIC_CMDQ_SYNC];
struct hinic_hwif *hwif = cmdqs->hwif;
Expand Down
3 changes: 0 additions & 3 deletions drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ int hinic_cmdq_direct_resp(struct hinic_cmdqs *cmdqs,
enum hinic_mod_type mod, u8 cmd,
struct hinic_cmdq_buf *buf_in, u64 *out_param);

int hinic_set_arm_bit(struct hinic_cmdqs *cmdqs,
enum hinic_set_arm_qtype q_type, u32 q_id);

int hinic_init_cmdqs(struct hinic_cmdqs *cmdqs, struct hinic_hwif *hwif,
void __iomem **db_area);

Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/huawei/hinic/hinic_hw_csr.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
(HINIC_DMA_ATTR_BASE + (idx) * HINIC_DMA_ATTR_STRIDE)

#define HINIC_PPF_ELECTION_STRIDE 0x4
#define HINIC_CSR_MAX_PORTS 4

#define HINIC_CSR_PPF_ELECTION_ADDR(idx) \
(HINIC_ELECTION_BASE + (idx) * HINIC_PPF_ELECTION_STRIDE)
Expand Down
17 changes: 2 additions & 15 deletions drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "hinic_hw_io.h"
#include "hinic_hw_dev.h"

#define IO_STATUS_TIMEOUT 100
#define OUTBOUND_STATE_TIMEOUT 100
#define DB_STATE_TIMEOUT 100

Expand All @@ -42,11 +41,6 @@ enum intr_type {
INTR_MSIX_TYPE,
};

enum io_status {
IO_STOPPED = 0,
IO_RUNNING = 1,
};

/**
* parse_capability - convert device capabilities to NIC capabilities
* @hwdev: the HW device to set and convert device capabilities for
Expand Down Expand Up @@ -837,8 +831,8 @@ static int hinic_l2nic_reset(struct hinic_hwdev *hwdev)
return 0;
}

int hinic_get_interrupt_cfg(struct hinic_hwdev *hwdev,
struct hinic_msix_config *interrupt_info)
static int hinic_get_interrupt_cfg(struct hinic_hwdev *hwdev,
struct hinic_msix_config *interrupt_info)
{
u16 out_size = sizeof(*interrupt_info);
struct hinic_pfhwdev *pfhwdev;
Expand Down Expand Up @@ -1041,13 +1035,6 @@ void hinic_free_hwdev(struct hinic_hwdev *hwdev)
hinic_free_hwif(hwdev->hwif);
}

int hinic_hwdev_max_num_qps(struct hinic_hwdev *hwdev)
{
struct hinic_cap *nic_cap = &hwdev->nic_cap;

return nic_cap->max_qps;
}

/**
* hinic_hwdev_num_qps - return the number QPs available for use
* @hwdev: the NIC HW device
Expand Down
5 changes: 0 additions & 5 deletions drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,6 @@ struct hinic_hwdev *hinic_init_hwdev(struct pci_dev *pdev, struct devlink *devli

void hinic_free_hwdev(struct hinic_hwdev *hwdev);

int hinic_hwdev_max_num_qps(struct hinic_hwdev *hwdev);

int hinic_hwdev_num_qps(struct hinic_hwdev *hwdev);

struct hinic_sq *hinic_hwdev_get_sq(struct hinic_hwdev *hwdev, int i);
Expand All @@ -587,9 +585,6 @@ int hinic_hwdev_hw_ci_addr_set(struct hinic_hwdev *hwdev, struct hinic_sq *sq,
void hinic_hwdev_set_msix_state(struct hinic_hwdev *hwdev, u16 msix_index,
enum hinic_msix_state flag);

int hinic_get_interrupt_cfg(struct hinic_hwdev *hwdev,
struct hinic_msix_config *interrupt_info);

int hinic_set_interrupt_cfg(struct hinic_hwdev *hwdev,
struct hinic_msix_config *interrupt_info);

Expand Down
35 changes: 0 additions & 35 deletions drivers/net/ethernet/huawei/hinic/hinic_hw_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,39 +57,6 @@ int hinic_msix_attr_set(struct hinic_hwif *hwif, u16 msix_index,
return 0;
}

/**
* hinic_msix_attr_get - get message attribute of msix entry
* @hwif: the HW interface of a pci function device
* @msix_index: msix_index
* @pending_limit: the maximum pending interrupt events (unit 8)
* @coalesc_timer: coalesc period for interrupt (unit 8 us)
* @lli_timer: replenishing period for low latency credit (unit 8 us)
* @lli_credit_limit: maximum credits for low latency msix messages (unit 8)
* @resend_timer: maximum wait for resending msix (unit coalesc period)
*
* Return 0 - Success, negative - Failure
**/
int hinic_msix_attr_get(struct hinic_hwif *hwif, u16 msix_index,
u8 *pending_limit, u8 *coalesc_timer,
u8 *lli_timer, u8 *lli_credit_limit,
u8 *resend_timer)
{
u32 addr, val;

if (!VALID_MSIX_IDX(&hwif->attr, msix_index))
return -EINVAL;

addr = HINIC_CSR_MSIX_CTRL_ADDR(msix_index);
val = hinic_hwif_read_reg(hwif, addr);

*pending_limit = HINIC_MSIX_ATTR_GET(val, PENDING_LIMIT);
*coalesc_timer = HINIC_MSIX_ATTR_GET(val, COALESC_TIMER);
*lli_timer = HINIC_MSIX_ATTR_GET(val, LLI_TIMER);
*lli_credit_limit = HINIC_MSIX_ATTR_GET(val, LLI_CREDIT);
*resend_timer = HINIC_MSIX_ATTR_GET(val, RESEND_TIMER);
return 0;
}

/**
* hinic_msix_attr_cnt_clear - clear message attribute counters for msix entry
* @hwif: the HW interface of a pci function device
Expand All @@ -115,8 +82,6 @@ int hinic_msix_attr_cnt_clear(struct hinic_hwif *hwif, u16 msix_index)
* hinic_set_pf_action - set action on pf channel
* @hwif: the HW interface of a pci function device
* @action: action on pf channel
*
* Return 0 - Success, negative - Failure
**/
void hinic_set_pf_action(struct hinic_hwif *hwif, enum hinic_pf_action action)
{
Expand Down
9 changes: 0 additions & 9 deletions drivers/net/ethernet/huawei/hinic/hinic_hw_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@
(((u32)(val) & HINIC_MSIX_##member##_MASK) << \
HINIC_MSIX_##member##_SHIFT)

#define HINIC_MSIX_ATTR_GET(val, member) \
(((val) >> HINIC_MSIX_##member##_SHIFT) & \
HINIC_MSIX_##member##_MASK)

#define HINIC_MSIX_CNT_RESEND_TIMER_SHIFT 29

#define HINIC_MSIX_CNT_RESEND_TIMER_MASK 0x1
Expand Down Expand Up @@ -269,11 +265,6 @@ int hinic_msix_attr_set(struct hinic_hwif *hwif, u16 msix_index,
u8 lli_timer_cfg, u8 lli_credit_limit,
u8 resend_timer);

int hinic_msix_attr_get(struct hinic_hwif *hwif, u16 msix_index,
u8 *pending_limit, u8 *coalesc_timer_cfg,
u8 *lli_timer, u8 *lli_credit_limit,
u8 *resend_timer);

void hinic_set_msix_state(struct hinic_hwif *hwif, u16 msix_idx,
enum hinic_msix_state flag);

Expand Down
9 changes: 2 additions & 7 deletions drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ enum hinic_mbox_tx_status {
#define MBOX_WB_STATUS_MASK 0xFF
#define MBOX_WB_ERROR_CODE_MASK 0xFF00
#define MBOX_WB_STATUS_FINISHED_SUCCESS 0xFF
#define MBOX_WB_STATUS_FINISHED_WITH_ERR 0xFE
#define MBOX_WB_STATUS_NOT_FINISHED 0x00

#define MBOX_STATUS_FINISHED(wb) \
Expand All @@ -130,11 +129,8 @@ enum hinic_mbox_tx_status {
#define SEQ_ID_START_VAL 0
#define SEQ_ID_MAX_VAL 42

#define DST_AEQ_IDX_DEFAULT_VAL 0
#define SRC_AEQ_IDX_DEFAULT_VAL 0
#define NO_DMA_ATTRIBUTE_VAL 0

#define HINIC_MGMT_RSP_AEQN 0
#define HINIC_MBOX_RSP_AEQN 2
#define HINIC_MBOX_RECV_AEQN 0

Expand All @@ -146,7 +142,6 @@ enum hinic_mbox_tx_status {

#define IS_PF_OR_PPF_SRC(src_func_idx) ((src_func_idx) < HINIC_MAX_PF_FUNCS)

#define MBOX_RESPONSE_ERROR 0x1
#define MBOX_MSG_ID_MASK 0xFF
#define MBOX_MSG_ID(func_to_func) ((func_to_func)->send_msg_id)
#define MBOX_MSG_ID_INC(func_to_func_mbox) (MBOX_MSG_ID(func_to_func_mbox) = \
Expand Down Expand Up @@ -621,7 +616,7 @@ static bool check_vf_mbox_random_id(struct hinic_mbox_func_to_func *func_to_func
return false;
}

void hinic_mbox_func_aeqe_handler(void *handle, void *header, u8 size)
static void hinic_mbox_func_aeqe_handler(void *handle, void *header, u8 size)
{
struct hinic_mbox_func_to_func *func_to_func;
u64 mbox_header = *((u64 *)header);
Expand Down Expand Up @@ -649,7 +644,7 @@ void hinic_mbox_func_aeqe_handler(void *handle, void *header, u8 size)
recv_mbox_handler(func_to_func, (u64 *)header, recv_mbox);
}

void hinic_mbox_self_aeqe_handler(void *handle, void *header, u8 size)
static void hinic_mbox_self_aeqe_handler(void *handle, void *header, u8 size)
{
struct hinic_mbox_func_to_func *func_to_func;
struct hinic_send_mbox *send_mbox;
Expand Down
4 changes: 0 additions & 4 deletions drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ void hinic_unregister_pf_mbox_cb(struct hinic_hwdev *hwdev,
void hinic_unregister_vf_mbox_cb(struct hinic_hwdev *hwdev,
enum hinic_mod_type mod);

void hinic_mbox_func_aeqe_handler(void *handle, void *header, u8 size);

void hinic_mbox_self_aeqe_handler(void *handle, void *header, u8 size);

int hinic_func_to_func_init(struct hinic_hwdev *hwdev);

void hinic_func_to_func_free(struct hinic_hwdev *hwdev);
Expand Down
11 changes: 4 additions & 7 deletions drivers/net/ethernet/huawei/hinic/hinic_hw_qp.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,7 @@ int hinic_get_rq_free_wqebbs(struct hinic_rq *rq)
return atomic_read(&wq->delta) - 1;
}

static void sq_prepare_ctrl(struct hinic_sq_ctrl *ctrl, u16 prod_idx,
int nr_descs)
static void sq_prepare_ctrl(struct hinic_sq_ctrl *ctrl, int nr_descs)
{
u32 ctrl_size, task_size, bufdesc_size;

Expand Down Expand Up @@ -588,18 +587,16 @@ void hinic_set_tso_inner_l4(struct hinic_sq_task *task, u32 *queue_info,
/**
* hinic_sq_prepare_wqe - prepare wqe before insert to the queue
* @sq: send queue
* @prod_idx: pi value
* @sq_wqe: wqe to prepare
* @sges: sges for use by the wqe for send for buf addresses
* @nr_sges: number of sges
**/
void hinic_sq_prepare_wqe(struct hinic_sq *sq, u16 prod_idx,
struct hinic_sq_wqe *sq_wqe, struct hinic_sge *sges,
int nr_sges)
void hinic_sq_prepare_wqe(struct hinic_sq *sq, struct hinic_sq_wqe *sq_wqe,
struct hinic_sge *sges, int nr_sges)
{
int i;

sq_prepare_ctrl(&sq_wqe->ctrl, prod_idx, nr_sges);
sq_prepare_ctrl(&sq_wqe->ctrl, nr_sges);

sq_prepare_task(&sq_wqe->task);

Expand Down
5 changes: 2 additions & 3 deletions drivers/net/ethernet/huawei/hinic/hinic_hw_qp.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ void hinic_set_tso_inner_l4(struct hinic_sq_task *task,
u32 l4_len,
u32 offset, u32 ip_ident, u32 mss);

void hinic_sq_prepare_wqe(struct hinic_sq *sq, u16 prod_idx,
struct hinic_sq_wqe *wqe, struct hinic_sge *sges,
int nr_sges);
void hinic_sq_prepare_wqe(struct hinic_sq *sq, struct hinic_sq_wqe *wqe,
struct hinic_sge *sges, int nr_sges);

void hinic_sq_write_db(struct hinic_sq *sq, u16 prod_idx, unsigned int wqe_size,
unsigned int cos);
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ static int cmdq_allocate_page(struct hinic_cmdq_pages *cmdq_pages)
/**
* cmdq_free_page - free page from cmdq
* @cmdq_pages: the pages of the cmdq queue struct that hold the page
*
* Return 0 - Success, negative - Failure
**/
static void cmdq_free_page(struct hinic_cmdq_pages *cmdq_pages)
{
Expand Down
25 changes: 0 additions & 25 deletions drivers/net/ethernet/huawei/hinic/hinic_hw_wqe.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,23 +261,6 @@
#define HINIC_RSS_TYPE_GET(val, member) \
(((u32)(val) >> HINIC_RSS_TYPE_##member##_SHIFT) & 0x1)

enum hinic_l4offload_type {
HINIC_L4_OFF_DISABLE = 0,
HINIC_TCP_OFFLOAD_ENABLE = 1,
HINIC_SCTP_OFFLOAD_ENABLE = 2,
HINIC_UDP_OFFLOAD_ENABLE = 3,
};

enum hinic_vlan_offload {
HINIC_VLAN_OFF_DISABLE = 0,
HINIC_VLAN_OFF_ENABLE = 1,
};

enum hinic_pkt_parsed {
HINIC_PKT_NOT_PARSED = 0,
HINIC_PKT_PARSED = 1,
};

enum hinic_l3_offload_type {
L3TYPE_UNKNOWN = 0,
IPV6_PKT = 1,
Expand Down Expand Up @@ -305,18 +288,10 @@ enum hinic_outer_l3type {
HINIC_OUTER_L3TYPE_IPV4_CHKSUM = 3,
};

enum hinic_media_type {
HINIC_MEDIA_UNKNOWN = 0,
};

enum hinic_l2type {
HINIC_L2TYPE_ETH = 0,
};

enum hinc_tunnel_l4type {
HINIC_TUNNEL_L4TYPE_UNKNOWN = 0,
};

struct hinic_cmdq_header {
u32 header_info;
u32 saved_data;
Expand Down
4 changes: 0 additions & 4 deletions drivers/net/ethernet/huawei/hinic/hinic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,6 @@ static void hinic_refresh_nic_cfg(struct hinic_dev *nic_dev)
* @in_size: input size
* @buf_out: output buffer
* @out_size: returned output size
*
* Return 0 - Success, negative - Failure
**/
static void link_status_event_handler(void *handle, void *buf_in, u16 in_size,
void *buf_out, u16 *out_size)
Expand Down Expand Up @@ -1382,8 +1380,6 @@ static int hinic_probe(struct pci_dev *pdev,
return err;
}

#define HINIC_WAIT_SRIOV_CFG_TIMEOUT 15000

static void wait_sriov_cfg_complete(struct hinic_dev *nic_dev)
{
struct hinic_sriov_info *sriov_info = &nic_dev->sriov_info;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/huawei/hinic/hinic_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* hinic_rxq_clean_stats - Clean the statistics of specific queue
* @rxq: Logical Rx Queue
**/
void hinic_rxq_clean_stats(struct hinic_rxq *rxq)
static void hinic_rxq_clean_stats(struct hinic_rxq *rxq)
{
struct hinic_rxq_stats *rxq_stats = &rxq->rxq_stats;

Expand Down
2 changes: 0 additions & 2 deletions drivers/net/ethernet/huawei/hinic/hinic_rx.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ struct hinic_rxq {
struct napi_struct napi;
};

void hinic_rxq_clean_stats(struct hinic_rxq *rxq);

void hinic_rxq_get_stats(struct hinic_rxq *rxq, struct hinic_rxq_stats *stats);

int hinic_init_rxq(struct hinic_rxq *rxq, struct hinic_rq *rq,
Expand Down
Loading

0 comments on commit bcff1a3

Please sign in to comment.