net: qed/qede: W=1 C=1 warnings cleanup
Subsystems (3)
cover net: qed/qede: W=1 C=1 warnings cleanup
This set cleans qed/qede build log under W=1 C=1 with GCC 8 and sparse 0.6.2. The only thing left is "context imbalance -- unexpected unlock" in one of the source files, which will be issued later during the refactoring cycles.
The biggest part is handling the endianness warnings. The current code often just assumes that both host and device operate in LE, which is obviously incorrect (despite the fact that it's true for x86 platforms), and makes sparse {s,m}ad.
The rest of the series is mostly random non-functional fixes here-and-there.
Alexander Lobakin (9):
net: qed: move static iro_arr[] out of header file
net: qed: cleanup global structs declarations
net: qed: correct qed_hw_err_notify() prototype
net: qed: address kernel-doc warnings
net: qed: improve indentation of some parts of code
net: qed: use ptr shortcuts to dedup field accessing in some parts
net: qed: sanitize BE/LE data processing
net: qede: fix kernel-doc for qede_ptp_adjfreq()
net: qede: fix BE vs CPU comparison
drivers/net/ethernet/qlogic/qed/qed_cxt.c | 14 +- drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 27 +- drivers/net/ethernet/qlogic/qed/qed_dcbx.h | 2 + drivers/net/ethernet/qlogic/qed/qed_debug.c | 52 ++-- drivers/net/ethernet/qlogic/qed/qed_fcoe.c | 54 ++-- drivers/net/ethernet/qlogic/qed/qed_fcoe.h | 5 - drivers/net/ethernet/qlogic/qed/qed_hsi.h | 267 +++++++----------- drivers/net/ethernet/qlogic/qed/qed_hw.c | 5 +- drivers/net/ethernet/qlogic/qed/qed_hw.h | 7 +- .../ethernet/qlogic/qed/qed_init_fw_funcs.c | 128 +++++---- .../net/ethernet/qlogic/qed/qed_init_ops.c | 73 +++++ drivers/net/ethernet/qlogic/qed/qed_int.c | 123 ++++---- drivers/net/ethernet/qlogic/qed/qed_iscsi.c | 48 ++-- drivers/net/ethernet/qlogic/qed/qed_iscsi.h | 4 - drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 150 ++++++---- drivers/net/ethernet/qlogic/qed/qed_l2.c | 81 +++--- drivers/net/ethernet/qlogic/qed/qed_ll2.c | 9 +- drivers/net/ethernet/qlogic/qed/qed_ll2.h | 2 + drivers/net/ethernet/qlogic/qed/qed_main.c | 16 +- drivers/net/ethernet/qlogic/qed/qed_mng_tlv.c | 4 +- drivers/net/ethernet/qlogic/qed/qed_ptp.c | 1 + drivers/net/ethernet/qlogic/qed/qed_ptp.h | 9 + drivers/net/ethernet/qlogic/qed/qed_rdma.c | 52 ++-- drivers/net/ethernet/qlogic/qed/qed_rdma.h | 2 +- drivers/net/ethernet/qlogic/qed/qed_roce.c | 203 ++++++------- drivers/net/ethernet/qlogic/qed/qed_sp.h | 9 +- .../net/ethernet/qlogic/qed/qed_sp_commands.c | 24 +- drivers/net/ethernet/qlogic/qed/qed_spq.c | 16 +- drivers/net/ethernet/qlogic/qed/qed_sriov.c | 27 +- drivers/net/ethernet/qlogic/qed/qed_sriov.h | 2 + .../net/ethernet/qlogic/qede/qede_filter.c | 8 +- drivers/net/ethernet/qlogic/qede/qede_ptp.c | 10 +- include/linux/qed/qed_if.h | 15 +- 33 files changed, 743 insertions(+), 706 deletions(-) create mode 100644 drivers/net/ethernet/qlogic/qed/qed_ptp.h
Signature · 1 line
2.25.1
PATCH 1/9 net: qed: move static iro_arr[] out of header file
Static variables (and functions, unless they're inline) should not be declared in header files.
Move the static array iro_arr[] from "qed_hsi.h" to the sole place where it's used, "qed_init_ops.c". This eliminates lots of warnings (42 of them actually) against W=1+:
In file included from drivers/net/ethernet/qlogic/qed/qed.h:51:0,
from drivers/net/ethernet/qlogic/qed/qed_ooo.c:40:drivers/net/ethernet/qlogic/qed/qed_hsi.h:4421:18: warning: 'iro_arr' defined but not used [-Wunused-const-variable=]
static const u32 iro_arr[] = {
^~~~~~~--- drivers/net/ethernet/qlogic/qed/qed_hsi.h | 73 ------------------- .../net/ethernet/qlogic/qed/qed_init_ops.c | 73 +++++++++++++++++++ 2 files changed, 73 insertions(+), 73 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_hsi.h +0 -73
@@ -4391,79 +4391,6 @@ void qed_fw_overlay_mem_free(struct qed_hwfn *p_hwfn, (IRO[66].base + ((roce_pf_id) * IRO[66].m1))#define USTORM_ROCE_CQE_STATS_SIZE (IRO[66].size) -/* IRO Array */ -static const u32 iro_arr[] = { -0x00000000 ,0x00000000 ,0x00080000 , -0x00003288 ,0x00000088 ,0x00880000 , -0x000058e8 ,0x00000020 ,0x00200000 , -0x00000b00 ,0x00000008 ,0x00040000 , -0x00000a80 ,0x00000008 ,0x00040000 , -0x00000000 ,0x00000008 ,0x00020000 , -0x00000080 ,0x00000008 ,0x00040000 , -0x00000084 ,0x00000008 ,0x00020000 , -0x00005718 ,0x00000004 ,0x00040000 , -0x00004dd0 ,0x00000000 ,0x00780000 , -0x00003e40 ,0x00000000 ,0x00780000 , -0x00004480 ,0x00000000 ,0x00780000 , -0x00003210 ,0x00000000 ,0x00780000 , -0x00003b50 ,0x00000000 ,0x00780000 , -0x00007f58 ,0x00000000 ,0x00780000 , -0x00005f58 ,0x00000000 ,0x00080000 , -0x00007100 ,0x00000000 ,0x00080000 , -0x0000aea0 ,0x00000000 ,0x00080000 , -0x00004398 ,0x00000000 ,0x00080000 , -0x0000a5a0 ,0x00000000 ,0x00080000 , -0x0000bde8 ,0x00000000 ,0x00080000 , -0x00000020 ,0x00000004 ,0x00040000 , -0x000056c8 ,0x00000010 ,0x00100000 , -0x0000c210 ,0x00000030 ,0x00300000 , -0x0000b088 ,0x00000038 ,0x00380000 , -0x00003d20 ,0x00000080 ,0x00400000 , -0x0000bf60 ,0x00000000 ,0x00040000 , -0x00004560 ,0x00040080 ,0x00040000 , -0x000001f8 ,0x00000004 ,0x00040000 , -0x00003d60 ,0x00000080 ,0x00200000 , -0x00008960 ,0x00000040 ,0x00300000 , -0x0000e840 ,0x00000060 ,0x00600000 , -0x00004618 ,0x00000080 ,0x00380000 , -0x00010738 ,0x000000c0 ,0x00c00000 , -0x000001f8 ,0x00000002 ,0x00020000 , -0x0000a2a0 ,0x00000000 ,0x01080000 , -0x0000a3a8 ,0x00000008 ,0x00080000 , -0x000001c0 ,0x00000008 ,0x00080000 , -0x000001f8 ,0x00000008 ,0x00080000 , -0x00000ac0 ,0x00000008 ,0x00080000 , -0x00002578 ,0x00000008 ,0x00080000 , -0x000024f8 ,0x00000008 ,0x00080000 , -0x00000280 ,0x00000008 ,0x00080000 , -0x00000680 ,0x00080018 ,0x00080000 , -0x00000b78 ,0x00080018 ,0x00020000 , -0x0000c640 ,0x00000050 ,0x003c0000 , -0x00012038 ,0x00000018 ,0x00100000 , -0x00011b00 ,0x00000040 ,0x00180000 , -0x000095d0 ,0x00000050 ,0x00200000 , -0x00008b10 ,0x00000040 ,0x00280000 , -0x00011640 ,0x00000018 ,0x00100000 , -0x0000c828 ,0x00000048 ,0x00380000 , -0x00011710 ,0x00000020 ,0x00200000 , -0x00004650 ,0x00000080 ,0x00100000 , -0x00003618 ,0x00000010 ,0x00100000 , -0x0000a968 ,0x00000008 ,0x00010000 , -0x000097a0 ,0x00000008 ,0x00010000 , -0x00011990 ,0x00000008 ,0x00010000 , -0x0000f018 ,0x00000008 ,0x00010000 , -0x00012628 ,0x00000008 ,0x00010000 , -0x00011da8 ,0x00000008 ,0x00010000 , -0x0000aa78 ,0x00000030 ,0x00100000 , -0x0000d768 ,0x00000028 ,0x00280000 , -0x00009a58 ,0x00000018 ,0x00180000 , -0x00009bd8 ,0x00000008 ,0x00080000 , -0x00013a18 ,0x00000008 ,0x00080000 , -0x000126e8 ,0x00000018 ,0x00180000 , -0x0000e608 ,0x00500288 ,0x00100000 , -0x00012970 ,0x00000138 ,0x00280000 , -}; -/* Runtime array offsets */ #define DORQ_REG_PF_MAX_ICID_0_RT_OFFSET 0#define DORQ_REG_PF_MAX_ICID_1_RT_OFFSET 1
drivers/net/ethernet/qlogic/qed/qed_init_ops.c +73 -0
79 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 2/9 net: qed: cleanup global structs declarations
In reply to Alexander LobakinFix several sparse warnings by moving structs declarations into the corresponding header files:
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:2402:32: warning:
symbol 'qed_dcbnl_ops_pass' was not declared. Should it be static?
drivers/net/ethernet/qlogic/qed/qed_ll2.c:2754:26: warning: symbol 'qed_ll2_ops_pass' was not declared. Should it be static?
drivers/net/ethernet/qlogic/qed/qed_ptp.c:449:30: warning: symbol 'qed_ptp_ops_pass' was not declared. Should it be static?
drivers/net/ethernet/qlogic/qed/qed_sriov.c:5265:29: warning:
symbol 'qed_iov_ops_pass' was not declared. Should it be static?
(some of them were declared twice in different header files)
Also make qed_hw_err_type_descr[] const while at it.
--- drivers/net/ethernet/qlogic/qed/qed_dcbx.h | 2 ++ drivers/net/ethernet/qlogic/qed/qed_fcoe.h | 5 ----- drivers/net/ethernet/qlogic/qed/qed_iscsi.h | 4 ---- drivers/net/ethernet/qlogic/qed/qed_l2.c | 12 ++---------- drivers/net/ethernet/qlogic/qed/qed_ll2.h | 2 ++ drivers/net/ethernet/qlogic/qed/qed_main.c | 4 ++-- drivers/net/ethernet/qlogic/qed/qed_ptp.c | 1 + drivers/net/ethernet/qlogic/qed/qed_ptp.h | 9 +++++++++ drivers/net/ethernet/qlogic/qed/qed_sriov.h | 2 ++ 9 files changed, 20 insertions(+), 21 deletions(-) create mode 100644 drivers/net/ethernet/qlogic/qed/qed_ptp.h
drivers/net/ethernet/qlogic/qed/qed_dcbx.h +2 -0
@@ -81,6 +81,8 @@ struct qed_dcbx_mib_meta_data {u32 addr; }; +extern const struct qed_eth_dcbnl_ops qed_dcbnl_ops_pass; +#ifdef CONFIG_DCB int qed_dcbx_get_config_params (struct qed_hwfn *,struct qed_dcbx_set *);
drivers/net/ethernet/qlogic/qed/qed_fcoe.h +0 -5
@@ -45,9 +45,4 @@ static inline void qed_get_protocol_stats_fcoe(struct qed_dev *cdev, }#endif /* CONFIG_QED_FCOE */ -#ifdef CONFIG_QED_LL2 -extern const struct qed_common_ops qed_common_ops_pass; -extern const struct qed_ll2_ops qed_ll2_ops_pass; -#endif -#endif /* _QED_FCOE_H */
drivers/net/ethernet/qlogic/qed/qed_iscsi.h +0 -4
@@ -26,10 +26,6 @@ struct qed_iscsi_info {iscsi_event_cb_t event_cb; }; -#ifdef CONFIG_QED_LL2 -extern const struct qed_ll2_ops qed_ll2_ops_pass; -#endif -#if IS_ENABLED (CONFIG_QED_ISCSI )int qed_iscsi_alloc (struct qed_hwfn *p_hwfn);
drivers/net/ethernet/qlogic/qed/qed_l2.c +2 -10
@@ -24,6 +24,7 @@#include "qed.h" #include <linux/qed/qed_chain.h> #include "qed_cxt.h" +#include "qed_dcbx.h" #include "qed_dev_api.h" #include <linux/qed/qed_eth_if.h> #include "qed_hsi.h"
@@ -31,6 +32,7 @@#include "qed_int.h" #include "qed_l2.h" #include "qed_mcp.h" +#include "qed_ptp.h" #include "qed_reg_addr.h" #include "qed_sp.h" #include "qed_sriov.h"
@@ -2874,16 +2876,6 @@ static int qed_req_bulletin_update_mac(struct qed_dev *cdev, u8 *mac)return 0 ; } -#ifdef CONFIG_QED_SRIOV -extern const struct qed_iov_hv_ops qed_iov_ops_pass; -#endif - -#ifdef CONFIG_DCB -extern const struct qed_eth_dcbnl_ops qed_dcbnl_ops_pass; -#endif - -extern const struct qed_eth_ptp_ops qed_ptp_ops_pass; -static const struct qed_eth_ops qed_eth_ops_pass = { .common = &qed_common_ops_pass, #ifdef CONFIG_QED_SRIOV
drivers/net/ethernet/qlogic/qed/qed_ll2.h +2 -0
@@ -116,6 +116,8 @@ struct qed_ll2_info {struct qed_ll2_cbs cbs; }; +extern const struct qed_ll2_ops qed_ll2_ops_pass; +/** * @brief qed_ll2_acquire_connection - allocate resources, * starts rx & tx (if relevant) queues pair. Provides
drivers/net/ethernet/qlogic/qed/qed_main.c +2 -2
@@ -2451,7 +2451,7 @@ void qed_schedule_recovery_handler(struct qed_hwfn *p_hwfn) ops->schedule_recovery_handler (cookie); } -static char *qed_hw_err_type_descr[] = { +static const char *const qed_hw_err_type_descr[] = { [QED_HW_ERR_FAN_FAIL ] ="Fan Failure" , [QED_HW_ERR_MFW_RESP_FAIL ] ="MFW Response Failure" , [QED_HW_ERR_HW_ATTN ] ="HW Attention" ,
@@ -2466,7 +2466,7 @@ void qed_hw_error_occurred(struct qed_hwfn *p_hwfn, {struct qed_common_cb_ops *ops = p_hwfn->cdev->protocol_ops.common;void *cookie = p_hwfn->cdev->ops_cookie; -char *err_str; +const char *err_str;if (err_type >QED_HW_ERR_LAST ) err_type =QED_HW_ERR_LAST ;
drivers/net/ethernet/qlogic/qed/qed_ptp.c +1 -0
@@ -10,6 +10,7 @@#include "qed_hw.h" #include "qed_l2.h" #include "qed_mcp.h" +#include "qed_ptp.h" #include "qed_reg_addr.h" /* 16 nano second time quantas to wait before making a Drift adjustment */
drivers/net/ethernet/qlogic/qed/qed_ptp.h new file +9 -0
@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ +/* Copyright (c) 2020 Marvell International Ltd. */ + +#ifndef __QED_PTP_H +#define __QED_PTP_H + +extern const struct qed_eth_ptp_ops qed_ptp_ops_pass; + +#endif /* __QED_PTP_H */
drivers/net/ethernet/qlogic/qed/qed_sriov.h +2 -0
@@ -246,6 +246,8 @@ enum qed_iov_wq_flag { QED_IOV_WQ_VF_FORCE_LINK_QUERY_FLAG, }; +extern const struct qed_iov_hv_ops qed_iov_ops_pass; +#ifdef CONFIG_QED_SRIOV /** * @brief Check if given VF ID @vfid is valid
Signature · 1 line
2.25.1
PATCH 3/9 net: qed: correct qed_hw_err_notify() prototype
In reply to Alexander LobakinChange the prototype of qed_hw_err_notify() with the following:
* constify "fmt" argument according to printk() declarations;
* anontate it with __cold attribute to move the function out of the line;
* annotate it with __printf() attribute;
This eliminates W=1+ warning:
drivers/net/ethernet/qlogic/qed/qed_hw.c: In function ‘qed_hw_err_notify’:drivers/net/ethernet/qlogic/qed/qed_hw.c:851:3: warning: function ‘qed_hw_err_notify’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
len = vsnprintf(buf, QED_HW_ERR_MAX_STR_SIZE, fmt, vl); ^~~
as well as saves some code size:
add/remove: 0/0 grow/shrink: 2/4 up/down: 40/-125 (-85)
Function old new delta
qed_dmae_execute_command 1680 1711 +31 qed_spq_post 1104 1113 +9 qed_int_sp_dpc 3554 3545 -9 qed_mcp_cmd_and_union 1896 1876 -20
qed_hw_err_notify 395 352 -43qed_mcp_handle_events 2630 2577 -53
Total: Before=368645, After=368560, chg -0.02%
__printf() will also be helpful with catching bad format strings and arguments.
--- drivers/net/ethernet/qlogic/qed/qed_hw.c | 5 ++--- drivers/net/ethernet/qlogic/qed/qed_hw.h | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_hw.c +2 -3
@@ -812,9 +812,8 @@ int qed_dmae_host2host(struct qed_hwfn *p_hwfn,return rc; } -void qed_hw_err_notify (struct qed_hwfn *p_hwfn, -struct qed_ptt *p_ptt, -enum qed_hw_err_type err_type,char *fmt, ...) +void qed_hw_err_notify (struct qed_hwfn *p_hwfn,struct qed_ptt *p_ptt, +enum qed_hw_err_type err_type,const char *fmt, ...) {char buf[QED_HW_ERR_MAX_STR_SIZE ];va_list vl;
drivers/net/ethernet/qlogic/qed/qed_hw.h +4 -3
@@ -301,7 +301,8 @@ int qed_dmae_sanity(struct qed_hwfn *p_hwfn, * @param fmt - debug data buffer to send to the MFW * @param ... - buffer format args */ -void qed_hw_err_notify (struct qed_hwfn *p_hwfn, -struct qed_ptt *p_ptt, -enum qed_hw_err_type err_type,char *fmt, ...); +void __printf(4, 5) __cold qed_hw_err_notify(struct qed_hwfn *p_hwfn, + struct qed_ptt *p_ptt, + enum qed_hw_err_type err_type, + const char *fmt, ...); #endif
Signature · 1 line
2.25.1
PATCH 4/9 net: qed: address kernel-doc warnings
In reply to Alexander LobakinGet rid of the kernel-doc warnings when building with W=1+ by rewriting the problematic doc comments according to the recommended format and style.
Note that this only fixes problems found in C source files, headers aren't in scope for now.
--- .../ethernet/qlogic/qed/qed_init_fw_funcs.c | 17 ++++--- drivers/net/ethernet/qlogic/qed/qed_int.c | 49 ++++++++++--------- drivers/net/ethernet/qlogic/qed/qed_spq.c | 16 +++--- drivers/net/ethernet/qlogic/qed/qed_sriov.c | 21 ++++---- 4 files changed, 55 insertions(+), 48 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_init_fw_funcs.c +10 -7
@@ -996,14 +996,17 @@ bool qed_send_qm_stop_cmd(struct qed_hwfn *p_hwfn, }while (0 )/** -* @brief qed_dmae_to_grc - is an internal function - writes from host to -* wide-bus registers (split registers are not supported yet) +* qed_dmae_to_grc() - Internal function for writing from host to +* wide-bus registers (split registers are not supported yet). * -* @param p_hwfn - HW device data -* @param p_ptt - ptt window used for writing the registers. -* @param p_data - pointer to source data. -* @param addr - Destination register address. -* @param len_in_dwords - data length in DWARDS (u32) +* @p_hwfn: HW device data. +* @p_ptt: PTT window used for writing the registers. +* @p_data: Pointer to source data. +* @addr: Destination register address. +* @len_in_dwords: Data length in dwords (u32). +* +* Return: Length of the written data in dwords (u32) or -1 on invalid +* input. */ static int qed_dmae_to_grc(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
drivers/net/ethernet/qlogic/qed/qed_int.c +26 -23
86 lines not on this page · raw message
drivers/net/ethernet/qlogic/qed/qed_spq.c +8 -8
@@ -642,18 +642,18 @@ void qed_spq_return_entry(struct qed_hwfn *p_hwfn, struct qed_spq_entry *p_ent) }/** -* @brief qed_spq_add_entry - adds a new entry to the pending -* list. Should be used while lock is being held. +* qed_spq_add_entry() - Add a new entry to the pending list. +* Should be used while lock is being held. * -* Addes an entry to the pending list is there is room (en empty +* @p_hwfn: HW device data. +* @p_ent: An entry to add. +* @priority: Desired priority. +* +* Adds an entry to the pending list is there is room (an empty * element is available in the free_pool), or else places the * entry in the unlimited_pending pool. * -* @param p_hwfn -* @param p_ent -* @param priority -* -* @return int +* Return: zero on success, -EINVAL on invalid @priority. */ static int qed_spq_add_entry(struct qed_hwfn *p_hwfn, struct qed_spq_entry *p_ent,
drivers/net/ethernet/qlogic/qed/qed_sriov.c +11 -10
@@ -823,16 +823,17 @@ static int qed_iov_enable_vf_access(struct qed_hwfn *p_hwfn, }/** -* @brief qed_iov_config_perm_table - configure the permission -* zone table. -* In E4, queue zone permission table size is 320x9. There -* are 320 VF queues for single engine device (256 for dual -* engine device), and each entry has the following format: -* {Valid, VF[7:0]} -* @param p_hwfn -* @param p_ptt -* @param vf -* @param enable +* qed_iov_config_perm_table() - Configure the permission zone table. +* +* @p_hwfn: HW device data. +* @p_ptt: PTT window for writing the registers. +* @vf: VF info data. +* @enable: The actual permision for this VF. +* +* In E4, queue zone permission table size is 320x9. There +* are 320 VF queues for single engine device (256 for dual +* engine device), and each entry has the following format: +* {Valid, VF[7:0]} */ static void qed_iov_config_perm_table(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
Signature · 1 line
2.25.1
PATCH 5/9 net: qed: improve indentation of some parts of code
In reply to Alexander LobakinTo not mix functional and stylistic changes, correct indentation of code that will be modified in the subsequent commits.
--- drivers/net/ethernet/qlogic/qed/qed_cxt.c | 4 +- drivers/net/ethernet/qlogic/qed/qed_debug.c | 5 +- drivers/net/ethernet/qlogic/qed/qed_hsi.h | 194 +++++++++--------- .../ethernet/qlogic/qed/qed_init_fw_funcs.c | 40 ++-- drivers/net/ethernet/qlogic/qed/qed_iscsi.c | 7 +- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 10 +- drivers/net/ethernet/qlogic/qed/qed_roce.c | 7 +- drivers/net/ethernet/qlogic/qed/qed_sp.h | 9 +- drivers/net/ethernet/qlogic/qed/qed_sriov.c | 4 +- 9 files changed, 136 insertions(+), 144 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_cxt.c +2 -2
@@ -73,8 +73,8 @@ union type1_task_context { };struct src_ent { -u8 opaque[56 ]; -u64 next; +u8 opaque[56 ]; +u64 next; };#define CDUT_SEG_ALIGNMET 3/* in 4k chunks */
drivers/net/ethernet/qlogic/qed/qed_debug.c +2 -3
@@ -1122,9 +1122,8 @@ static u32 qed_dump_fw_ver_param(struct qed_hwfn *p_hwfn, dump, "fw-version", fw_ver_str); offset +=qed_dump_str_param (dump_buf + offset, dump,"fw-image" , fw_img_str); - offset +=qed_dump_num_param (dump_buf + offset, - dump, -"fw-timestamp" , fw_info.ver.timestamp); + offset +=qed_dump_num_param (dump_buf + offset, dump,"fw-timestamp" , + fw_info.ver.timestamp);return offset; }
drivers/net/ethernet/qlogic/qed/qed_hsi.h +97 -97
262 lines not on this page · raw message
drivers/net/ethernet/qlogic/qed/qed_init_fw_funcs.c +21 -19
@@ -156,23 +156,26 @@ static u16 task_region_offsets[1][NUM_OF_CONNECTION_TYPES_E4] = { cmd ## _ ## field, \ value) -#define QM_INIT_TX_PQ_MAP (p_hwfn, map, chip, pq_id, vp_pq_id, rl_valid, rl_id, \ - ext_voq, wrr) \ - do { \ - typeof(map) __map; \ - memset(&__map, 0, sizeof(__map)); \ - SET_FIELD(__map.reg, QM_RF_PQ_MAP_ ## chip ## _PQ_VALID, 1); \ - SET_FIELD(__map.reg, QM_RF_PQ_MAP_ ## chip ## _RL_VALID, \ - rl_valid ? 1 : 0);\ - SET_FIELD(__map.reg, QM_RF_PQ_MAP_ ## chip ## _VP_PQ_ID, \ - vp_pq_id); \ - SET_FIELD(__map.reg, QM_RF_PQ_MAP_ ## chip ## _RL_ID, rl_id); \ - SET_FIELD(__map.reg, QM_RF_PQ_MAP_ ## chip ## _VOQ, ext_voq); \ - SET_FIELD(__map.reg, \ - QM_RF_PQ_MAP_ ## chip ## _WRR_WEIGHT_GROUP, wrr); \ - STORE_RT_REG(p_hwfn, QM_REG_TXPQMAP_RT_OFFSET + (pq_id), \ - *((u32 *)&__map)); \ - (map) = __map; \ +#define QM_INIT_TX_PQ_MAP (p_hwfn, map, chip, pq_id, vp_pq_id, rl_valid, \ + rl_id, ext_voq, wrr) \ + do { \ + typeof(map) __map; \ + \ + memset(&__map, 0, sizeof(__map)); \ + \ + SET_FIELD(__map.reg, QM_RF_PQ_MAP_##chip##_PQ_VALID, 1); \ + SET_FIELD(__map.reg, QM_RF_PQ_MAP_##chip##_RL_VALID, \ + !!(rl_valid)); \ + SET_FIELD(__map.reg, QM_RF_PQ_MAP_##chip##_VP_PQ_ID, \ + (vp_pq_id)); \ + SET_FIELD(__map.reg, QM_RF_PQ_MAP_##chip##_RL_ID, (rl_id)); \ + SET_FIELD(__map.reg, QM_RF_PQ_MAP_##chip##_VOQ, (ext_voq)); \ + SET_FIELD(__map.reg, QM_RF_PQ_MAP_##chip##_WRR_WEIGHT_GROUP, \ + (wrr)); \ + \ + STORE_RT_REG((p_hwfn), QM_REG_TXPQMAP_RT_OFFSET + (pq_id), \ + *((u32 *)&__map)); \ + (map) = __map; \ } while (0)#define WRITE_PQ_INFO_TO_RAM 1
@@ -1008,8 +1011,7 @@ bool qed_send_qm_stop_cmd(struct qed_hwfn *p_hwfn,* Return: Length of the written data in dwords (u32) or -1 on invalid * input. */ -static int qed_dmae_to_grc (struct qed_hwfn *p_hwfn, -struct qed_ptt *p_ptt, +static int qed_dmae_to_grc (struct qed_hwfn *p_hwfn,struct qed_ptt *p_ptt,u32 *p_data,u32 addr,u32 len_in_dwords) {struct qed_dmae_params params = {};
drivers/net/ethernet/qlogic/qed/qed_iscsi.c +3 -4
@@ -117,10 +117,9 @@ struct qed_iscsi_conn {u8 abortive_dsconnect; }; -static int -qed_iscsi_async_event (struct qed_hwfn *p_hwfn, -u8 fw_event_code, -u16 echo,union event_ring_data *data,u8 fw_return_code) +static int qed_iscsi_async_event (struct qed_hwfn *p_hwfn,u8 fw_event_code, +u16 echo,union event_ring_data *data, +u8 fw_return_code) {if (p_hwfn->p_iscsi_info->event_cb) {struct qed_iscsi_info *p_iscsi = p_hwfn->p_iscsi_info;
drivers/net/ethernet/qlogic/qed/qed_iwarp.c +4 -6
@@ -59,9 +59,8 @@ struct mpa_v2_hdr {#define QED_IWARP_DEF_KA_TIMEOUT (1200000)/* 20 min */ #define QED_IWARP_DEF_KA_INTERVAL (1000)/* 1 sec */ -static int qed_iwarp_async_event (struct qed_hwfn *p_hwfn, -u8 fw_event_code,u16 echo, -union event_ring_data *data, +static int qed_iwarp_async_event (struct qed_hwfn *p_hwfn,u8 fw_event_code, +u16 echo,union event_ring_data *data,u8 fw_return_code);/* Override devinfo with iWARP specific values */
@@ -3008,9 +3007,8 @@ qed_iwarp_check_ep_ok(struct qed_hwfn *p_hwfn, struct qed_iwarp_ep *ep)return true; } -static int qed_iwarp_async_event (struct qed_hwfn *p_hwfn, -u8 fw_event_code,u16 echo, -union event_ring_data *data, +static int qed_iwarp_async_event (struct qed_hwfn *p_hwfn,u8 fw_event_code, +u16 echo,union event_ring_data *data,u8 fw_return_code) {struct qed_rdma_events events = p_hwfn->p_rdma_info->events;
drivers/net/ethernet/qlogic/qed/qed_roce.c +3 -4
@@ -37,10 +37,9 @@static void qed_roce_free_real_icid (struct qed_hwfn *p_hwfn,u16 icid); -static int -qed_roce_async_event (struct qed_hwfn *p_hwfn, -u8 fw_event_code, -u16 echo,union event_ring_data *data,u8 fw_return_code) +static int qed_roce_async_event (struct qed_hwfn *p_hwfn,u8 fw_event_code, +u16 echo,union event_ring_data *data, +u8 fw_return_code) {struct qed_rdma_events events = p_hwfn->p_rdma_info->events;
drivers/net/ethernet/qlogic/qed/qed_sp.h +3 -6
@@ -154,12 +154,9 @@ struct qed_consq {struct qed_chain chain; }; -typedef int -(*qed_spq_async_comp_cb )(struct qed_hwfn *p_hwfn, -u8 opcode, -u16 echo, -union event_ring_data *data, -u8 fw_return_code); +typedef int (*qed_spq_async_comp_cb )(struct qed_hwfn *p_hwfn,u8 opcode, +u16 echo,union event_ring_data *data, +u8 fw_return_code); int qed_spq_register_async_cb(struct qed_hwfn *p_hwfn,
drivers/net/ethernet/qlogic/qed/qed_sriov.c +1 -3
@@ -4037,9 +4037,7 @@ static void qed_sriov_vfpf_malicious(struct qed_hwfn *p_hwfn, } } -static int qed_sriov_eqe_event (struct qed_hwfn *p_hwfn, -u8 opcode, -__le16 echo, +static int qed_sriov_eqe_event (struct qed_hwfn *p_hwfn,u8 opcode,u16 echo,union event_ring_data *data,u8 fw_return_code) {switch (opcode) {
Signature · 1 line
2.25.1
PATCH 6/9 net: qed: use ptr shortcuts to dedup field accessing in some parts
In reply to Alexander LobakinUse intermediate pointers instead of multiple dereferencing to simplify and beautify parts of code that will be addressed in the next commit.
--- drivers/net/ethernet/qlogic/qed/qed_cxt.c | 5 +- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 18 +++--- drivers/net/ethernet/qlogic/qed/qed_l2.c | 61 ++++++++++--------- drivers/net/ethernet/qlogic/qed/qed_roce.c | 24 +++----- .../net/ethernet/qlogic/qed/qed_sp_commands.c | 24 ++++---- 5 files changed, 68 insertions(+), 64 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_cxt.c +4 -1
@@ -2170,6 +2170,7 @@ qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn, enum qed_cxt_elem_type elem_type, u32 iid) {u32 reg_offset, shadow_line, elem_size, hw_p_size, elems_per_p, line; +struct tdif_task_context *tdif_context;struct qed_ilt_client_cfg *p_cli;struct qed_ilt_cli_blk *p_blk;struct qed_ptt *p_ptt;
@@ -2252,7 +2253,9 @@ qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn,for (elem_i =0 ; elem_i < elems_per_p; elem_i++) { elem = (union type1_task_context *)elem_start; -SET_FIELD (elem->roce_ctx.tdif_context.flags1, + tdif_context = &elem->roce_ctx.tdif_context; + +SET_FIELD (tdif_context->flags1,TDIF_TASK_CONTEXT_REF_TAG_MASK ,0xf ); elem_start +=TYPE1_TASK_CXT_SIZE (p_hwfn); }
drivers/net/ethernet/qlogic/qed/qed_iwarp.c +10 -8
@@ -808,6 +808,7 @@ static int qed_iwarp_mpa_offload(struct qed_hwfn *p_hwfn, struct qed_iwarp_ep *ep) { struct iwarp_mpa_offload_ramrod_data *p_mpa_ramrod; +struct mpa_outgoing_params *common;struct qed_iwarp_info *iwarp_info;struct qed_sp_init_data init_data;dma_addr_t async_output_phys;
@@ -840,16 +841,17 @@ qed_iwarp_mpa_offload(struct qed_hwfn *p_hwfn, struct qed_iwarp_ep *ep)return rc; p_mpa_ramrod = &p_ent->ramrod.iwarp_mpa_offload; + common = &p_mpa_ramrod->common; + out_pdata_phys = ep->ep_buffer_phys + offsetof(struct qed_iwarp_ep_memory , out_pdata); -DMA_REGPAIR_LE (p_mpa_ramrod->common.outgoing_ulp_buffer.addr, - out_pdata_phys); - p_mpa_ramrod->common.outgoing_ulp_buffer.len = - ep->cm_info.private_data_len; - p_mpa_ramrod->common.crc_needed = p_hwfn->p_rdma_info->iwarp.crc_needed; +DMA_REGPAIR_LE (common->outgoing_ulp_buffer.addr, out_pdata_phys); + + common->outgoing_ulp_buffer.len = ep->cm_info.private_data_len; + common->crc_needed = p_hwfn->p_rdma_info->iwarp.crc_needed; - p_mpa_ramrod->common.out_rq.ord = ep->cm_info.ord; - p_mpa_ramrod->common.out_rq.ird = ep->cm_info.ird; + common->out_rq.ord = ep->cm_info.ord; + common->out_rq.ird = ep->cm_info.ird; p_mpa_ramrod->tcp_cid = p_hwfn->hw_info.opaque_fid <<16 | ep->tcp_cid;
@@ -873,7 +875,7 @@ qed_iwarp_mpa_offload(struct qed_hwfn *p_hwfn, struct qed_iwarp_ep *ep) p_mpa_ramrod->stats_counter_id =RESC_START (p_hwfn,QED_RDMA_STATS_QUEUE ) + qp->stats_queue; }else { - p_mpa_ramrod->common.reject =1 ; + common->reject =1 ; } iwarp_info = &p_hwfn->p_rdma_info->iwarp;
drivers/net/ethernet/qlogic/qed/qed_l2.c +31 -30
91 lines not on this page · raw message
drivers/net/ethernet/qlogic/qed/qed_roce.c +10 -14
@@ -42,29 +42,25 @@ static int qed_roce_async_event(struct qed_hwfn *p_hwfn, u8 fw_event_code, u8 fw_return_code) {struct qed_rdma_events events = p_hwfn->p_rdma_info->events; +union rdma_eqe_data *rdata = &data->rdma_data;if (fw_event_code ==ROCE_ASYNC_EVENT_DESTROY_QP_DONE ) { -u16 icid = - (u16 )le32_to_cpu (data->rdma_data.rdma_destroy_qp_data.cid); +u16 icid = (u16 )le32_to_cpu (rdata->rdma_destroy_qp_data.cid);/* icid release in this async event can occur only if the icid * was offloaded to the FW. In case it wasn't offloaded this is * handled in qed_roce_sp_destroy_qp. */ qed_roce_free_real_icid (p_hwfn, icid); - }else { -if (fw_event_code ==ROCE_ASYNC_EVENT_SRQ_EMPTY || - fw_event_code ==ROCE_ASYNC_EVENT_SRQ_LIMIT ) { -u16 srq_id = (u16 )data->rdma_data.async_handle.lo; - - events.affiliated_event (events.context, fw_event_code, - &srq_id); - }else { -union rdma_eqe_data rdata = data->rdma_data; + }else if (fw_event_code ==ROCE_ASYNC_EVENT_SRQ_EMPTY || + fw_event_code ==ROCE_ASYNC_EVENT_SRQ_LIMIT ) { +u16 srq_id = (u16 )rdata->async_handle.lo; - events.affiliated_event (events.context, fw_event_code, - (void *)&rdata.async_handle); - } + events.affiliated_event (events.context, fw_event_code, + &srq_id); + }else { + events.affiliated_event (events.context, fw_event_code, + (void *)&rdata->async_handle); }return 0 ;
drivers/net/ethernet/qlogic/qed/qed_sp_commands.c +13 -11
@@ -300,6 +300,7 @@ int qed_sp_pf_start(struct qed_hwfn *p_hwfn, struct qed_tunnel_info *p_tunn, bool allow_npar_tx_switch) { +struct outer_tag_config_struct *outer_tag_config;struct pf_start_ramrod_data *p_ramrod =NULL ;u16 sb =qed_int_get_sp_sb_id (p_hwfn);u8 sb_index = p_hwfn->p_eq->eq_sb_index;
@@ -336,29 +337,30 @@ int qed_sp_pf_start(struct qed_hwfn *p_hwfn,else p_ramrod->mf_mode =MF_NPAR ; - p_ramrod->outer_tag_config.outer_tag.tci = -cpu_to_le16 (p_hwfn->hw_info.ovlan); + outer_tag_config = &p_ramrod->outer_tag_config; + outer_tag_config->outer_tag.tci =cpu_to_le16 (p_hwfn->hw_info.ovlan); +if (test_bit (QED_MF_8021Q_TAGGING , &p_hwfn->cdev->mf_bits)) { - p_ramrod->outer_tag_config.outer_tag.tpid =ETH_P_8021Q ; + outer_tag_config->outer_tag.tpid =ETH_P_8021Q ; }else if (test_bit (QED_MF_8021AD_TAGGING , &p_hwfn->cdev->mf_bits)) { - p_ramrod->outer_tag_config.outer_tag.tpid =ETH_P_8021AD ; - p_ramrod->outer_tag_config.enable_stag_pri_change =1 ; + outer_tag_config->outer_tag.tpid =ETH_P_8021AD ; + outer_tag_config->enable_stag_pri_change =1 ; } - p_ramrod->outer_tag_config.pri_map_valid =1 ; + outer_tag_config->pri_map_valid =1 ;for (i =0 ; i <QED_MAX_PFC_PRIORITIES ; i++) - p_ramrod->outer_tag_config.inner_to_outer_pri_map[i] = i; + outer_tag_config->inner_to_outer_pri_map[i] = i;/* enable_stag_pri_change should be set if port is in BD mode or, * UFP with Host Control mode. */ if (test_bit (QED_MF_UFP_SPECIFIC , &p_hwfn->cdev->mf_bits)) {if (p_hwfn->ufp_info.pri_type ==QED_UFP_PRI_OS ) - p_ramrod->outer_tag_config.enable_stag_pri_change =1 ; + outer_tag_config->enable_stag_pri_change =1 ;else - p_ramrod->outer_tag_config.enable_stag_pri_change =0 ; + outer_tag_config->enable_stag_pri_change =0 ; - p_ramrod->outer_tag_config.outer_tag.tci |= + outer_tag_config->outer_tag.tci |=cpu_to_le16 (((u16 )p_hwfn->ufp_info.tc <<13 )); }
@@ -406,7 +408,7 @@ int qed_sp_pf_start(struct qed_hwfn *p_hwfn,DP_VERBOSE (p_hwfn,QED_MSG_SPQ ,"Setting event_ring_sb [id %04x index %02x], outer_tag.tci [%d]\n" , - sb, sb_index, p_ramrod->outer_tag_config.outer_tag.tci); + sb, sb_index, outer_tag_config->outer_tag.tci); rc =qed_spq_post (p_hwfn, p_ent,NULL );
Signature · 1 line
2.25.1
PATCH 7/9 net: qed: sanitize BE/LE data processing
In reply to Alexander LobakinCurrent code assumes that both host and device operates in Little Endian in lots of places. While this is true for x86 platform, this doesn't mean we should not care about this.
This commit addresses all parts of the code that were pointed out by sparse checker. All operations with restricted (__be*/__le*) types are now protected with explicit from/to CPU conversions, even if they're noops on common setups.
I'm sure there are more such places, but this implies a deeper code investigation, and is a subject for future works.
--- drivers/net/ethernet/qlogic/qed/qed_cxt.c | 11 +- drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 27 ++- drivers/net/ethernet/qlogic/qed/qed_debug.c | 49 +++-- drivers/net/ethernet/qlogic/qed/qed_fcoe.c | 54 +++--- drivers/net/ethernet/qlogic/qed/qed_hsi.h | 48 ++--- .../ethernet/qlogic/qed/qed_init_fw_funcs.c | 93 ++++----- drivers/net/ethernet/qlogic/qed/qed_int.c | 74 ++++---- drivers/net/ethernet/qlogic/qed/qed_iscsi.c | 43 +++-- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 132 ++++++++----- drivers/net/ethernet/qlogic/qed/qed_l2.c | 22 ++- drivers/net/ethernet/qlogic/qed/qed_ll2.c | 9 +- drivers/net/ethernet/qlogic/qed/qed_main.c | 12 +- drivers/net/ethernet/qlogic/qed/qed_mng_tlv.c | 4 +- drivers/net/ethernet/qlogic/qed/qed_rdma.c | 52 +++--- drivers/net/ethernet/qlogic/qed/qed_rdma.h | 2 +- drivers/net/ethernet/qlogic/qed/qed_roce.c | 176 +++++++----------- drivers/net/ethernet/qlogic/qed/qed_sp.h | 2 +- .../net/ethernet/qlogic/qed/qed_sp_commands.c | 4 +- drivers/net/ethernet/qlogic/qed/qed_sriov.c | 4 +- include/linux/qed/qed_if.h | 15 +- 20 files changed, 434 insertions(+), 399 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_cxt.c +7 -4
@@ -73,8 +73,8 @@ union type1_task_context { };struct src_ent { -u8 opaque[56 ]; -u64 next; +__u8 opaque[56 ]; +__be64 next; };#define CDUT_SEG_ALIGNMET 3/* in 4k chunks */
@@ -2177,6 +2177,7 @@ qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn,dma_addr_t p_phys;u64 ilt_hw_entry;void *p_virt; +u32 flags1;int rc =0 ;switch (elem_type) {
@@ -2255,8 +2256,10 @@ qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn, elem = (union type1_task_context *)elem_start; tdif_context = &elem->roce_ctx.tdif_context; -SET_FIELD (tdif_context->flags1, -TDIF_TASK_CONTEXT_REF_TAG_MASK ,0xf ); + flags1 =le32_to_cpu (tdif_context->flags1); +SET_FIELD (flags1,TDIF_TASK_CONTEXT_REF_TAG_MASK ,0xf ); + tdif_context->flags1 =cpu_to_le32 (flags1); + elem_start +=TYPE1_TASK_CXT_SIZE (p_hwfn); } }
drivers/net/ethernet/qlogic/qed/qed_dcbx.c +13 -14
@@ -547,7 +547,8 @@ qed_dcbx_get_ets_data(struct qed_hwfn *p_hwfn,struct dcbx_ets_feature *p_ets, struct qed_dcbx_params *p_params) { - u32 bw_map[2], tsa_map[2], pri_map; + __be32 bw_map[2], tsa_map[2]; +u32 pri_map;int i; p_params->ets_willing = QED_MFW_GET_FIELD(p_ets->flags,
@@ -573,11 +574,10 @@ qed_dcbx_get_ets_data(struct qed_hwfn *p_hwfn,/* 8 bit tsa and bw data corresponding to each of the 8 TC's are * encoded in a type u32 array of size 2. */ - bw_map[0 ] =be32_to_cpu (p_ets->tc_bw_tbl[0 ]); - bw_map[1 ] =be32_to_cpu (p_ets->tc_bw_tbl[1 ]); - tsa_map[0 ] =be32_to_cpu (p_ets->tc_tsa_tbl[0 ]); - tsa_map[1 ] =be32_to_cpu (p_ets->tc_tsa_tbl[1 ]); +cpu_to_be32_array (bw_map, p_ets->tc_bw_tbl,2 ); +cpu_to_be32_array (tsa_map, p_ets->tc_tsa_tbl,2 ); pri_map = p_ets->pri_tc_tbl[0 ]; +for (i =0 ; i <QED_MAX_PFC_PRIORITIES ; i++) { p_params->ets_tc_bw_tbl[i] = ((u8 *)bw_map)[i]; p_params->ets_tc_tsa_tbl[i] = ((u8 *)tsa_map)[i];
@@ -1054,7 +1054,7 @@ qed_dcbx_set_ets_data(struct qed_hwfn *p_hwfn,struct dcbx_ets_feature *p_ets, struct qed_dcbx_params *p_params) { - u8 *bw_map, *tsa_map; + __be32 bw_map[2], tsa_map[2];u32 val;int i;
@@ -1076,22 +1076,21 @@ qed_dcbx_set_ets_data(struct qed_hwfn *p_hwfn, p_ets->flags &= ~DCBX_ETS_MAX_TCS_MASK ; p_ets->flags |= (u32 )p_params->max_ets_tc <<DCBX_ETS_MAX_TCS_SHIFT ; - bw_map = (u8 *)&p_ets->tc_bw_tbl[0 ]; - tsa_map = (u8 *)&p_ets->tc_tsa_tbl[0 ]; p_ets->pri_tc_tbl[0 ] =0 ; +for (i =0 ; i <QED_MAX_PFC_PRIORITIES ; i++) { - bw_map[i] = p_params->ets_tc_bw_tbl[i]; - tsa_map[i] = p_params->ets_tc_tsa_tbl[i]; + ((u8 *)bw_map)[i] = p_params->ets_tc_bw_tbl[i]; + ((u8 *)tsa_map)[i] = p_params->ets_tc_tsa_tbl[i]; +/* Copy the priority value to the corresponding 4 bits in the * traffic class table. */ val = (((u32 )p_params->ets_pri_tc_tbl[i]) << ((7 - i) *4 )); p_ets->pri_tc_tbl[0 ] |= val; } -for (i =0 ; i <2 ; i++) { - p_ets->tc_bw_tbl[i] =cpu_to_be32 (p_ets->tc_bw_tbl[i]); - p_ets->tc_tsa_tbl[i] =cpu_to_be32 (p_ets->tc_tsa_tbl[i]); - } + +be32_to_cpu_array (p_ets->tc_bw_tbl, bw_map,2 ); +be32_to_cpu_array (p_ets->tc_tsa_tbl, tsa_map,2 ); } static void
drivers/net/ethernet/qlogic/qed/qed_debug.c +29 -20
90 lines not on this page · raw message
drivers/net/ethernet/qlogic/qed/qed_fcoe.c +28 -26
105 lines not on this page · raw message
drivers/net/ethernet/qlogic/qed/qed_hsi.h +24 -24
145 lines not on this page · raw message
drivers/net/ethernet/qlogic/qed/qed_init_fw_funcs.c +51 -42
166 lines not on this page · raw message
drivers/net/ethernet/qlogic/qed/qed_int.c +39 -35
135 lines not on this page · raw message
drivers/net/ethernet/qlogic/qed/qed_iscsi.c +28 -15
81 lines not on this page · raw message
drivers/net/ethernet/qlogic/qed/qed_iwarp.c +82 -50
349 lines not on this page · raw message
drivers/net/ethernet/qlogic/qed/qed_l2.c +13 -9
@@ -345,8 +345,8 @@ int qed_sp_eth_vport_start(struct qed_hwfn *p_hwfn,struct eth_vport_tpa_param *tpa_param;struct qed_spq_entry *p_ent =NULL ;struct qed_sp_init_data init_data; +u16 min_size, rx_mode =0 ;u8 abs_vport_id =0 ; -u16 rx_mode =0 ;int rc; rc =qed_fw_vport (p_hwfn, p_params->vport_id, &abs_vport_id);
@@ -386,10 +386,12 @@ int qed_sp_eth_vport_start(struct qed_hwfn *p_hwfn,switch (p_params->tpa_mode) {case QED_TPA_MODE_GRO : + min_size = p_params->mtu /2 ; + tpa_param->tpa_max_aggs_num =ETH_TPA_MAX_AGGS_NUM ; - tpa_param->tpa_max_size = (u16)-1 ; - tpa_param->tpa_min_size_to_cont = p_params->mtu /2 ; - tpa_param->tpa_min_size_to_start = p_params->mtu /2 ; + tpa_param->tpa_max_size =cpu_to_le16 (U16_MAX ); + tpa_param->tpa_min_size_to_cont =cpu_to_le16 (min_size); + tpa_param->tpa_min_size_to_start =cpu_to_le16 (min_size); tpa_param->tpa_ipv4_en_flg =1 ; tpa_param->tpa_ipv6_en_flg =1 ; tpa_param->tpa_pkt_split_flg =1 ;
@@ -626,9 +628,9 @@ qed_sp_vport_update_sge_tpa(struct qed_hwfn *p_hwfn, tpa->tpa_hdr_data_split_flg = param->tpa_hdr_data_split_flg; tpa->tpa_gro_consistent_flg = param->tpa_gro_consistent_flg; tpa->tpa_max_aggs_num = param->tpa_max_aggs_num; - tpa->tpa_max_size = param->tpa_max_size; - tpa->tpa_min_size_to_start = param->tpa_min_size_to_start; - tpa->tpa_min_size_to_cont = param->tpa_min_size_to_cont; + tpa->tpa_max_size =cpu_to_le16 (param->tpa_max_size); + tpa->tpa_min_size_to_start =cpu_to_le16 (param->tpa_min_size_to_start); + tpa->tpa_min_size_to_cont =cpu_to_le16 (param->tpa_min_size_to_cont); } static void
@@ -2090,7 +2092,8 @@ int qed_get_rxq_coalesce(struct qed_hwfn *p_hwfn,return rc; } - timer_res =GET_FIELD (sb_entry.params,CAU_SB_ENTRY_TIMER_RES0 ); + timer_res =GET_FIELD (le32_to_cpu (sb_entry.params), +CAU_SB_ENTRY_TIMER_RES0 ); address =BAR0_MAP_REG_USDM_RAM +USTORM_ETH_QUEUE_ZONE_OFFSET (p_cid->abs.queue_id);
@@ -2123,7 +2126,8 @@ int qed_get_txq_coalesce(struct qed_hwfn *p_hwfn,return rc; } - timer_res =GET_FIELD (sb_entry.params,CAU_SB_ENTRY_TIMER_RES1 ); + timer_res =GET_FIELD (le32_to_cpu (sb_entry.params), +CAU_SB_ENTRY_TIMER_RES1 ); address =BAR0_MAP_REG_XSDM_RAM +XSTORM_ETH_QUEUE_ZONE_OFFSET (p_cid->abs.queue_id);
drivers/net/ethernet/qlogic/qed/qed_ll2.c +6 -3
@@ -1798,6 +1798,7 @@ qed_ll2_prepare_tx_packet_set_bd(struct qed_hwfn *p_hwfn,enum core_roce_flavor_type roce_flavor;enum core_tx_dest tx_dest;u16 bd_data =0 , frag_idx; +u16 bitfield1; roce_flavor = (pkt->qed_roce_flavor ==QED_LL2_ROCE ) ?CORE_ROCE :CORE_RROCE ;
@@ -1829,9 +1830,11 @@ qed_ll2_prepare_tx_packet_set_bd(struct qed_hwfn *p_hwfn, pkt->remove_stag = true; } -SET_FIELD (start_bd->bitfield1,CORE_TX_BD_L4_HDR_OFFSET_W , -cpu_to_le16 (pkt->l4_hdr_offset_w)); -SET_FIELD (start_bd->bitfield1,CORE_TX_BD_TX_DST , tx_dest); + bitfield1 =le16_to_cpu (start_bd->bitfield1); +SET_FIELD (bitfield1,CORE_TX_BD_L4_HDR_OFFSET_W , pkt->l4_hdr_offset_w); +SET_FIELD (bitfield1,CORE_TX_BD_TX_DST , tx_dest); + start_bd->bitfield1 =cpu_to_le16 (bitfield1); + bd_data |= pkt->bd_flags;SET_FIELD (bd_data,CORE_TX_BD_DATA_START_BD ,0x1 );SET_FIELD (bd_data,CORE_TX_BD_DATA_NBDS , pkt->num_of_bds);
drivers/net/ethernet/qlogic/qed/qed_main.c +5 -7
@@ -1962,8 +1962,7 @@ static u32 qed_nvm_flash_image_access_crc(struct qed_dev *cdev, u32 *crc) {u8 *buf =NULL ; -int rc, j; -u32 val; +int rc;/* Allocate a buffer for holding the nvram image */ buf =kzalloc (nvm_image->length,GFP_KERNEL );
@@ -1981,15 +1980,14 @@ static u32 qed_nvm_flash_image_access_crc(struct qed_dev *cdev,/* Convert the buffer into big-endian format (excluding the * closing 4 bytes of CRC). */ -for (j =0 ; j < nvm_image->length -4 ; j +=4 ) { - val =cpu_to_be32 (*(u32 *)&buf[j]); - *(u32 *)&buf[j] = val; - } +cpu_to_be32_array ((__force __be32 *)buf, (const u32 *)buf, +DIV_ROUND_UP (nvm_image->length -4 ,4 ));/* Calc CRC for the "actual" image buffer, i.e. not including * the last 4 CRC bytes. */ - *crc = (~cpu_to_be32 (crc32 (0xffffffff , buf, nvm_image->length -4 ))); + *crc = ~crc32 (~0U , buf, nvm_image->length -4 ); + *crc = (__force u32 )cpu_to_be32p (crc); out:kfree (buf);
drivers/net/ethernet/qlogic/qed/qed_mng_tlv.c +2 -2
@@ -1276,7 +1276,7 @@ int qed_mfw_process_tlv_req(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)*/ for (offset =0 ; offset < size; offset +=sizeof (u32)) { val =qed_rd (p_hwfn, p_ptt, addr + offset); - val =be32_to_cpu (val); + val =be32_to_cpu ((__force __be32 )val);memcpy (&p_mfw_buf[offset], &val,sizeof (u32)); }
@@ -1325,7 +1325,7 @@ int qed_mfw_process_tlv_req(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)*/ for (offset =0 ; offset < size; offset +=sizeof (u32)) {memcpy (&val, &p_mfw_buf[offset],sizeof (u32)); - val =cpu_to_be32 (val); + val = (__force u32 )cpu_to_be32 (val);qed_wr (p_hwfn, p_ptt, addr + offset, val); }
drivers/net/ethernet/qlogic/qed/qed_rdma.c +23 -29
105 lines not on this page · raw message
drivers/net/ethernet/qlogic/qed/qed_rdma.h +1 -1
@@ -201,7 +201,7 @@ qed_bmap_release_id(struct qed_hwfn *p_hwfn, struct qed_bmap *bmap, u32 id_num);int qed_bmap_test_id (struct qed_hwfn *p_hwfn,struct qed_bmap *bmap,u32 id_num); -void qed_rdma_set_fw_mac (u16 *p_fw_mac,u8 *p_qed_mac); +void qed_rdma_set_fw_mac (__le16 *p_fw_mac,const u8 *p_qed_mac);bool qed_rdma_allocated_qps (struct qed_hwfn *p_hwfn);#endif
drivers/net/ethernet/qlogic/qed/qed_roce.c +71 -105
335 lines not on this page · raw message
drivers/net/ethernet/qlogic/qed/qed_sp.h +1 -1
@@ -155,7 +155,7 @@ struct qed_consq { };typedef int (*qed_spq_async_comp_cb )(struct qed_hwfn *p_hwfn,u8 opcode, -u16 echo,union event_ring_data *data, +__le16 echo,union event_ring_data *data,u8 fw_return_code);int
drivers/net/ethernet/qlogic/qed/qed_sp_commands.c +2 -2
@@ -341,9 +341,9 @@ int qed_sp_pf_start(struct qed_hwfn *p_hwfn, outer_tag_config->outer_tag.tci =cpu_to_le16 (p_hwfn->hw_info.ovlan);if (test_bit (QED_MF_8021Q_TAGGING , &p_hwfn->cdev->mf_bits)) { - outer_tag_config->outer_tag.tpid =ETH_P_8021Q ; + outer_tag_config->outer_tag.tpid =cpu_to_le16 (ETH_P_8021Q ); }else if (test_bit (QED_MF_8021AD_TAGGING , &p_hwfn->cdev->mf_bits)) { - outer_tag_config->outer_tag.tpid =ETH_P_8021AD ; + outer_tag_config->outer_tag.tpid =cpu_to_le16 (ETH_P_8021AD ); outer_tag_config->enable_stag_pri_change =1 ; }
drivers/net/ethernet/qlogic/qed/qed_sriov.c +2 -2
@@ -4005,7 +4005,7 @@ static int qed_sriov_vfpf_msg(struct qed_hwfn *p_hwfn,/* List the physical address of the request so that handler * could later on copy the message from it. */ - p_vf->vf_mbx.pending_req = (((u64 )vf_msg->hi) <<32 ) | vf_msg->lo; + p_vf->vf_mbx.pending_req =HILO_64 (vf_msg->hi, vf_msg->lo);/* Mark the event and schedule the workqueue */ p_vf->vf_mbx.b_pending_msg = true;
@@ -4037,7 +4037,7 @@ static void qed_sriov_vfpf_malicious(struct qed_hwfn *p_hwfn, } } -static int qed_sriov_eqe_event (struct qed_hwfn *p_hwfn,u8 opcode,u16 echo, +static int qed_sriov_eqe_event (struct qed_hwfn *p_hwfn,u8 opcode,__le16 echo,union event_ring_data *data,u8 fw_return_code) {switch (opcode) {
include/linux/qed/qed_if.h +7 -8
@@ -1403,16 +1403,15 @@ static inline void qed_sb_ack(struct qed_sb_info *sb_info, enum igu_int_cmd int_cmd, u8 upd_flg) { -struct igu_prod_cons_update igu_ack = {0 }; +u32 igu_ack; - igu_ack.sb_id_and_flags = - ((sb_info->sb_ack <<IGU_PROD_CONS_UPDATE_SB_INDEX_SHIFT ) | - (upd_flg <<IGU_PROD_CONS_UPDATE_UPDATE_FLAG_SHIFT ) | - (int_cmd <<IGU_PROD_CONS_UPDATE_ENABLE_INT_SHIFT ) | - (IGU_SEG_ACCESS_REG << -IGU_PROD_CONS_UPDATE_SEGMENT_ACCESS_SHIFT )); + igu_ack = ((sb_info->sb_ack <<IGU_PROD_CONS_UPDATE_SB_INDEX_SHIFT ) | + (upd_flg <<IGU_PROD_CONS_UPDATE_UPDATE_FLAG_SHIFT ) | + (int_cmd <<IGU_PROD_CONS_UPDATE_ENABLE_INT_SHIFT ) | + (IGU_SEG_ACCESS_REG << +IGU_PROD_CONS_UPDATE_SEGMENT_ACCESS_SHIFT )); -DIRECT_REG_WR (sb_info->igu_addr, igu_ack.sb_id_and_flags); +DIRECT_REG_WR (sb_info->igu_addr, igu_ack);/* Both segments (interrupts & acks) are written to same place address; * Need to guarantee all commands will be received (in-order) by HW.
Signature · 1 line
2.25.1
PATCH 8/9 net: qede: fix kernel-doc for qede_ptp_adjfreq()
In reply to Alexander LobakinOne of the function arguments was renamed some time ago, but this wasn't reflected in its kernel-doc comment.
Also add the description for return values.
--- drivers/net/ethernet/qlogic/qede/qede_ptp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_ptp.c +5 -5
@@ -28,12 +28,12 @@ struct qede_ptp { };/** -* qede_ptp_adjfreq -* @ptp: the ptp clock structure -* @ppb: parts per billion adjustment from base +* qede_ptp_adjfreq() - Adjust the frequency of the PTP cycle counter. * -* Adjust the frequency of the ptp cycle counter by the -* indicated ppb from the base frequency. +* @info: The PTP clock info structure. +* @ppb: Parts per billion adjustment from base. +* +* Return: Zero on success, negative errno otherwise. */ static int qede_ptp_adjfreq (struct ptp_clock_info *info,s32 ppb) {
Signature · 1 line
2.25.1
PATCH 9/9 net: qede: fix BE vs CPU comparison
In reply to Alexander LobakinFlow Dissector's keys are mostly Network / Big Endian. U{16,32}_MAX are the same in either of byteorders, but let's make sparse happy with wrapping them into noops.
--- drivers/net/ethernet/qlogic/qede/qede_filter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +4 -4
@@ -1764,8 +1764,8 @@ qede_flow_parse_ports(struct qede_dev *edev, struct flow_rule *rule,struct flow_match_ports match;flow_rule_match_ports (rule, &match); -if ((match.key->src && match.mask->src !=U16_MAX ) || - (match.key->dst && match.mask->dst !=U16_MAX )) { +if ((match.key->src && match.mask->src !=htons (U16_MAX )) || + (match.key->dst && match.mask->dst !=htons (U16_MAX ))) {DP_NOTICE (edev,"Do not support ports masks\n" );return -EINVAL ; }
@@ -1817,8 +1817,8 @@ qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule,struct flow_match_ipv4_addrs match;flow_rule_match_ipv4_addrs (rule, &match); -if ((match.key->src && match.mask->src !=U32_MAX ) || - (match.key->dst && match.mask->dst !=U32_MAX )) { +if ((match.key->src && match.mask->src !=htonl (U32_MAX )) || + (match.key->dst && match.mask->dst !=htonl (U32_MAX ))) {DP_NOTICE (edev,"Do not support ipv4 prefix/masks\n" );return -EINVAL ; }
Signature · 1 line
2.25.1
David Miller
maintainerFrom: Alexander Lobakin <[email protected]>
Date: Mon, 6 Jul 2020 18:38:12 +0300
Quoted 5 lines
This set cleans qed/qede build log under W=1 C=1 with GCC 8 and sparse 0.6.2. The only thing left is "context imbalance -- unexpected unlock" in one of the source files, which will be issued later during the refactoring cycles.
Quoted 7 lines
The biggest part is handling the endianness warnings. The current code often just assumes that both host and device operate in LE, which is obviously incorrect (despite the fact that it's true for x86 platforms), and makes sparse {s,m}ad.
The rest of the series is mostly random non-functional fixes here-and-there.
Series applied, thank you.