From a1d4d5a14d92c0c50418884e3bd132383989b67d Mon Sep 17 00:00:00 2001 From: xiaohuihui-bzwx-kj Date: Sun, 26 May 2024 23:29:46 -0700 Subject: [PATCH] drivers: Fix BUILD REGRESSION warnings in bzwx N5/N6 series NIC drivers bzwx inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9RYOD CVE: NA ------------------------------- fix build regression warnings in bzwx N5/N6 series NIC drivers. Fixes: 08f428070070 ("drivers: add Chengdu BeiZhongWangXin Technology N5/N6 Series Network Card Driver") Signed-off-by: xiaohuihui-bzwx-kj --- .../net/ethernet/bzwx/nce/comm/trace_comm.h | 199 ----------------- drivers/net/ethernet/bzwx/nce/comm/txrx.c | 54 +---- drivers/net/ethernet/bzwx/nce/comm/txrx.h | 2 + .../net/ethernet/bzwx/nce/ne6x/ne6x_arfs.c | 16 +- .../net/ethernet/bzwx/nce/ne6x/ne6x_debugfs.c | 204 ++++-------------- drivers/net/ethernet/bzwx/nce/ne6x/ne6x_dev.c | 68 +----- .../ethernet/bzwx/nce/ne6x/ne6x_interrupt.c | 6 +- .../net/ethernet/bzwx/nce/ne6x/ne6x_main.c | 63 ++---- .../net/ethernet/bzwx/nce/ne6x/ne6x_procfs.c | 2 +- drivers/net/ethernet/bzwx/nce/ne6x/ne6x_reg.c | 75 ++----- .../net/ethernet/bzwx/nce/ne6x/ne6x_trace.h | 28 --- .../net/ethernet/bzwx/nce/ne6x/ne6x_txrx.c | 1 - .../net/ethernet/bzwx/nce/ne6x/ne6x_txrx.h | 1 - .../ethernet/bzwx/nce/ne6x/ne6x_virtchnl_pf.c | 36 ++-- .../ethernet/bzwx/nce/ne6x_vf/ne6x_trace.h | 28 --- .../net/ethernet/bzwx/nce/ne6x_vf/ne6xvf.h | 1 - .../bzwx/nce/ne6x_vf/ne6xvf_debugfs.c | 6 +- .../bzwx/nce/ne6x_vf/ne6xvf_ethtool.c | 1 + .../ethernet/bzwx/nce/ne6x_vf/ne6xvf_main.c | 124 ++--------- .../bzwx/nce/ne6x_vf/ne6xvf_virtchnl.c | 8 +- 20 files changed, 148 insertions(+), 775 deletions(-) delete mode 100644 drivers/net/ethernet/bzwx/nce/comm/trace_comm.h delete mode 100644 drivers/net/ethernet/bzwx/nce/ne6x/ne6x_trace.h delete mode 100644 drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6x_trace.h diff --git a/drivers/net/ethernet/bzwx/nce/comm/trace_comm.h b/drivers/net/ethernet/bzwx/nce/comm/trace_comm.h deleted file mode 100644 index 8fc0e0a1f154..000000000000 --- a/drivers/net/ethernet/bzwx/nce/comm/trace_comm.h +++ /dev/null @@ -1,199 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright(c) 2020 - 2023, Chengdu BeiZhongWangXin Technology Co., Ltd. */ - -#define _NE6X_TRACE_NAME(trace_name) (trace_##ne6x##_##trace_name) -#define NE6X_TRACE_NAME(trace_name) _NE6X_TRACE_NAME(trace_name) - -#define ne6x_trace(trace_name, args...) (NE6X_TRACE_NAME(trace_name) \ -(args)) - -#define ne6x_trace_enabled(trace_name) (NE6X_TRACE_NAME(trace_name##_enabled) \ -()) - -DECLARE_EVENT_CLASS(ne6x_tx_template, - TP_PROTO(struct ne6x_ring *ring, struct sk_buff *skb), - TP_ARGS(ring, skb), - - TP_STRUCT__entry(__field(void *, ring) - __field(u32, len) - __field(u32, head_len) - __dynamic_array(unsigned char, data, skb_headlen(skb)) - __string(devname, ring->netdev->name) - ), - - TP_fast_assign(__entry->ring = ring; - __entry->len = skb->len; - __entry->head_len = skb_headlen(skb); - memcpy(__get_dynamic_array(data), skb->data, - skb_headlen(skb)); - __assign_str(devname, ring->netdev->name); - ), - - TP_printk("netdev: %s ring: %p skb_len: %d skb_headlen:%d skb_head: %s", - __get_str(devname), __entry->ring, __entry->len, - __entry->head_len, __print_array(__get_dynamic_array(data), - __get_dynamic_array_len(data), 1)) - ); - -DEFINE_EVENT(ne6x_tx_template, ne6x_tx_skb, - TP_PROTO(struct ne6x_ring *ring, struct sk_buff *skb), - TP_ARGS(ring, skb) -); - -DEFINE_EVENT(ne6x_tx_template, ne6x_tx_skb_jumbo, - TP_PROTO(struct ne6x_ring *ring, struct sk_buff *skb), - TP_ARGS(ring, skb) -); - -DECLARE_EVENT_CLASS(ne6x_tx_desc_template, - TP_PROTO(struct ne6x_ring *ring, struct ne6x_tx_desc *desc), - TP_ARGS(ring, desc), - - TP_STRUCT__entry(__field(void *, ring) - __field(void *, desc) - __field(u8, vp) - __field(u8, sop_valid) - __field(u8, eop_valid) - __field(u64, sop_cnt) - __field(u64, mop_cnt) - __field(u64, sop_addr) - __field(u64, mop_addr) - __string(devname, ring->netdev->name) - ), - - TP_fast_assign(__entry->ring = ring; - __entry->desc = desc; - __entry->vp = desc->vp; - __entry->sop_valid = desc->sop_valid; - __entry->eop_valid = desc->eop_valid; - __entry->sop_cnt = desc->sop_cnt; - __entry->mop_cnt = desc->mop_cnt; - __entry->sop_addr = desc->buffer_sop_addr; - __entry->mop_addr = desc->buffer_mop_addr; - __assign_str(devname, ring->netdev->name); - ), - - TP_printk("netdev: %s ring: %p desc: %p vp: %d sop_valid:%d eop_valid: %d sop_cnt: %llu mop_cnt: %llu sop_addr: %llu mop_addr: %llu", - __get_str(devname), __entry->ring, __entry->desc, - __entry->vp, __entry->sop_valid, __entry->eop_valid, - __entry->sop_cnt, __entry->mop_cnt, __entry->sop_addr, - __entry->mop_addr) - ); - -DEFINE_EVENT(ne6x_tx_desc_template, ne6x_tx_map_desc, - TP_PROTO(struct ne6x_ring *ring, struct ne6x_tx_desc *desc), - TP_ARGS(ring, desc) -); - -DEFINE_EVENT(ne6x_tx_desc_template, ne6x_tx_map_jumbo_desc, - TP_PROTO(struct ne6x_ring *ring, struct ne6x_tx_desc *desc), - TP_ARGS(ring, desc) -); - -DECLARE_EVENT_CLASS(ne6x_tx_tag_template, - TP_PROTO(struct ne6x_ring *ring, struct ne6x_tx_tag *tx_tag), - TP_ARGS(ring, tx_tag), - - TP_STRUCT__entry(__field(void *, ring) - __field(u8, pi) - __field(u8, vport) - __field(u16, vlan1) - __field(u16, vlan2) - __field(u16, mss) - __field(u16, tag_num) - __string(devname, ring->netdev->name) - ), - - TP_fast_assign(__entry->ring = ring; - __entry->pi = (tx_tag->tag_pi1 << 1) | tx_tag->tag_pi0; - __entry->vport = tx_tag->tag_vport; - __entry->vlan1 = tx_tag->tag_vlan1; - __entry->vlan2 = tx_tag->tag_vlan2; - __entry->mss = tx_tag->tag_mss; - __entry->tag_num = tx_tag->tag_num; - __assign_str(devname, ring->netdev->name); - ), - - TP_printk("netdev: %s ring: %p pi: %d vport: %d vlan1:%d vlan2: %d mss: %d tag_num: %d", - __get_str(devname), __entry->ring, __entry->pi, __entry->vport, - __entry->vlan1, __entry->vlan2, __entry->mss, __entry->tag_num) - ); - -DEFINE_EVENT(ne6x_tx_tag_template, ne6x_tx_map_tag, - TP_PROTO(struct ne6x_ring *ring, struct ne6x_tx_tag *tx_tag), - TP_ARGS(ring, tx_tag) -); - -DEFINE_EVENT(ne6x_tx_tag_template, ne6x_tx_map_jumbo_tag, - TP_PROTO(struct ne6x_ring *ring, struct ne6x_tx_tag *tx_tag), - TP_ARGS(ring, tx_tag) -); - -DECLARE_EVENT_CLASS(ne6x_rx_template, - TP_PROTO(struct ne6x_ring *ring, union ne6x_rx_desc *desc, struct sk_buff *skb), - TP_ARGS(ring, desc, skb), - TP_STRUCT__entry(__field(void *, ring) - __field(void *, desc) - __field(void *, skb) - __string(devname, ring->netdev->name)), - - TP_fast_assign(__entry->ring = ring; - __entry->desc = desc; - __entry->skb = skb; - __assign_str(devname, ring->netdev->name);), - TP_printk("netdev: %s ring: %p desc: %p skb %p", - __get_str(devname), __entry->ring, - __entry->desc, __entry->skb) -); - -DECLARE_EVENT_CLASS(ne6x_rx_head_template, - TP_PROTO(struct ne6x_ring *ring, struct rx_hdr_info *rx_hdr), - TP_ARGS(ring, rx_hdr), - TP_STRUCT__entry(__field(void *, rx_hdr) - __array(u8, headr, 12) - __field(void *, ring) - __string(devname, ring->netdev->name)), - - TP_fast_assign(__entry->ring = ring; - __entry->rx_hdr = rx_hdr; - memcpy(__entry->headr, rx_hdr, 12); - __assign_str(devname, ring->netdev->name);), - TP_printk("netdev: %s rx_hdr: %s", - __get_str(devname), __print_array(__entry->headr, 12, 1)) -); - -DEFINE_EVENT(ne6x_rx_head_template, ne6x_rx_hdr, - TP_PROTO(struct ne6x_ring *ring, struct rx_hdr_info *rx_hdr), - TP_ARGS(ring, rx_hdr) -); - -DEFINE_EVENT(ne6x_rx_template, ne6x_clean_rx_irq, - TP_PROTO(struct ne6x_ring *ring, union ne6x_rx_desc *desc, struct sk_buff *skb), - TP_ARGS(ring, desc, skb) -); - -DEFINE_EVENT(ne6x_rx_template, ne6x_clean_rx_irq_rx, - TP_PROTO(struct ne6x_ring *ring, union ne6x_rx_desc *desc, struct sk_buff *skb), - TP_ARGS(ring, desc, skb) -); - -DECLARE_EVENT_CLASS(ne6x_xmit_template, - TP_PROTO(struct sk_buff *skb, struct ne6x_ring *ring), - TP_ARGS(skb, ring), - TP_STRUCT__entry(__field(void *, skb) - __field(void *, ring) - __string(devname, ring->netdev->name)), - TP_fast_assign(__entry->skb = skb; - __entry->ring = ring; - __assign_str(devname, ring->netdev->name);), - TP_printk("netdev: %s skb: %p ring: %p", - __get_str(devname), __entry->skb, - __entry->ring)); - -DEFINE_EVENT(ne6x_xmit_template, ne6x_xmit_frame_ring, - TP_PROTO(struct sk_buff *skb, struct ne6x_ring *ring), - TP_ARGS(skb, ring)); - -DEFINE_EVENT(ne6x_xmit_template, ne6x_xmit_frame_ring_drop, - TP_PROTO(struct sk_buff *skb, struct ne6x_ring *ring), - TP_ARGS(skb, ring)); diff --git a/drivers/net/ethernet/bzwx/nce/comm/txrx.c b/drivers/net/ethernet/bzwx/nce/comm/txrx.c index e6ae2f689915..b6916809a0ab 100644 --- a/drivers/net/ethernet/bzwx/nce/comm/txrx.c +++ b/drivers/net/ethernet/bzwx/nce/comm/txrx.c @@ -2,7 +2,6 @@ /* Copyright(c) 2020 - 2023, Chengdu BeiZhongWangXin Technology Co., Ltd. */ #include "txrx.h" -#include "ne6x_trace.h" int ne6x_setup_tx_descriptors(struct ne6x_ring *tx_ring) { @@ -147,25 +146,6 @@ int ne6x_setup_tx_sgl(struct ne6x_ring *tx_ring) return -ENOMEM; } -static inline unsigned int ne6x_txd_use_count(unsigned int size) -{ - return ((size * 85) >> 20) + 1; -} - -bool __ne6x_chk_linearize(struct sk_buff *skb); -static inline bool ne6x_chk_linearize(struct sk_buff *skb, int count) -{ - /* Both TSO and single send will work if count is less than 8 */ - if (likely(count < NE6X_MAX_BUFFER_TXD)) - return false; - - if (skb_is_gso(skb)) - return __ne6x_chk_linearize(skb); - - /* we can support up to 8 data buffers for a single send */ - return count != NE6X_MAX_BUFFER_TXD; -} - int __ne6x_maybe_stop_tx(struct ne6x_ring *tx_ring, int size); static inline int ne6x_maybe_stop_tx(struct ne6x_ring *tx_ring, int size) @@ -838,7 +818,6 @@ int ne6x_clean_rx_irq(struct ne6x_ring *rx_ring, int budget) } size = rx_desc->wb.pkt_len; - ne6x_trace(clean_rx_irq, rx_ring, rx_desc, skb); rx_buffer = ne6x_get_rx_buffer(rx_ring, size); /* retrieve a buffer from the ring */ @@ -866,7 +845,6 @@ int ne6x_clean_rx_irq(struct ne6x_ring *rx_ring, int budget) } ne6x_get_rx_head_info(skb, &rx_hdr); - ne6x_trace(rx_hdr, rx_ring, &rx_hdr); pskb_trim(skb, skb->len - 16); /* probably a little skewed due to removing CRC */ total_rx_bytes += skb->len; @@ -874,8 +852,6 @@ int ne6x_clean_rx_irq(struct ne6x_ring *rx_ring, int budget) /* populate checksum, VLAN, and protocol */ ne6x_process_skb_fields(rx_ring, rx_desc, skb, &rx_hdr); - ne6x_trace(clean_rx_irq_rx, rx_ring, rx_desc, skb); - ne6x_receive_skb(rx_ring, skb); skb = NULL; @@ -1144,7 +1120,7 @@ static inline void ne6x_fill_gso_sg(void *p, u16 offset, u16 len, struct ne6x_sg sg->len = len; } -int ne6x_fill_jumbo_sgl(struct ne6x_ring *tx_ring, struct sk_buff *skb) +static int ne6x_fill_jumbo_sgl(struct ne6x_ring *tx_ring, struct sk_buff *skb) { u16 sg_max_dlen = 0, dlen = 0, len = 0, offset = 0, send_dlen = 0, total_dlen = 0; u16 subframe = 0, send_subframe = 0, sg_avail = 0, i = 0, j = 0; @@ -1244,8 +1220,8 @@ int ne6x_fill_jumbo_sgl(struct ne6x_ring *tx_ring, struct sk_buff *skb) return -1; } -void ne6x_fill_tx_desc(struct ne6x_tx_desc *tx_desc, u8 vp, dma_addr_t tag_dma, - dma_addr_t dma, struct ne6x_sg_info *sg) +static void ne6x_fill_tx_desc(struct ne6x_tx_desc *tx_desc, u8 vp, dma_addr_t tag_dma, + dma_addr_t dma, struct ne6x_sg_info *sg) { memset(tx_desc, 0, NE6X_TX_DESC_SIZE); tx_desc->buffer_mop_addr = cpu_to_le64(dma); @@ -1263,8 +1239,8 @@ void ne6x_fill_tx_desc(struct ne6x_tx_desc *tx_desc, u8 vp, dma_addr_t tag_dma, } } -void ne6x_fill_tx_priv_tag(struct ne6x_ring *tx_ring, struct ne6x_tx_tag *tx_tag, - int mss, struct ne6x_sg_info *sg) +static void ne6x_fill_tx_priv_tag(struct ne6x_ring *tx_ring, struct ne6x_tx_tag *tx_tag, + int mss, struct ne6x_sg_info *sg) { struct ne6x_adapt_comm *comm = (struct ne6x_adapt_comm *)tx_ring->adpt; @@ -1278,8 +1254,8 @@ void ne6x_fill_tx_priv_tag(struct ne6x_ring *tx_ring, struct ne6x_tx_tag *tx_tag tx_tag->tag_num = cpu_to_be16(tx_tag->tag_num); } -void ne6x_xmit_jumbo(struct ne6x_ring *tx_ring, struct ne6x_tx_buf *first, - struct ne6x_ring *tag_ring, struct ne6x_tx_tag *tx_tag) +static void ne6x_xmit_jumbo(struct ne6x_ring *tx_ring, struct ne6x_tx_buf *first, + struct ne6x_ring *tag_ring, struct ne6x_tx_tag *tx_tag) { int j = 0; struct ne6x_sg_list *sgl = tx_ring->sgl; @@ -1314,7 +1290,6 @@ void ne6x_xmit_jumbo(struct ne6x_ring *tx_ring, struct ne6x_tx_buf *first, tag_dma = tag_ring->dma + tag_ring->next_to_use * NE6X_TX_PRIV_TAG_SIZE; tag_desc = NE6X_TX_TAG(tag_ring, tag_ring->next_to_use); ne6x_fill_tx_priv_tag(tx_ring, tag_desc, sgl->mss, sg); - ne6x_trace(tx_map_jumbo_tag, tx_ring, tag_desc); if (++tag_ring->next_to_use == tag_ring->count) tag_ring->next_to_use = 0; } else { @@ -1323,7 +1298,6 @@ void ne6x_xmit_jumbo(struct ne6x_ring *tx_ring, struct ne6x_tx_buf *first, tx_desc = NE6X_TX_DESC(tx_ring, i); ne6x_fill_tx_desc(tx_desc, tx_ring->reg_idx, tag_dma, dma, sg); - ne6x_trace(tx_map_jumbo_desc, tx_ring, tx_desc); if (++i == tx_ring->count) i = 0; } @@ -1370,12 +1344,12 @@ void ne6x_xmit_jumbo(struct ne6x_ring *tx_ring, struct ne6x_tx_buf *first, tx_ring->next_to_use = i; } -void ne6x_xmit_simple(struct ne6x_ring *tx_ring, struct ne6x_tx_buf *first, - struct ne6x_ring *tag_ring, struct ne6x_tx_tag *tx_tag) +static void ne6x_xmit_simple(struct ne6x_ring *tx_ring, struct ne6x_tx_buf *first, + struct ne6x_ring *tag_ring, struct ne6x_tx_tag *tx_tag) { struct sk_buff *skb = first->skb; struct ne6x_adapt_comm *comm = (struct ne6x_adapt_comm *)tx_ring->adpt; - struct ne6x_tx_desc *tx_desc, *first_desc; + struct ne6x_tx_desc *tx_desc; unsigned int size = skb_headlen(skb); u32 i = tx_ring->next_to_use; struct ne6x_tx_tag *ttx_desc; @@ -1384,13 +1358,10 @@ void ne6x_xmit_simple(struct ne6x_ring *tx_ring, struct ne6x_tx_buf *first, int send_len = 0; skb_frag_t *frag; dma_addr_t dma; - __le64 mss = 0; dma = dma_map_single(tx_ring->dev, skb->data, size, DMA_TO_DEVICE); - first_desc = NE6X_TX_DESC(tx_ring, i); tx_desc = NE6X_TX_DESC(tx_ring, i); - mss = tx_desc->mss; tx_desc->sop_valid = 1; tx_desc->eop_valid = 0; tx_bi = first; @@ -1432,7 +1403,7 @@ void ne6x_xmit_simple(struct ne6x_ring *tx_ring, struct ne6x_tx_buf *first, tx_desc->eop_valid = 1u; break; } - ne6x_trace(tx_map_desc, tx_ring, tx_desc); + if (++i == tx_ring->count) i = 0; @@ -1507,8 +1478,6 @@ netdev_tx_t ne6x_xmit_frame_ring(struct sk_buff *skb, struct ne6x_ring *tx_ring, prefetch(tx_tagx); prefetch(skb->data); - ne6x_trace(xmit_frame_ring, skb, tx_ring); - if (!jumbo_frame) { count = ne6x_xmit_descriptor_count(skb); } else { @@ -1559,7 +1528,6 @@ netdev_tx_t ne6x_xmit_frame_ring(struct sk_buff *skb, struct ne6x_ring *tx_ring, return NETDEV_TX_OK; out_drop: - ne6x_trace(xmit_frame_ring_drop, first->skb, tx_ring); ne6x_unmap_and_free_tx_resource(tx_ring, first); return NETDEV_TX_OK; diff --git a/drivers/net/ethernet/bzwx/nce/comm/txrx.h b/drivers/net/ethernet/bzwx/nce/comm/txrx.h index 8b35bc385aa5..17f6db9b93b3 100644 --- a/drivers/net/ethernet/bzwx/nce/comm/txrx.h +++ b/drivers/net/ethernet/bzwx/nce/comm/txrx.h @@ -472,5 +472,7 @@ int ne6x_setup_rx_descriptors(struct ne6x_ring *rx_ring); int ne6x_setup_cq_descriptors(struct ne6x_ring *cq_ring); int ne6x_setup_tg_descriptors(struct ne6x_ring *tg_ring); int ne6x_setup_tx_sgl(struct ne6x_ring *tx_ring); +bool ne6x_alloc_rx_buffers(struct ne6x_ring *rx_ring, u16 cleaned_count); +void ne6x_unmap_and_free_tx_resource(struct ne6x_ring *ring, struct ne6x_tx_buf *tx_buffer); #endif diff --git a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_arfs.c b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_arfs.c index fe2fd42ffdda..00fb5925df7b 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_arfs.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_arfs.c @@ -14,7 +14,8 @@ static void ne6x_arfs_update_active_fltr_cntrs(struct ne6x_adapter *adpt, struct ne6x_arfs_entry *entry, bool add); -int ne6x_dev_add_fster_rules(struct ne6x_adapter *adpt, struct ne6x_fster_fltr *input, bool is_tun) +static int ne6x_dev_add_fster_rules(struct ne6x_adapter *adpt, struct ne6x_fster_fltr *input, + bool is_tun) { u32 table_id = 0xffffffff; struct ne6x_fster_table fster; @@ -24,7 +25,7 @@ int ne6x_dev_add_fster_rules(struct ne6x_adapter *adpt, struct ne6x_fster_fltr * struct device *dev; dev = ne6x_pf_to_dev(adpt->back); - dev_info(dev, "add: vport: %d %x %x %x %x %d %d rxq_id:%d\n", adpt->vport, + dev_info(dev, "add: vport: %d %x %x %x %x %d %d rxq_id: %d\n", adpt->vport, input->ip.v4.dst_ip, input->ip.v4.src_ip, input->ip.v4.dst_port, input->ip.v4.src_port, input->ip.v4.pi, input->ip.v4.proto, input->q_index); @@ -58,7 +59,8 @@ int ne6x_dev_add_fster_rules(struct ne6x_adapter *adpt, struct ne6x_fster_fltr * return 0; } -int ne6x_dev_del_fster_rules(struct ne6x_adapter *adpt, struct ne6x_fster_fltr *input, bool is_tun) +static int ne6x_dev_del_fster_rules(struct ne6x_adapter *adpt, struct ne6x_fster_fltr *input, + bool is_tun) { struct ne6x_fster_table fster; struct ne6x_fster_search_result result; @@ -67,7 +69,7 @@ int ne6x_dev_del_fster_rules(struct ne6x_adapter *adpt, struct ne6x_fster_fltr * struct device *dev; dev = ne6x_pf_to_dev(adpt->back); - dev_info(dev, "del: vport: %d %x %x %x %x %d %d rxq_id:%d\n", + dev_info(dev, "del: vport: %d %x %x %x %x %d %d rxq_id: %d\n", adpt->vport, input->ip.v4.dst_ip, input->ip.v4.src_ip, input->ip.v4.dst_port, input->ip.v4.src_port, input->ip.v4.pi, input->ip.v4.proto, input->q_index); @@ -163,7 +165,7 @@ ne6x_arfs_update_flow_rules(struct ne6x_adapter *adpt, u16 idx, } } -int ne6x_arfs_add_flow_rules(struct ne6x_adapter *adpt, struct hlist_head *add_list_head) +static int ne6x_arfs_add_flow_rules(struct ne6x_adapter *adpt, struct hlist_head *add_list_head) { struct ne6x_arfs_entry_ptr *ep; struct hlist_node *n; @@ -191,7 +193,7 @@ int ne6x_arfs_add_flow_rules(struct ne6x_adapter *adpt, struct hlist_head *add_l return 0; } -int ne6x_arfs_del_flow_rules(struct ne6x_adapter *adpt, struct hlist_head *del_list_head) +static int ne6x_arfs_del_flow_rules(struct ne6x_adapter *adpt, struct hlist_head *del_list_head) { struct ne6x_arfs_entry *e; struct hlist_node *n; @@ -394,7 +396,7 @@ void ne6x_free_cpu_rx_rmap(struct ne6x_adapter *adpt) netdev->rx_cpu_rmap = NULL; } -int ne6x_get_irq_num(struct ne6x_pf *pf, int idx) +static int ne6x_get_irq_num(struct ne6x_pf *pf, int idx) { if (!pf->msix_entries) return -EINVAL; diff --git a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_debugfs.c b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_debugfs.c index b945381ee8e8..db14c3f5e915 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_debugfs.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_debugfs.c @@ -67,7 +67,7 @@ const struct ne6x_debug_info ne6x_device_info[] = { {0x1A21, "N6S100P2-PAGA", "100G"}, {0x1A2D, "N6S100P2-NAGA", "100G"}, {0x0221, "N6S100P2-NAGA", "100G"}, {0x0A21, "N6S100P2-PDGA", "100G"} }; -char *my_strtok(char *p_in_string, char *p_in_delimit, char **pp_out_ret) +static char *my_strtok(char *p_in_string, char *p_in_delimit, char **pp_out_ret) { static char *p_tmp; char *p_strstr = NULL; @@ -102,7 +102,7 @@ char *my_strtok(char *p_in_string, char *p_in_delimit, char **pp_out_ret) return ret; } -int my_isdigit(char in_char) +static int my_isdigit(char in_char) { if ((in_char >= '0') && (in_char <= '9')) return 1; @@ -110,7 +110,7 @@ int my_isdigit(char in_char) return 0; } -int my_atoi(char *p_in_string) +static int my_atoi(char *p_in_string) { int flag = 1; int ret = 0; @@ -139,7 +139,7 @@ int my_atoi(char *p_in_string) static struct dentry *ne6x_dbg_root; u8 *ne6x_dbg_get_fru_product_part(u8 *buffer, enum fru_product_part part, u8 *len); -void ne6x_dbg_show_queue(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_show_queue(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_ring *ring; struct ne6x_adapter *adpt; @@ -231,7 +231,7 @@ void ne6x_dbg_show_queue(struct ne6x_pf *pf, char *cmd_buf, int count) } } -void ne6x_dbg_show_ring(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_show_ring(struct ne6x_pf *pf, char *cmd_buf, int count) { int i, j, k, l; union ne6x_rx_desc *rx_desc; @@ -311,7 +311,7 @@ void ne6x_dbg_show_ring(struct ne6x_pf *pf, char *cmd_buf, int count) } } -void ne6x_dbg_show_txtail(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_show_txtail(struct ne6x_pf *pf, char *cmd_buf, int count) { int i, j; struct ne6x_adapter *adpt; @@ -335,7 +335,7 @@ void ne6x_dbg_show_txtail(struct ne6x_pf *pf, char *cmd_buf, int count) } } -void ne6x_dbg_show_txq(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_show_txq(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_ring *ring; struct ne6x_adapter *adpt; @@ -360,7 +360,7 @@ void ne6x_dbg_show_txq(struct ne6x_pf *pf, char *cmd_buf, int count) } } -void ne6x_dbg_show_rxq(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_show_rxq(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_ring *ring; struct ne6x_adapter *adpt; @@ -385,7 +385,7 @@ void ne6x_dbg_show_rxq(struct ne6x_pf *pf, char *cmd_buf, int count) } } -void ne6x_dbg_show_cq(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_show_cq(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_ring *ring; struct ne6x_adapter *adpt; @@ -410,7 +410,7 @@ void ne6x_dbg_show_cq(struct ne6x_pf *pf, char *cmd_buf, int count) } } -void ne6x_dbg_clean_queue(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_clean_queue(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_ring *tx_ring; struct ne6x_ring *rx_ring; @@ -445,7 +445,7 @@ void ne6x_dbg_clean_queue(struct ne6x_pf *pf, char *cmd_buf, int count) } } -void ne6x_dbg_show_txring(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_show_txring(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_ring *tx_ring; struct ne6x_adapter *adpt; @@ -493,7 +493,7 @@ void ne6x_dbg_show_txring(struct ne6x_pf *pf, char *cmd_buf, int count) dev_info(&pf->pdev->dev, "\n"); } -void ne6x_dbg_show_rxring(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_show_rxring(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_ring *rx_ring; struct ne6x_adapter *adpt; @@ -541,7 +541,7 @@ void ne6x_dbg_show_rxring(struct ne6x_pf *pf, char *cmd_buf, int count) dev_info(&pf->pdev->dev, "\n"); } -void ne6x_dbg_show_cqring(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_show_cqring(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_ring *cq_ring; struct ne6x_adapter *adpt; @@ -584,7 +584,7 @@ void ne6x_dbg_show_cqring(struct ne6x_pf *pf, char *cmd_buf, int count) dev_info(&pf->pdev->dev, "\n"); } -void ne6x_dbg_show_txdesc_states(int adpt_num, int queue_num, struct ne6x_pf *pf) +static void ne6x_dbg_show_txdesc_states(int adpt_num, int queue_num, struct ne6x_pf *pf) { struct ne6x_tx_desc *tx_desc = NULL; struct ne6x_ring *tx_ring = NULL; @@ -651,7 +651,7 @@ void ne6x_dbg_show_txdesc_states(int adpt_num, int queue_num, struct ne6x_pf *pf dev_info(&pf->pdev->dev, "\n"); } -void ne6x_dbg_show_rxdesc_states(int adpt_num, int queue_num, struct ne6x_pf *pf) +static void ne6x_dbg_show_rxdesc_states(int adpt_num, int queue_num, struct ne6x_pf *pf) { union ne6x_rx_desc *rx_desc = NULL; struct ne6x_ring *rx_ring = NULL; @@ -698,7 +698,7 @@ void ne6x_dbg_show_rxdesc_states(int adpt_num, int queue_num, struct ne6x_pf *pf dev_info(&pf->pdev->dev, "\n"); } -void ne6x_dbg_show_cqdesc_states(int adpt_num, int queue_num, struct ne6x_pf *pf) +static void ne6x_dbg_show_cqdesc_states(int adpt_num, int queue_num, struct ne6x_pf *pf) { struct ne6x_cq_desc *cq_desc = NULL; struct ne6x_ring *cq_ring = NULL; @@ -754,7 +754,7 @@ void ne6x_dbg_show_cqdesc_states(int adpt_num, int queue_num, struct ne6x_pf *pf } #ifdef CONFIG_RFS_ACCEL -void ne6x_dbg_show_arfs_cnt(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_show_arfs_cnt(struct ne6x_pf *pf, char *cmd_buf, int count) { u8 idx = 0; struct ne6x_adapter *pf_adpt; @@ -780,7 +780,7 @@ void ne6x_dbg_show_arfs_cnt(struct ne6x_pf *pf, char *cmd_buf, int count) extern u32 ne6x_dev_crc32(const u8 *buf, u32 size); -void ne6x_dbg_apb_read(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_apb_read(struct ne6x_pf *pf, char *cmd_buf, int count) { u64 offset; u32 value; @@ -798,7 +798,7 @@ void ne6x_dbg_apb_read(struct ne6x_pf *pf, char *cmd_buf, int count) dev_info(&pf->pdev->dev, "offset = 0x%08X 0x%08X\n", addr, value); } -void ne6x_dbg_apb_write(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_apb_write(struct ne6x_pf *pf, char *cmd_buf, int count) { u64 offset; u32 value; @@ -816,7 +816,7 @@ void ne6x_dbg_apb_write(struct ne6x_pf *pf, char *cmd_buf, int count) dev_info(&pf->pdev->dev, "apb_write: 0x%llx = 0x%x\n", offset, value); } -void ne6x_dbg_mem_read(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_mem_read(struct ne6x_pf *pf, char *cmd_buf, int count) { int index = 0, cnt; u32 *reg_data; @@ -855,9 +855,7 @@ void ne6x_dbg_mem_read(struct ne6x_pf *pf, char *cmd_buf, int count) kfree((void *)reg_data); } -void ne6x_dbg_mem_write(struct ne6x_pf *pf, char *cmd_buf, int count) {} - -void ne6x_dbg_templ_help(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_templ_help(struct ne6x_pf *pf, char *cmd_buf, int count) { dev_info(&pf->pdev->dev, "HW_FEATURES = 0\n"); dev_info(&pf->pdev->dev, "HW_FLAGS = 1\n"); @@ -877,7 +875,7 @@ void ne6x_dbg_templ_help(struct ne6x_pf *pf, char *cmd_buf, int count) dev_info(&pf->pdev->dev, "CQ_SIZE = 229\n"); } -void ne6x_dbg_templ_read(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_templ_read(struct ne6x_pf *pf, char *cmd_buf, int count) { u32 vport; u32 value; @@ -894,7 +892,7 @@ void ne6x_dbg_templ_read(struct ne6x_pf *pf, char *cmd_buf, int count) dev_info(&pf->pdev->dev, "temp_read 0x%04X value 0x%08X\n", type, value); } -void ne6x_dbg_templ_write(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_templ_write(struct ne6x_pf *pf, char *cmd_buf, int count) { u32 vport; u32 value; @@ -911,7 +909,7 @@ void ne6x_dbg_templ_write(struct ne6x_pf *pf, char *cmd_buf, int count) dev_info(&pf->pdev->dev, "temp_write: 0x%04x = 0x%x\n", type, value); } -void ne6x_dbg_soc_read(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_soc_read(struct ne6x_pf *pf, char *cmd_buf, int count) { u32 value; u32 addr; @@ -927,7 +925,7 @@ void ne6x_dbg_soc_read(struct ne6x_pf *pf, char *cmd_buf, int count) dev_info(&pf->pdev->dev, "offset = 0x%08X 0x%08X\n", addr, value); } -void ne6x_dbg_soc_write(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_soc_write(struct ne6x_pf *pf, char *cmd_buf, int count) { u32 value; u32 addr; @@ -943,7 +941,7 @@ void ne6x_dbg_soc_write(struct ne6x_pf *pf, char *cmd_buf, int count) dev_info(&pf->pdev->dev, "soc_write: 0x%08X = 0x%08X\n", addr, value); } -void ne6x_dbg_tab_read(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_tab_read(struct ne6x_pf *pf, char *cmd_buf, int count) { int array_index = 0, ret, index; struct ne6x_debug_table *table_info; @@ -1007,7 +1005,7 @@ void ne6x_dbg_tab_read(struct ne6x_pf *pf, char *cmd_buf, int count) kfree(table_info); } -void ne6x_dbg_set_mac_to_eeprom(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_set_mac_to_eeprom(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_dev_eeprom_info *psdk_spd_info = &pf->sdk_spd_info; u8 mac_addr[6]; @@ -1051,7 +1049,7 @@ void ne6x_dbg_set_mac_to_eeprom(struct ne6x_pf *pf, char *cmd_buf, int count) (ret == 0) ? "set mac success!" : "set mac fail!"); } -void ne6x_dbg_get_mac(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_get_mac(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_dev_eeprom_info *psdk_spd_info = &pf->sdk_spd_info; u8 mac_addr[6]; @@ -1082,67 +1080,7 @@ void ne6x_dbg_get_mac(struct ne6x_pf *pf, char *cmd_buf, int count) mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); } -void ne6x_dbg_set_dev_type_to_eeprom(struct ne6x_pf *pf, char *cmd_buf, int count) -{ - struct ne6x_dev_eeprom_info *psdk_spd_info = &pf->sdk_spd_info; - u8 *p_str_array[10] = {0}; - int array_index = 0, ret; - u8 *p_in_string = NULL; - char *p_tmp_ret = NULL; - u16 dev_type = 0; - - p_in_string = &cmd_buf[0]; - while ((p_str_array[array_index] = my_strtok(p_in_string, PARA_KEY_STRING, &p_tmp_ret)) != - NULL) { - p_in_string = p_str_array[array_index] + strlen(p_str_array[array_index]) + 1; - array_index++; - if (array_index >= 10) - break; - - if (!p_tmp_ret) - break; - } - - if (array_index < 1) { - dev_warn(&pf->pdev->dev, "set_dev_type (0xA003:2*25,0xA004:4*25)\n"); - return; - } - - if (!strncmp(p_str_array[0], "0x", 2)) { - dev_type = simple_strtoul(p_str_array[0], NULL, 16); - } else { - dev_warn(&pf->pdev->dev, "set_dev_type (0xA003:2*25,0xA004:4*25)\n"); - return; - } - - if (dev_type != NE6000AI_2S_X16H_25G_N5 && dev_type != NE6000AI_2S_X16H_25G_N6) { - dev_warn(&pf->pdev->dev, "set_dev_type (0xA003:2*25,0xA004:4*25)\n"); - return; - } - - psdk_spd_info->product_mode = cpu_to_be16(dev_type); - psdk_spd_info->is_pcie_exist = 0x1; - - if (dev_type == NE6000AI_2S_X16H_25G_N5) { - psdk_spd_info->number_of_physical_controllers = 2; - psdk_spd_info->logic_port_to_phyical = cpu_to_be32(0x00000800); - } else if (dev_type == NE6000AI_2S_X16H_25G_N6) { - psdk_spd_info->number_of_physical_controllers = 2; - psdk_spd_info->logic_port_to_phyical = cpu_to_be32(0x00000100); - } else { - return; - } - - psdk_spd_info->spd_verify_value = - cpu_to_be32(ne6x_dev_crc32((const u8 *)psdk_spd_info, - sizeof(struct ne6x_dev_eeprom_info) - 4)); - ret = ne6x_dev_write_eeprom(pf->adpt[0], 0x0, (u8 *)psdk_spd_info, - sizeof(struct ne6x_dev_eeprom_info)); - dev_info(&pf->pdev->dev, "%s: %s\n", __func__, - (ret == 0) ? "write eeprom mac success!" : "write eeprom mac fail!"); -} - -void ne6x_dbg_tab_write(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_tab_write(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_debug_table *table_info; int array_index = 0, ret, index; @@ -1202,7 +1140,7 @@ void ne6x_dbg_tab_write(struct ne6x_pf *pf, char *cmd_buf, int count) dev_info(&pf->pdev->dev, "%s: %s\n", __func__, (ret == 0) ? "success!" : "timeout!"); } -void ne6x_dbg_tab_insert(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_tab_insert(struct ne6x_pf *pf, char *cmd_buf, int count) { u8 *p_str_array[ARRAY_P_MAX_COUNT] = {0}; struct ne6x_debug_table *table_info; @@ -1272,7 +1210,7 @@ void ne6x_dbg_tab_insert(struct ne6x_pf *pf, char *cmd_buf, int count) ((ret != -ETIMEDOUT) ? "fail!" : "timeout!")); } -void ne6x_dbg_tab_delete(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_tab_delete(struct ne6x_pf *pf, char *cmd_buf, int count) { int array_index = 0, ret, index; struct ne6x_debug_table *table_info; @@ -1326,7 +1264,7 @@ void ne6x_dbg_tab_delete(struct ne6x_pf *pf, char *cmd_buf, int count) dev_info(&pf->pdev->dev, "%s: %s\n", __func__, (ret == 0) ? "success!" : "timeout!"); } -void ne6x_dbg_tab_search(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_tab_search(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_debug_table *table_info; int array_index = 0, ret, index; @@ -1398,7 +1336,7 @@ void ne6x_dbg_tab_search(struct ne6x_pf *pf, char *cmd_buf, int count) kfree(table_info); } -void ne6x_dbg_get_fru_info(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_get_fru_info(struct ne6x_pf *pf, char *cmd_buf, int count) { struct file *fp = NULL; u8 *buffer; @@ -1429,64 +1367,7 @@ void ne6x_dbg_get_fru_info(struct ne6x_pf *pf, char *cmd_buf, int count) filp_close(fp, NULL); } -u32 getparam(char *cmd_buf, u32 *param, int max_cnt) -{ - int ret, i, j, tmp, tmp1, tmp2, flag = 0; - u32 count = 0, cnt = 0, cnt_t = 0; - char *p = &cmd_buf[0]; - char *char_offset; - u32 *offset; - - offset = kzalloc((max_cnt + 1) * sizeof(u32), GFP_ATOMIC); - char_offset = kzalloc((max_cnt + 1) * sizeof(char), GFP_ATOMIC); - /* count the number */ - for (i = 0; i < strlen(cmd_buf); i++) { - if (cmd_buf[i] == ',' || cmd_buf[i] == '-') { - count++; - if (cmd_buf[i] == ',') { - offset[count] = i + 1; - char_offset[count] = ','; - } else if (cmd_buf[i] == '-') { - offset[count] = i + 1; - char_offset[count] = '-'; - } - } - if (cmd_buf[i] == ' ') - break; - - if (count >= max_cnt) - break; - } - - for (i = 0; i <= count; i++) { - ret = sscanf(p, "%i", ¶m[i + cnt_t]); - if (ret == 1) { - cnt++; - if (char_offset[cnt] == '-') { - flag++; - p = &cmd_buf[offset[cnt]]; - ret = sscanf(p, "%i", ¶m[i + cnt_t + 1]); - tmp1 = param[i + cnt_t]; - tmp2 = param[i + cnt_t + 1]; - if (ret == 1) { - tmp = i + cnt_t; - for (j = 0; j <= tmp2 - tmp1; j++) - param[tmp + j] = tmp1 + j; - } - cnt_t += tmp2 - tmp1; - - cnt++; - } - p = &cmd_buf[offset[cnt]]; - } - } - - kfree(offset); - - return cnt + cnt_t - 2 * flag; -} - -void ne6x_dbg_show_pcie_drop_counter(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_show_pcie_drop_counter(struct ne6x_pf *pf, char *cmd_buf, int count) { union ne6x_eth_recv_cnt eth_recv_cnt; u64 __iomem *reg; @@ -1497,7 +1378,7 @@ void ne6x_dbg_show_pcie_drop_counter(struct ne6x_pf *pf, char *cmd_buf, int coun + eth_recv_cnt.reg.csr_eth_rdq_drop_cnt); } -void ne6x_dbg_clr_table(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_clr_table(struct ne6x_pf *pf, char *cmd_buf, int count) { u32 table_id = 0, cnt; @@ -1506,7 +1387,7 @@ void ne6x_dbg_clr_table(struct ne6x_pf *pf, char *cmd_buf, int count) ne6x_reg_clear_table(pf, table_id); } -void ne6x_dbg_set_hw_flag_eeprom(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_set_hw_flag_eeprom(struct ne6x_pf *pf, char *cmd_buf, int count) { struct ne6x_dev_eeprom_info *psdk_spd_info = &pf->sdk_spd_info; int flag = 0; @@ -1529,7 +1410,7 @@ void ne6x_dbg_set_hw_flag_eeprom(struct ne6x_pf *pf, char *cmd_buf, int count) : "set hw_flag fail!"); } -void ne6x_dbg_erase_norflash(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_erase_norflash(struct ne6x_pf *pf, char *cmd_buf, int count) { u32 offset; u32 length; @@ -1547,7 +1428,7 @@ void ne6x_dbg_erase_norflash(struct ne6x_pf *pf, char *cmd_buf, int count) dev_err(&pf->pdev->dev, "norflash_erase fail.\n"); } -void ne6x_dbg_write_norflash(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_write_norflash(struct ne6x_pf *pf, char *cmd_buf, int count) { u8 *ptemp_data = NULL; u32 offset = 0; @@ -1590,7 +1471,7 @@ void ne6x_dbg_write_norflash(struct ne6x_pf *pf, char *cmd_buf, int count) kfree(ptemp_data); } -void ne6x_dbg_read_norflash(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_read_norflash(struct ne6x_pf *pf, char *cmd_buf, int count) { u32 offset = 0; u32 length = 0; @@ -1617,7 +1498,7 @@ void ne6x_dbg_read_norflash(struct ne6x_pf *pf, char *cmd_buf, int count) kfree(pdata); } -void ne6x_dbg_meter_write(struct ne6x_pf *pf, char *cmd_buf, int count) +static void ne6x_dbg_meter_write(struct ne6x_pf *pf, char *cmd_buf, int count) { u8 *p_str_array[ARRAY_P_MAX_COUNT] = {0}; u32 cir, type_num, type_flag = 0; @@ -1717,7 +1598,7 @@ void ne6x_dbg_meter_write(struct ne6x_pf *pf, char *cmd_buf, int count) (ret == 0) ? "write meter success!" : "write meter fail!"); } -const struct ne6x_dbg_cmd_wr deg_cmd_wr[] = { +static const struct ne6x_dbg_cmd_wr deg_cmd_wr[] = { {"queue", ne6x_dbg_show_queue}, {"ring", ne6x_dbg_show_ring}, {"txq", ne6x_dbg_show_txq}, @@ -1734,7 +1615,6 @@ const struct ne6x_dbg_cmd_wr deg_cmd_wr[] = { {"apb_read", ne6x_dbg_apb_read}, {"apb_write", ne6x_dbg_apb_write}, {"mem_read", ne6x_dbg_mem_read}, - {"mem_write", ne6x_dbg_mem_write}, {"soc_read", ne6x_dbg_soc_read}, {"soc_write", ne6x_dbg_soc_write}, {"templ_help", ne6x_dbg_templ_help}, @@ -1992,8 +1872,6 @@ u8 *ne6x_dbg_get_fru_product_part(u8 *buffer, enum fru_product_part part, u8 *le return pt; } -void ne6x_dbg_update_adpt_speed(struct ne6x_adapter *adpt, u32 speed, u32 lane_mode) {} - /** * ne6x_dbg_command_write - write into command datum * @filp: the opened file diff --git a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_dev.c b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_dev.c index 70381bd6ebc9..7306ddc2a43b 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_dev.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_dev.c @@ -19,7 +19,7 @@ __data[__n] = cpu_to_be32(__data[__n]); \ }) -void ext_toeplitz_key(const unsigned char *key, unsigned char *ext_key) +static void ext_toeplitz_key(const unsigned char *key, unsigned char *ext_key) { int i; @@ -70,7 +70,7 @@ static u32 ne6x_dev_bitrev(u32 input, int bw) return var; } -void ne6x_dev_crc32_init(u32 poly, u32 *table) +static void ne6x_dev_crc32_init(u32 poly, u32 *table) { u32 c; int i, j; @@ -103,7 +103,7 @@ u32 ne6x_dev_crc32(const u8 *buf, u32 size) return crc ^ 0xFFFFFFFF; } -int ne6x_dev_spd_verify(struct ne6x_dev_eeprom_info *spd_info) +static int ne6x_dev_spd_verify(struct ne6x_dev_eeprom_info *spd_info) { if (be32_to_cpu(spd_info->spd_verify_value) == ne6x_dev_crc32((const u8 *)spd_info, sizeof(*spd_info) - 4)) @@ -112,7 +112,7 @@ int ne6x_dev_spd_verify(struct ne6x_dev_eeprom_info *spd_info) return -EINVAL; } -int ne6x_dev_get_eeprom(struct ne6x_pf *pf) +static int ne6x_dev_get_eeprom(struct ne6x_pf *pf) { int retry = 3; @@ -338,50 +338,6 @@ int ne6x_dev_get_sfp_status(struct ne6x_adapter *adpt, u8 *status) return 0; } -void ne6x_dev_update_status(struct ne6x_pf *pf, struct ne6x_port_info *port, bool is_up) -{ - u32 speed = NE6X_LINK_SPEED_25GB; - struct ne6x_phy_info *phy = &port->phy; - struct ne6x_link_status *link = &phy->link_info; - - if (!is_up) { - link->phy_type_low = NE6X_PHY_TYPE_UNKNOWN; - link->link_speed = speed; - link->link_info &= ~NE6X_AQ_LINK_UP; - phy->media_type = NE6X_MEDIA_UNKNOWN; - return; - } - - link->link_info |= NE6X_AQ_LINK_UP; - switch (speed) { - case NE6X_LINK_SPEED_10GB: - link->phy_type_low = NE6X_PHY_TYPE_10GBASE; - link->link_speed = NE6X_LINK_SPEED_10GB; - break; - case NE6X_LINK_SPEED_25GB: - link->phy_type_low = NE6X_PHY_TYPE_25GBASE; - link->link_speed = NE6X_LINK_SPEED_25GB; - break; - case NE6X_LINK_SPEED_40GB: - link->phy_type_low = NE6X_PHY_TYPE_40GBASE; - link->link_speed = NE6X_LINK_SPEED_40GB; - break; - case NE6X_LINK_SPEED_100GB: - link->phy_type_low = NE6X_PHY_TYPE_100GBASE; - link->link_speed = NE6X_LINK_SPEED_100GB; - break; - case NE6X_LINK_SPEED_200GB: - link->phy_type_low = NE6X_PHY_TYPE_200GBASE; - link->link_speed = NE6X_LINK_SPEED_200GB; - break; - default: - dev_warn(ne6x_pf_to_dev(pf), "Unrecognized link_speed (0x%x).\n", speed); - break; - } - - phy->media_type = NE6X_MEDIA_FIBER; -} - int ne6x_dev_self_test_link(struct ne6x_adapter *adpt, int *verify) { return ne6x_reg_talk_port(adpt->back, NE6X_MSG_PORT_LINK_STATUS, NE6X_TALK_GET, @@ -393,12 +349,6 @@ int ne6x_dev_reset_firmware(struct ne6x_adapter *adpt) return ne6x_reg_reset_firmware(adpt->back); } -int ne6x_dev_get_speed(struct ne6x_adapter *adpt, u32 *speed) -{ - return ne6x_reg_talk_port(adpt->back, NE6X_MSG_PORT_SPEED, NE6X_TALK_GET, - ADPT_LPORT(adpt), (void *)speed, sizeof(u32)); -} - int ne6x_dev_set_speed(struct ne6x_adapter *adpt, u32 speed) { return ne6x_reg_talk_port(adpt->back, NE6X_MSG_PORT_SPEED, NE6X_TALK_SET, @@ -1043,7 +993,7 @@ int ne6x_dev_set_fec(struct ne6x_adapter *adpt, enum ne6x_fec_state fec) ADPT_LPORT(adpt), (void *)&fec, sizeof(int)); } -int ne6x_dev_set_mac_inloop(struct ne6x_adapter *adpt, int enable) +static int ne6x_dev_set_mac_inloop(struct ne6x_adapter *adpt, int enable) { return ne6x_reg_talk_port(adpt->back, NE6X_MSG_PORT_LOOPBACK, NE6X_TALK_SET, ADPT_LPORT(adpt), (void *)&enable, sizeof(int)); @@ -1094,7 +1044,7 @@ int ne6x_dev_set_led(struct ne6x_adapter *adpt, bool state) return ne6x_reg_set_led(adpt->back, ADPT_LPORT(adpt), state); } -void ne6x_dev_transform_vf_stat_format(u32 *stat_arr, struct vf_stat *stat) +static void ne6x_dev_transform_vf_stat_format(u32 *stat_arr, struct vf_stat *stat) { u32 start_pos = 0; @@ -1309,8 +1259,8 @@ int ne6x_dev_test_reg(struct ne6x_adapter *adpt) #define NE6X_LOOP_TEST_TYPE 0x1234 /* handle hook packet */ -int ne6x_dev_proto_recv(struct sk_buff *skb, struct net_device *dev, - struct packet_type *ptype, struct net_device *ndev) +static int ne6x_dev_proto_recv(struct sk_buff *skb, struct net_device *dev, + struct packet_type *ptype, struct net_device *ndev) { struct ne6x_netdev_priv *np = netdev_priv(dev); struct ne6x_adapter *adpt = np->adpt; @@ -1325,7 +1275,7 @@ int ne6x_dev_proto_recv(struct sk_buff *skb, struct net_device *dev, } static u8 loop_dst_mac[8] = {0x00, 0x00, 0x00, 0x11, 0x11, 0x01}; -int ne6x_dev_proto_send(struct net_device *netdev, char *buf, int len) +static int ne6x_dev_proto_send(struct net_device *netdev, char *buf, int len) { struct sk_buff *skb; u8 *pdata = NULL; diff --git a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_interrupt.c b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_interrupt.c index 060ea5b8eca2..99b228a3c8d8 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_interrupt.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_interrupt.c @@ -255,7 +255,7 @@ static void ne6x_irq_affinity_notify(struct irq_affinity_notify *notify, const c static void ne6x_irq_affinity_release(struct kref *ref) {} -int ne6x_adpt_request_irq_msix(struct ne6x_adapter *adpt, char *basename) +static int ne6x_adpt_request_irq_msix(struct ne6x_adapter *adpt, char *basename) { int q_vectors = adpt->num_q_vectors; struct ne6x_pf *pf = adpt->back; @@ -337,7 +337,7 @@ static irqreturn_t ne6x_intr(int irq, void *data) return IRQ_HANDLED; } -int ne6x_adpt_request_irq_intx(struct ne6x_adapter *adpt, char *basename) +static int ne6x_adpt_request_irq_intx(struct ne6x_adapter *adpt, char *basename) { struct ne6x_q_vector *q_vector = adpt->q_vectors[0]; struct net_device *netdev = adpt->netdev; @@ -604,7 +604,7 @@ void ne6x_free_link_irq(struct ne6x_pf *pf) pf->link_int_irq_ready = false; } -irqreturn_t ne6x_msix_clean_vf_mbx(int irq, void *data) +static irqreturn_t ne6x_msix_clean_vf_mbx(int irq, void *data) { struct ne6x_pf *pf = data; struct ne6x_hw *hw = &pf->hw; diff --git a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_main.c b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_main.c index 0344c9957ddb..1db35185a6f6 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_main.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_main.c @@ -22,9 +22,6 @@ #include "ne6x_netlink.h" #include "ne6x_interrupt.h" -#define CREATE_TRACE_POINTS -#include "ne6x_trace.h" - #define SUMMARY "Chengdu BeiZhongWangXin Ethernet Connection N5/N6 Series Linux Driver" #define COPYRIGHT "Copyright(c) 2020 - 2023 Chengdu BeiZhongWangXin Technology Co., Ltd." @@ -65,7 +62,7 @@ bool netif_is_ne6x(struct net_device *dev) return dev && (dev->netdev_ops == &ne6x_netdev_ops); } -int ne6x_hw_init(struct ne6x_hw *hw) +static int ne6x_hw_init(struct ne6x_hw *hw) { int cpu_num = num_online_cpus(); @@ -89,7 +86,7 @@ int ne6x_hw_init(struct ne6x_hw *hw) return 0; } -int ne6x_aq_get_phy_capabilities(struct ne6x_adapter *adpt, bool is_up, bool get_hw_stats) +static int ne6x_aq_get_phy_capabilities(struct ne6x_adapter *adpt, bool is_up, bool get_hw_stats) { struct ne6x_port_info *port_info = adpt->port_info; @@ -141,7 +138,7 @@ int ne6x_aq_get_phy_capabilities(struct ne6x_adapter *adpt, bool is_up, bool get return 0; } -int ne6x_aq_get_vf_link_status(struct ne6x_adapter *adpt, bool is_up) +static int ne6x_aq_get_vf_link_status(struct ne6x_adapter *adpt, bool is_up) { struct ne6x_pf *pf = adpt->back; struct ne6x_adapter *pf_adpt = pf->adpt[(adpt->port_info->lport >= pf->hw.pf_port) ? @@ -213,7 +210,7 @@ static void ne6x_adpt_link_event(struct ne6x_adapter *adpt, bool link_up) } } -void ne6x_print_link_message(struct ne6x_adapter *adpt, bool isup) +static void ne6x_print_link_message(struct ne6x_adapter *adpt, bool isup) { char *speed = "Unknown "; char *an = "False"; @@ -494,7 +491,7 @@ irqreturn_t ne6x_linkint_irq_handler(int irq, void *data) return IRQ_HANDLED; } -int ne6x_pf_init(struct ne6x_pf *pf) +static int ne6x_pf_init(struct ne6x_pf *pf) { pf->ctrl_adpt_idx = 0; mutex_init(&pf->switch_mutex); @@ -720,24 +717,7 @@ static void ne6x_napi_disable_all(struct ne6x_adapter *adpt) } } -static void ne6x_unmap_and_free_tx_resource(struct ne6x_ring *ring, struct ne6x_tx_buf *tx_buffer) -{ - if (tx_buffer->skb) { - dev_kfree_skb_any(tx_buffer->skb); - if (dma_unmap_len(tx_buffer, len)) - dma_unmap_single(ring->dev, dma_unmap_addr(tx_buffer, dma), - dma_unmap_len(tx_buffer, len), DMA_TO_DEVICE); - } else if (dma_unmap_len(tx_buffer, len)) { - dma_unmap_page(ring->dev, dma_unmap_addr(tx_buffer, dma), - dma_unmap_len(tx_buffer, len), DMA_TO_DEVICE); - } - - tx_buffer->next_to_watch = NULL; - tx_buffer->skb = NULL; - dma_unmap_len_set(tx_buffer, len, 0); -} - -void ne6x_clean_tx_ring(struct ne6x_ring *tx_ring) +static void ne6x_clean_tx_ring(struct ne6x_ring *tx_ring) { unsigned long bi_size; u16 i; @@ -767,7 +747,7 @@ void ne6x_clean_tx_ring(struct ne6x_ring *tx_ring) netdev_tx_reset_queue(txring_txq(tx_ring)); } -void ne6x_clean_rx_ring(struct ne6x_ring *rx_ring) +static void ne6x_clean_rx_ring(struct ne6x_ring *rx_ring) { unsigned long bi_size; u16 i; @@ -849,7 +829,7 @@ void ne6x_down(struct ne6x_adapter *adpt) } } -void ne6x_free_rx_resources(struct ne6x_ring *rx_ring) +static void ne6x_free_rx_resources(struct ne6x_ring *rx_ring) { ne6x_clean_rx_ring(rx_ring); kfree(rx_ring->rx_buf); @@ -874,7 +854,7 @@ static void ne6x_adpt_free_rx_resources(struct ne6x_adapter *adpt) } } -void ne6x_free_tx_resources(struct ne6x_ring *tx_ring) +static void ne6x_free_tx_resources(struct ne6x_ring *tx_ring) { ne6x_clean_tx_ring(tx_ring); kfree(tx_ring->tx_buf); @@ -886,7 +866,7 @@ void ne6x_free_tx_resources(struct ne6x_ring *tx_ring) } } -void ne6x_free_cq_resources(struct ne6x_ring *cq_ring) +static void ne6x_free_cq_resources(struct ne6x_ring *cq_ring) { ne6x_clean_cq_ring(cq_ring); if (cq_ring->desc) { @@ -1240,9 +1220,7 @@ static void ne6x_get_netdev_stats_struct(struct net_device *netdev, struct rtnl_ void ne6x_update_pf_stats(struct ne6x_adapter *adpt) { - struct rtnl_link_stats64 *ons; struct rtnl_link_stats64 *ns; /* netdev stats */ - struct ne6x_eth_stats *oes; struct ne6x_eth_stats *es; /* device's eth stats */ struct ne6x_ring *tx_ring; struct ne6x_ring *rx_ring; @@ -1251,8 +1229,6 @@ void ne6x_update_pf_stats(struct ne6x_adapter *adpt) u64 bytes, packets; unsigned int start; struct vf_stat vf_stat; - u64 tx_linearize; - u64 tx_force_wb; u64 rx_p, rx_b; u64 tx_p, tx_b; u64 tx_e, rx_e; @@ -1263,9 +1239,7 @@ void ne6x_update_pf_stats(struct ne6x_adapter *adpt) return; ns = ne6x_get_adpt_stats_struct(adpt); - ons = &adpt->net_stats_offsets; es = &adpt->eth_stats; - oes = &adpt->eth_stats_offsets; rx_p = 0; rx_b = 0; @@ -1275,8 +1249,6 @@ void ne6x_update_pf_stats(struct ne6x_adapter *adpt) tx_e = 0; rx_c = 0; rx_l = 0; - tx_force_wb = 0; - tx_linearize = 0; tx_busy = 0; tx_restart = 0; rx_page = 0; @@ -1297,7 +1269,6 @@ void ne6x_update_pf_stats(struct ne6x_adapter *adpt) tx_p += packets; tx_restart += tx_ring->tx_stats.restart_q; tx_busy += tx_ring->tx_stats.tx_busy; - tx_linearize += tx_ring->tx_stats.tx_linearize; tx_e += tx_ring->tx_stats.csum_err + tx_ring->tx_stats.tx_drop_addr + tx_ring->tx_stats.tx_pcie_read_err; @@ -1849,7 +1820,7 @@ static netdev_features_t ne6x_features_check(struct sk_buff *skb, struct net_dev return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); } -int ne6x_link_speed_to_rate(int link_speed) +static int ne6x_link_speed_to_rate(int link_speed) { switch (link_speed) { case NE6X_LINK_SPEED_100GB: @@ -2060,8 +2031,8 @@ int ne6x_adpt_del_vlan(struct ne6x_adapter *adpt, struct ne6x_vlan vlan) return 0; } -int ne6x_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, - u8 qos, __be16 vlan_proto) +static int ne6x_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, + u8 qos, __be16 vlan_proto) { struct ne6x_netdev_priv *np = netdev_priv(netdev); struct ne6x_pf *pf = ne6x_netdev_to_pf(netdev); @@ -2700,7 +2671,7 @@ int ne6x_adpt_register_netdev(struct ne6x_adapter *adpt) return ret; } -void ne6x_adjust_adpt_port_max_queue(struct ne6x_pf *pf) +static void ne6x_adjust_adpt_port_max_queue(struct ne6x_pf *pf) { int cpu_num = num_online_cpus(); @@ -2921,7 +2892,7 @@ static int ne6x_adpt_clear(struct ne6x_adapter *adpt) return 0; } -int ne6x_adpt_release(struct ne6x_adapter *adpt) +static int ne6x_adpt_release(struct ne6x_adapter *adpt) { struct mac_addr_head *mc_head = &adpt->mc_mac_addr; struct mac_addr_head *uc_head = &adpt->uc_mac_addr; @@ -3079,7 +3050,7 @@ static struct pci_driver ne6x_driver = { .sriov_configure = ne6x_sriov_configure, }; -int __init ne6x_init_module(void) +static int __init ne6x_init_module(void) { pr_info("%s: %s - version %s\n", ne6x_driver_name, ne6x_driver_string, ne6x_driver_version_str); @@ -3100,7 +3071,7 @@ int __init ne6x_init_module(void) module_init(ne6x_init_module); -void __exit ne6x_exit_module(void) +static void __exit ne6x_exit_module(void) { pci_unregister_driver(&ne6x_driver); destroy_workqueue(ne6x_wq); diff --git a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_procfs.c b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_procfs.c index 6015d51465c4..743ab28e803c 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_procfs.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_procfs.c @@ -63,7 +63,7 @@ ssize_t ne6x_proc_tps_read(struct file *filp, char __user *buf, size_t count, lo return len; } -ssize_t ne6x_proc_i2c_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) +static ssize_t ne6x_proc_i2c_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) { struct device *dev = NULL; struct ne6x_pf *pf = NULL; diff --git a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_reg.c b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_reg.c index 2b7f6f24ca25..13d4e5d1e500 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_reg.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_reg.c @@ -6,6 +6,7 @@ #include "ne6x.h" #include "ne6x_reg.h" +#include "ne6x_dev.h" #include "ne6x_portmap.h" #define AXIA_MBUS_READ_MEMORY_COMMAND 0x07 @@ -460,12 +461,12 @@ static struct ne6x_reg_table_info table_info[] = { static u64 local_module_base; -void ne6x_reg_lock(struct ne6x_pf *pf) +static void ne6x_reg_lock(struct ne6x_pf *pf) { mutex_lock(&pf->mbus_comm_mutex); } -void ne6x_reg_unlock(struct ne6x_pf *pf) +static void ne6x_reg_unlock(struct ne6x_pf *pf) { mutex_unlock(&pf->mbus_comm_mutex); } @@ -504,7 +505,7 @@ u64 ne6x_reg_pci_read(struct ne6x_pf *pf, u32 base_addr, u32 offset_addr) } #define BAR4_CSR_OFFSET 0x3C0 -u32 ne6x_reg_axi_read(struct ne6x_pf *pf, u32 offset) +static u32 ne6x_reg_axi_read(struct ne6x_pf *pf, u32 offset) { u64 reg_offset = offset & 0xFFFFFFFC; u64 reg_value = 0x4000000000000000ULL + (reg_offset << 30); @@ -518,7 +519,7 @@ u32 ne6x_reg_axi_read(struct ne6x_pf *pf, u32 offset) return ne6x_reg_pci_read(pf, BAR4_CSR_OFFSET, 0x0) & 0xFFFFFFFFUL; } -void ne6x_reg_axi_write(struct ne6x_pf *pf, u32 offset, u32 value) +static void ne6x_reg_axi_write(struct ne6x_pf *pf, u32 offset, u32 value) { u64 reg_offset = offset & 0xFFFFFFFC; u64 reg_value = 0x4000000000000000ULL + (reg_offset << 30) + value; @@ -527,7 +528,7 @@ void ne6x_reg_axi_write(struct ne6x_pf *pf, u32 offset, u32 value) ne6x_reg_pci_write(pf, BAR4_CSR_OFFSET, 0x0, reg_value); } -u32 _reg_apb_read(struct ne6x_pf *pf, u64 offset) +static u32 _reg_apb_read(struct ne6x_pf *pf, u64 offset) { u32 offset_l = 0x27A00000 | ((offset << 4) & 0xFFFF0); u32 offset_h; @@ -543,7 +544,7 @@ u32 _reg_apb_read(struct ne6x_pf *pf, u64 offset) return data; } -void _reg_apb_write(struct ne6x_pf *pf, u64 offset, u32 value) +static void _reg_apb_write(struct ne6x_pf *pf, u64 offset, u32 value) { u32 offset_l; u32 offset_h; @@ -558,7 +559,7 @@ void _reg_apb_write(struct ne6x_pf *pf, u64 offset, u32 value) } u32 NE6X_ACCESS_TIMEOUT = 9999; -int _ne6x_reg_perform(struct ne6x_pf *pf, u32 *data, u32 *pbuf, u32 len, u32 retlen) +static int _ne6x_reg_perform(struct ne6x_pf *pf, u32 *data, u32 *pbuf, u32 len, u32 retlen) { struct axia_mbus_msg resp; int timeout = 0, index = 0; @@ -605,7 +606,7 @@ int _ne6x_reg_perform(struct ne6x_pf *pf, u32 *data, u32 *pbuf, u32 len, u32 ret return 0; } -int ne6x_reg_perform(struct ne6x_pf *pf, u32 *data, u32 *pbuf, u32 len, u32 retlen) +static int ne6x_reg_perform(struct ne6x_pf *pf, u32 *data, u32 *pbuf, u32 len, u32 retlen) { int status; @@ -1055,54 +1056,6 @@ int ne6x_reg_send_bit(struct ne6x_pf *pf, u32 port, u32 mode) return status; } -int ne6x_reg_mem_read(struct ne6x_pf *pf, u32 addr, void *pbuf, u32 size) -{ - struct axia_mbus_msg *msg; - int status; - - if (size > 1024) - size = 1024; - - msg = kzalloc(520, GFP_KERNEL); - if (!msg) - return -ENOMEM; - - msg->hdr.uint = 0; - msg->hdr.bits.opcode = AXIA_MBUS_READ_MEMORY_COMMAND; - msg->hdr.bits.data_len = 12; - msg->data[0] = addr; - msg->data[1] = size; - - status = ne6x_reg_perform(pf, (u32 *)msg, (u32 *)pbuf, 3, size / 4); - kfree(msg); - - return status; -} - -int ne6x_reg_mem_write(struct ne6x_pf *pf, u32 addr, void *pbuf, u32 size) -{ - struct axia_mbus_msg *msg; - int status; - - msg = kzalloc(520, GFP_KERNEL); - if (!msg) - return -ENOMEM; - - if (size > 1024) - size = 1024; - - msg->hdr.uint = 0; - msg->hdr.bits.opcode = AXIA_MBUS_WRITE_MEMORY_COMMAND; - msg->hdr.bits.data_len = 12 + (size / 4) * 4; - msg->data[0] = addr; - msg->data[1] = size; - - status = ne6x_reg_perform(pf, (u32 *)msg, NULL, 3 + (size / 4), 0); - kfree(msg); - - return status; -} - #define NE6X_FW_MAX_FRG_SIZE (4 * 1024) int ne6x_reg_upgrade_firmware(struct ne6x_pf *pf, u8 region, u8 *data, int size) { @@ -1250,7 +1203,7 @@ int ne6x_reg_get_nic_state(struct ne6x_pf *pf, u32 *state) return status; } -int ne6x_reg_set_user_data_template(struct ne6x_pf *pf, enum np_user_data type, u32 data) +static int ne6x_reg_set_user_data_template(struct ne6x_pf *pf, enum np_user_data type, u32 data) { struct axia_mbus_msg *msg; int status; @@ -1271,7 +1224,7 @@ int ne6x_reg_set_user_data_template(struct ne6x_pf *pf, enum np_user_data type, return status; } -int ne6x_reg_get_user_data_template(struct ne6x_pf *pf, enum np_user_data type, u32 *data) +static int ne6x_reg_get_user_data_template(struct ne6x_pf *pf, enum np_user_data type, u32 *data) { struct axia_mbus_msg *msg; int status; @@ -1388,7 +1341,7 @@ int ne6x_reg_get_dump_data_len(struct ne6x_pf *pf, u32 *size) return status; } -void ne6x_reg_send(struct ne6x_pf *pf, u32 cmd, u32 *data, u32 size) +static void ne6x_reg_send(struct ne6x_pf *pf, u32 cmd, u32 *data, u32 size) { struct axia_mbus_msg *msg; u32 *msg_data; @@ -1414,8 +1367,8 @@ void ne6x_reg_send(struct ne6x_pf *pf, u32 cmd, u32 *data, u32 size) kfree(msg); } -int ne6x_reg_polling(struct ne6x_pf *pf, u32 cmd, u32 *data, u32 buf_size, - u32 *real_size) +static int ne6x_reg_polling(struct ne6x_pf *pf, u32 cmd, u32 *data, u32 buf_size, + u32 *real_size) { int timeout = 0, offset = 0; struct axia_mbus_msg resp; diff --git a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_trace.h b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_trace.h deleted file mode 100644 index 892e38d19059..000000000000 --- a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_trace.h +++ /dev/null @@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright(c) 2020 - 2023, Chengdu BeiZhongWangXin Technology Co., Ltd. */ - -#ifndef CONFIG_TRACEPOINTS -#if !defined(_NE6X_TRACE_H_) -#define _NE6X_TRACE_H_ - -#define ne6x_trace(trace_name, args...) -#define ne6x_trace_enabled(trace_name) (0) -#endif /* !defined(_NE6X_TRACE_H_) */ -#else /* CONFIG_TRACEPOINTS */ -#undef TRACE_SYSTEM -#define TRACE_SYSTEM ne6x - -#if !defined(_NE6X_VF_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) -#define _NE6X_TRACE_H_ - -#include -#include "trace_comm.h" -#endif /* _NE6X_TRACE_H_ */ -/* This must be outside ifdef _NE6X_TRACE_H_ */ - -#undef TRACE_INCLUDE_PATH -#define TRACE_INCLUDE_PATH . -#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_FILE ne6x_trace -#include -#endif /* CONFIG_TRACEPOINTS */ diff --git a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_txrx.c b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_txrx.c index a60f6b1d3721..bb70698eefec 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_txrx.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_txrx.c @@ -4,7 +4,6 @@ #include "ne6x.h" #include "ne6x_txrx.h" #include "ne6x_reg.h" -#include "ne6x_trace.h" int ne6x_adpt_setup_tx_resources(struct ne6x_adapter *adpt) { diff --git a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_txrx.h b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_txrx.h index b09563cfc4e3..869cb9234be5 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_txrx.h +++ b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_txrx.h @@ -6,6 +6,5 @@ int ne6x_napi_poll(struct napi_struct *napi, int budget); netdev_tx_t ne6x_lan_xmit_frame(struct sk_buff *skb, struct net_device *netdev); -bool ne6x_alloc_rx_buffers(struct ne6x_ring *rx_ring, u16 cleaned_count); #endif diff --git a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_virtchnl_pf.c b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_virtchnl_pf.c index e147e01efd6d..afb190a3b4c7 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_virtchnl_pf.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x/ne6x_virtchnl_pf.c @@ -8,7 +8,7 @@ #include "ne6x_txrx.h" #include "ne6x_interrupt.h" -void ne6x_clear_vf_status(struct ne6x_vf *vf) +static void ne6x_clear_vf_status(struct ne6x_vf *vf) { struct ne6x_flowctrl flowctrl; @@ -18,7 +18,7 @@ void ne6x_clear_vf_status(struct ne6x_vf *vf) ne6x_dev_set_vf_bw(vf->adpt, 0); } -void ne6x_mbx_deinit_snapshot(struct ne6x_hw *hw) +static void ne6x_mbx_deinit_snapshot(struct ne6x_hw *hw) { struct ne6x_mbx_snapshot *snap = &hw->mbx_snapshot; @@ -27,7 +27,7 @@ void ne6x_mbx_deinit_snapshot(struct ne6x_hw *hw) snap->mbx_vf.vfcntr_len = 0; } -int ne6x_mbx_init_snapshot(struct ne6x_hw *hw, u16 vf_count) +static int ne6x_mbx_init_snapshot(struct ne6x_hw *hw, u16 vf_count) { struct ne6x_mbx_snapshot *snap = &hw->mbx_snapshot; @@ -52,7 +52,7 @@ int ne6x_mbx_init_snapshot(struct ne6x_hw *hw, u16 vf_count) return 0; } -int ne6x_status_to_errno(int err) +static int ne6x_status_to_errno(int err) { if (err) return -EINVAL; @@ -60,7 +60,7 @@ int ne6x_status_to_errno(int err) return 0; } -void ne6x_set_vf_state_qs_dis(struct ne6x_vf *vf) +static void ne6x_set_vf_state_qs_dis(struct ne6x_vf *vf) { /* Clear Rx/Tx enabled queues flag */ if (test_bit(NE6X_VF_STATE_QS_ENA, vf->vf_states)) @@ -72,7 +72,7 @@ static void ne6x_dis_vf_qs(struct ne6x_vf *vf) ne6x_set_vf_state_qs_dis(vf); } -bool ne6x_is_reset_in_progress(unsigned long *state) +static bool ne6x_is_reset_in_progress(unsigned long *state) { return test_bit(NE6X_PF_RESET_REQUESTED, state) || test_bit(NE6X_RESET_INTR_RECEIVED, state) || @@ -80,7 +80,7 @@ bool ne6x_is_reset_in_progress(unsigned long *state) test_bit(NE6X_GLOBAL_RESET_REQUESTED, state); } -void ne6x_adpt_close_vf(struct ne6x_adapter *adpt, u16 vf_id) +static void ne6x_adpt_close_vf(struct ne6x_adapter *adpt, u16 vf_id) { if (!test_and_set_bit(NE6X_ADPT_DOWN, adpt->comm.state)) clear_bit(NE6X_ADPT_DOWN, adpt->comm.state); @@ -160,7 +160,7 @@ static int ne6x_adpt_clear_vf(struct ne6x_adapter *adpt) return 0; } -int ne6x_adpt_release_vf(struct ne6x_adapter *adpt, u16 vf_id) +static int ne6x_adpt_release_vf(struct ne6x_adapter *adpt, u16 vf_id) { struct ne6x_pf *pf; @@ -240,7 +240,7 @@ static int ne6x_sriov_free_msix_res(struct ne6x_pf *pf) return 0; } -void ne6x_free_vfs(struct ne6x_pf *pf) +static void ne6x_free_vfs(struct ne6x_pf *pf) { struct device *dev = ne6x_pf_to_dev(pf); unsigned int tmp, i; @@ -365,7 +365,7 @@ static void ne6x_vc_allowlist_opcodes(struct ne6x_vf *vf, const u32 *opcodes, si set_bit(opcodes[i], vf->opcodes_allowlist); } -void ne6x_vc_set_default_allowlist(struct ne6x_vf *vf) +static void ne6x_vc_set_default_allowlist(struct ne6x_vf *vf) { ne6x_vc_clear_allowlist(vf); ne6x_vc_allowlist_opcodes(vf, default_allowlist_opcodes, @@ -389,7 +389,7 @@ static void ne6x_set_dflt_settings_vfs(struct ne6x_pf *pf) } } -void ne6x_send_init_mbx_mesg(struct ne6x_pf *pf) +static void ne6x_send_init_mbx_mesg(struct ne6x_pf *pf) { struct ne6x_hw *hw = &pf->hw; u64 reg_cfg; @@ -484,7 +484,7 @@ static struct ne6x_adapter *ne6x_adpt_alloc(struct ne6x_pf *pf, u16 vf_id, u16 n return adpt; } -struct ne6x_adapter *ne6x_adpt_setup_vf(struct ne6x_pf *pf, u16 vf_id, u16 num_vfs) +static struct ne6x_adapter *ne6x_adpt_setup_vf(struct ne6x_pf *pf, u16 vf_id, u16 num_vfs) { struct device *dev = ne6x_pf_to_dev(pf); struct ne6x_adapter *adpt; @@ -934,8 +934,8 @@ static int ne6x_validate_outer_vf_id(struct ne6x_pf *pf, u16 out_vf_id) return 0; } -int ne6x_sdk_send_msg_to_vf(struct ne6x_hw *hw, u16 vfid, u32 v_opcode, - u32 v_retval, u8 *msg, u16 msglen) +static int ne6x_sdk_send_msg_to_vf(struct ne6x_hw *hw, u16 vfid, u32 v_opcode, + u32 v_retval, u8 *msg, u16 msglen) { union u_ne6x_mbx_snap_buffer_data usnap; struct ne6x_pf *pf = hw->back; @@ -1316,7 +1316,7 @@ static bool ne6x_is_vf_link_up(struct ne6x_vf *vf) return pi->phy.link_info.link_info & NE6X_AQ_LINK_UP; } -u32 ne6x_conv_link_speed_to_virtchnl(bool adv_link_support, u16 link_speed) +static u32 ne6x_conv_link_speed_to_virtchnl(bool adv_link_support, u16 link_speed) { u32 speed; @@ -1352,7 +1352,7 @@ static void ne6x_set_pfe_link(struct ne6x_vf *vf, struct virtchnl_pf_event *pfe, pfe->link_speed = ne6x_conv_link_speed_to_virtchnl(true, ne6x_link_speed); } -void ne6x_vc_notify_vf_link_state(struct ne6x_vf *vf) +static void ne6x_vc_notify_vf_link_state(struct ne6x_vf *vf) { struct virtchnl_pf_event pfe = {0}; struct ne6x_hw *hw = &vf->pf->hw; @@ -1436,7 +1436,7 @@ static void ne6x_vc_notify_vf_trust_change(struct ne6x_vf *vf) (u8 *)data, 2); } -bool ne6x_reset_vf(struct ne6x_vf *vf, bool is_vflr) +static bool ne6x_reset_vf(struct ne6x_vf *vf, bool is_vflr) { struct ne6x_adapter *adpt; @@ -2233,7 +2233,7 @@ static void ne6x_calc_token_for_bw(int max_tx_rate, int *time_inv, int *tocken) } } -int ne6x_set_vf_bw_for_max_vpnum(struct ne6x_pf *pf, int vf_id, int max_tx_rate) +static int ne6x_set_vf_bw_for_max_vpnum(struct ne6x_pf *pf, int vf_id, int max_tx_rate) { union ne6x_sq_meter_cfg0 sq_meter_cfg0; union ne6x_sq_meter_cfg1 sq_meter_cfg1; diff --git a/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6x_trace.h b/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6x_trace.h deleted file mode 100644 index 882ec242f7bb..000000000000 --- a/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6x_trace.h +++ /dev/null @@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright(c) 2020 - 2023, Chengdu BeiZhongWangXin Technology Co., Ltd. */ - -#ifndef CONFIG_TRACEPOINTS -#if !defined(_NE6X_VF_TRACE_H_) -#define _NE6X_VF_TRACE_H_ - -#define ne6x_trace(trace_name, args...) -#define ne6x_trace_enabled(trace_name) (0) -#endif /* !defined(_NE6X_VF_TRACE_H_) */ -#else /* CONFIG_TRACEPOINTS */ -#undef TRACE_SYSTEM -#define TRACE_SYSTEM ne6xvf - -#if !defined(_NE6X_VF_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) -#define _NE6X_VF_TRACE_H_ - -#include -#include "trace_comm.h" -#endif /* _NE6X_TRACE_H_ */ -/* This must be outside ifdef _NE6X_VF_TRACE_H_ */ - -#undef TRACE_INCLUDE_PATH -#define TRACE_INCLUDE_PATH . -#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_FILE ne6x_trace -#include -#endif /* CONFIG_TRACEPOINTS */ diff --git a/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf.h b/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf.h index 9ee06262f0fb..3e97993b1667 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf.h +++ b/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf.h @@ -516,7 +516,6 @@ void ne6xvf_free_all_cq_resources(struct ne6xvf_adapter *adapter); void ne6xvf_free_all_tx_resources(struct ne6xvf_adapter *adapter); void ne6xvf_free_all_rx_resources(struct ne6xvf_adapter *adapter); void ne6xvf_reset_interrupt_capability(struct ne6xvf_adapter *adapter); -bool ne6x_alloc_rx_buffers(struct ne6x_ring *rx_ring, u16 cleaned_count); void ne6xvf_set_ethtool_ops(struct net_device *netdev); void ne6xvf_request_stats(struct ne6xvf_adapter *adapter); void ne6xvf_irq_enable(struct ne6xvf_adapter *adapter, bool flush); diff --git a/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_debugfs.c b/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_debugfs.c index 66f589020e23..83075b9980b6 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_debugfs.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_debugfs.c @@ -8,7 +8,7 @@ static struct dentry *ne6xvf_dbg_root; -void ne6xvf_showqueue(struct ne6xvf_adapter *pf) +static void ne6xvf_showqueue(struct ne6xvf_adapter *pf) { struct ne6x_ring *ring; u64 head, tail, oft; @@ -63,7 +63,7 @@ void ne6xvf_showqueue(struct ne6xvf_adapter *pf) dev_info(&pf->pdev->dev, "--------------------------------------------------------------------------------------------"); } -void ne6xvf_showring(struct ne6xvf_adapter *pf) +static void ne6xvf_showring(struct ne6xvf_adapter *pf) { struct ne6x_tx_desc *tx_desc; struct ne6x_cq_desc *cq_desc; @@ -143,7 +143,7 @@ void ne6xvf_showring(struct ne6xvf_adapter *pf) } } -const struct ne6xvf_dbg_cmd_wr deg_cmd_wr[] = { +static const struct ne6xvf_dbg_cmd_wr deg_cmd_wr[] = { {"queue", ne6xvf_showqueue}, {"ring", ne6xvf_showring}, }; diff --git a/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_ethtool.c b/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_ethtool.c index 3fbab2d87066..c4e8c2f685c0 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_ethtool.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_ethtool.c @@ -208,6 +208,7 @@ static void ne6xvf_get_strings(struct net_device *netdev, u32 stringset, u8 *dat break; case ETH_SS_TEST: memcpy(data, ne6xvf_gstrings_test, NE6XVF_TEST_LEN * ETH_GSTRING_LEN); + fallthrough; default: break; } diff --git a/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_main.c b/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_main.c index 1de2173d7675..5792a1cd6741 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_main.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_main.c @@ -11,9 +11,6 @@ #include "ne6xvf_txrx.h" #include "version.h" -#define CREATE_TRACE_POINTS -#include "ne6x_trace.h" - #define SUMMARY \ "Chengdu BeiZhongWangXin Ethernet Connection N5/N6 Series Virtual Function Linux Driver" #define COPYRIGHT "Copyright (c) 2020 - 2023 Chengdu BeiZhongWangXin Technology Co., Ltd." @@ -42,7 +39,7 @@ static const struct net_device_ops ne6xvf_netdev_ops; struct workqueue_struct *ne6xvf_wq; static void ne6xvf_sync_features(struct net_device *netdev); -struct ne6xvf_adapter *ne6xvf_pdev_to_adapter(struct pci_dev *pdev) +static struct ne6xvf_adapter *ne6xvf_pdev_to_adapter(struct pci_dev *pdev) { return netdev_priv(pci_get_drvdata(pdev)); } @@ -61,15 +58,7 @@ static void ne6xvf_tx_timeout(struct net_device *netdev, __always_unused unsigne ne6xvf_schedule_reset(adapter); } -/** - * nce_get_vsi_stats_struct - Get System Network Statistics - * @vsi: the VSI we care about - * - * Returns the address of the device statistics structure. - * The statistics are actually updated from the service task. - **/ - -struct net_device_stats *nce_get_vsi_stats_struct(struct ne6xvf_adapter *adapter) +static struct net_device_stats *ne6xvf_get_adpt_stats_struct(struct ne6xvf_adapter *adapter) { if (adapter->netdev) return &adapter->netdev->stats; @@ -77,10 +66,6 @@ struct net_device_stats *nce_get_vsi_stats_struct(struct ne6xvf_adapter *adapter return &adapter->net_stats; } -/** - * nce_update_pf_stats - Update PF port stats counters - * @pf: PF whose stats needs to be updated - */ void ne6xvf_update_pf_stats(struct ne6xvf_adapter *adapter) { struct net_device_stats *ns; /* netdev stats */ @@ -94,7 +79,7 @@ void ne6xvf_update_pf_stats(struct ne6xvf_adapter *adapter) if (test_bit(NE6X_ADPT_DOWN, adapter->comm.state)) return; - ns = nce_get_vsi_stats_struct(adapter); + ns = ne6xvf_get_adpt_stats_struct(adapter); rx_p = 0; rx_b = 0; @@ -132,7 +117,7 @@ void ne6xvf_update_pf_stats(struct ne6xvf_adapter *adapter) adapter->net_stats.tx_bytes = tx_b; } -bool ne6xvf_is_remove_in_progress(struct ne6xvf_adapter *adapter) +static bool ne6xvf_is_remove_in_progress(struct ne6xvf_adapter *adapter) { return test_bit(__NE6XVF_IN_REMOVE_TASK, &adapter->crit_section); } @@ -201,7 +186,7 @@ static int ne6xvf_check_reset_complete(struct ne6xvf_hw *hw) return 0; } -int ne6xvf_init_sdk_mbx(struct ne6xvf_hw *hw) +static int ne6xvf_init_sdk_mbx(struct ne6xvf_hw *hw) { union u_ne6x_mbx_snap_buffer_data mbx_buffer; union u_ne6x_mbx_snap_buffer_data usnap; @@ -736,7 +721,7 @@ static int ne6xvf_alloc_q_vectors(struct ne6xvf_adapter *adapter) * @adapter: board private structure to initialize * **/ -int ne6xvf_init_interrupt_scheme(struct ne6xvf_adapter *adapter) +static int ne6xvf_init_interrupt_scheme(struct ne6xvf_adapter *adapter) { int err; @@ -1088,7 +1073,7 @@ static int ne6xvf_request_traffic_irqs(struct ne6xvf_adapter *adapter, char *bas * * Request that the PF set up our (previously allocated) queues. **/ -void ne6xvf_configure_queues(struct ne6xvf_adapter *adapter) +static void ne6xvf_configure_queues(struct ne6xvf_adapter *adapter) { unsigned int rx_buf_len = NE6X_RXBUFFER_2048; struct ne6xvf_hw *hw = &adapter->hw; @@ -1437,7 +1422,7 @@ static void ne6xvf_init_process_extended_caps(struct ne6xvf_adapter *adapter) * Verify that we have a valid config struct, and set up our netdev features * and our VSI struct. **/ -int ne6xvf_process_config(struct ne6xvf_adapter *adapter) +static int ne6xvf_process_config(struct ne6xvf_adapter *adapter) { struct net_device *netdev = adapter->netdev; netdev_features_t csumo_features; @@ -1495,7 +1480,7 @@ int ne6xvf_process_config(struct ne6xvf_adapter *adapter) /* advertise support but don't enable by default since only one type of * VLAN offload can be enabled at a time (i.e. CTAG or STAG). When one * type turns on the other has to be turned off. This is enforced by the - * nce_fix_features() ndo callback. + * ne6xvf_fix_features() ndo callback. */ netdev->hw_features |= NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_STAG_TX | @@ -1668,18 +1653,6 @@ static int ne6xvf_process_aq_command(struct ne6xvf_adapter *adapter) return -EAGAIN; } -/** - * ne6xvf_asq_done - check if FW has processed the Admin Send Queue - * @hw: pointer to the hw struct - * - * Returns true if the firmware has processed all descriptors on the - * admin send queue. Returns false if there are still requests pending. - **/ -bool ne6xvf_asq_done(struct ne6xvf_hw *hw) -{ - return 1; -} - /** * ne6xvf_register_netdev - register netdev * @adapter: pointer to the ne6xvf_adapter struct @@ -1722,7 +1695,6 @@ static void ne6xvf_watchdog_task(struct work_struct *work) { struct ne6xvf_adapter *adapter = container_of(work, struct ne6xvf_adapter, watchdog_task.work); - struct ne6xvf_hw *hw = &adapter->hw; if (ne6xvf_is_remove_in_progress(adapter)) return; @@ -1761,12 +1733,7 @@ static void ne6xvf_watchdog_task(struct work_struct *work) case __NE6XVF_DOWN_PENDING: case __NE6XVF_TESTING: case __NE6XVF_RUNNING: - if (adapter->current_op) { - if (!ne6xvf_asq_done(hw)) { - dev_dbg(&adapter->pdev->dev, "Admin queue timeout\n"); - ne6xvf_send_api_ver(adapter); - } - } else { + if (!adapter->current_op) { int ret = ne6xvf_process_aq_command(adapter); /* An error will be returned if no commands were @@ -1879,7 +1846,7 @@ static struct ne6xvf_mac_filter *ne6xvf_add_filter(struct ne6xvf_adapter *adapte * * Expects to be called while holding the __NE6XVF_IN_CRITICAL_TASK bit lock. **/ -void ne6xvf_down(struct ne6xvf_adapter *adapter) +static void ne6xvf_down(struct ne6xvf_adapter *adapter) { struct net_device *netdev = adapter->netdev; struct ne6xvf_vlan_filter *vlf; @@ -2173,16 +2140,6 @@ static int ne6xvf_addr_unsync(struct net_device *netdev, const u8 *addr) return 0; } -/** - * ne6xvf_promiscuous_mode_changed - check if promiscuous mode bits changed - * @adapter: device specific adapter - */ -bool ne6xvf_promiscuous_mode_changed(struct ne6xvf_adapter *adapter) -{ - return (adapter->current_netdev_promisc_flags ^ adapter->netdev->flags) & - (IFF_PROMISC | IFF_ALLMULTI); -} - /** * ne6xvf_set_rx_mode - NDO callback to set the netdev filters * @netdev: network interface device structure @@ -2313,7 +2270,7 @@ static void ne6xvf_sync_features(struct net_device *netdev) #define NETIF_UDP_TNL_FEATURES (NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM) /** - * nce_set_features - set the netdev feature flags + * ne6xvf_set_features - set the netdev feature flags * @netdev: ptr to the netdev being adjusted * @features: the feature set that the stack is suggesting * Note: expects to be called while under rtnl_lock() @@ -2428,7 +2385,7 @@ static int ne6xvf_set_features(struct net_device *netdev, netdev_features_t feat } /** - * nce_fix_features - fix the netdev feature flags + * ne6xvf_fix_features - fix the netdev feature flags * @netdev: ptr to the netdev being adjusted * @features: the feature set that the stack is suggesting * Note: expects to be called while under rtnl_lock() @@ -2464,7 +2421,7 @@ static netdev_features_t ne6xvf_fix_features(struct net_device *netdev, netdev_f * * Do not call this with mac_vlan_list_lock! **/ -int ne6xvf_replace_primary_mac(struct ne6xvf_adapter *adapter, const u8 *new_mac) +static int ne6xvf_replace_primary_mac(struct ne6xvf_adapter *adapter, const u8 *new_mac) { memcpy(adapter->hw.mac.addr, new_mac, 6); adapter->aq_required |= NE6XVF_FLAG_AQ_SET_VF_MAC; @@ -2587,57 +2544,6 @@ static struct ne6xvf_vlan_filter *ne6xvf_find_vlan(struct ne6xvf_adapter *adapte return NULL; } -/** - * ne6xvf_add_vlan - Add a vlan filter to the list - * @adapter: board private structure - * @vlan: VLAN tag - * - * Returns ptr to the filter object or NULL when no memory available. - **/ -struct ne6xvf_vlan_filter *ne6xvf_add_vlan_list(struct ne6xvf_adapter *adapter, - struct ne6x_vf_vlan vlan) -{ - struct ne6xvf_vlan_filter *f = NULL; - - spin_lock_bh(&adapter->mac_vlan_list_lock); - - f = ne6xvf_find_vlan(adapter, vlan); - if (!f) { - f = kzalloc(sizeof(*f), GFP_ATOMIC); - if (!f) - goto clearout; - - f->vlan = vlan; - - list_add_tail(&f->list, &adapter->vlan_filter_list); - f->add = true; - } - -clearout: - spin_unlock_bh(&adapter->mac_vlan_list_lock); - return f; -} - -/** - * ne6xvf_del_vlan - Remove a vlan filter from the list - * @adapter: board private structure - * @vlan: VLAN tag - **/ -void ne6xvf_del_vlan_list(struct ne6xvf_adapter *adapter, struct ne6x_vf_vlan vlan) -{ - struct ne6xvf_vlan_filter *f; - - spin_lock_bh(&adapter->mac_vlan_list_lock); - - f = ne6xvf_find_vlan(adapter, vlan); - if (f) { - list_del(&f->list); - kfree(f); - } - - spin_unlock_bh(&adapter->mac_vlan_list_lock); -} - /** * ne6xvf_add_vlan - Add a vlan filter to the list * @adapter: board private structure @@ -2993,7 +2899,7 @@ static int ne6xvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * @adapter: board private structure * @mask: bitmap of queues to enable **/ -void ne6xvf_irq_enable_queues(struct ne6xvf_adapter *adapter, u32 mask) +static void ne6xvf_irq_enable_queues(struct ne6xvf_adapter *adapter, u32 mask) { struct ne6xvf_hw *hw = &adapter->hw; int i; diff --git a/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_virtchnl.c b/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_virtchnl.c index 9d6cb823863c..181e0b81e806 100644 --- a/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_virtchnl.c +++ b/drivers/net/ethernet/bzwx/nce/ne6x_vf/ne6xvf_virtchnl.c @@ -4,9 +4,9 @@ #include "ne6xvf.h" #include "ne6xvf_osdep.h" -int ne6xvf_sdk_send_msg_to_pf(struct ne6xvf_hw *hw, enum virtchnl_ops v_opcode, - enum virtchnl_status_code v_retval, u8 *msg, u16 msglen, - void *cmd_details) +static int ne6xvf_sdk_send_msg_to_pf(struct ne6xvf_hw *hw, enum virtchnl_ops v_opcode, + enum virtchnl_status_code v_retval, u8 *msg, u16 msglen, + void *cmd_details) { union u_ne6x_mbx_snap_buffer_data mbx_buffer; @@ -200,7 +200,7 @@ int ne6xvf_send_api_ver(struct ne6xvf_adapter *adapter) * Given a VF resource message from the PF, populate the hw struct * with appropriate information. **/ -void ne6xvf_vf_parse_hw_config(struct ne6xvf_hw *hw, struct virtchnl_vf_resource *msg) +static void ne6xvf_vf_parse_hw_config(struct ne6xvf_hw *hw, struct virtchnl_vf_resource *msg) { struct virtchnl_vsi_resource *vsi_res; int i; -- Gitee