Skip to content

Commit 2528c38

Browse files
Sudarsana Reddy Kallurudavem330
authored andcommitted
qed: Add support for tlv request processing.
The patch adds driver support for processing TLV requests/repsonses from the mfw and upper driver layers respectively. The implementation reads the requested TLVs from the shared memory, requests the values from upper layer drivers, populates this info (TLVs) shared memory and notifies MFW about the TLV values. Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com> Signed-off-by: Ariel Elior <ariel.elior@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent dd00692 commit 2528c38

6 files changed

Lines changed: 480 additions & 1 deletion

File tree

‎drivers/net/ethernet/qlogic/qed/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ obj-$(CONFIG_QED) := qed.o
33

44
qed-y := qed_cxt.o qed_dev.o qed_hw.o qed_init_fw_funcs.o qed_init_ops.o \
55
qed_int.o qed_main.o qed_mcp.o qed_sp_commands.o qed_spq.o qed_l2.o \
6-
qed_selftest.o qed_dcbx.o qed_debug.o qed_ptp.o
6+
qed_selftest.o qed_dcbx.o qed_debug.o qed_ptp.o qed_mng_tlv.o
77
qed-$(CONFIG_QED_SRIOV) += qed_sriov.o qed_vf.o
88
qed-$(CONFIG_QED_LL2) += qed_ll2.o
99
qed-$(CONFIG_QED_RDMA) += qed_roce.o qed_rdma.o qed_iwarp.o

‎drivers/net/ethernet/qlogic/qed/qed.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ struct qed_eth_cb_ops;
9292
struct qed_dev_info;
9393
union qed_mcp_protocol_stats;
9494
enum qed_mcp_protocol_type;
95+
enum qed_mfw_tlv_type;
96+
union qed_mfw_tlv_data;
9597

9698
/* helpers */
9799
#define QED_MFW_GET_FIELD(name, field) \
@@ -907,4 +909,7 @@ void qed_get_protocol_stats(struct qed_dev *cdev,
907909
int qed_slowpath_irq_req(struct qed_hwfn *hwfn);
908910
void qed_slowpath_irq_sync(struct qed_hwfn *p_hwfn);
909911

912+
int qed_mfw_fill_tlv_data(struct qed_hwfn *hwfn,
913+
enum qed_mfw_tlv_type type,
914+
union qed_mfw_tlv_data *tlv_data);
910915
#endif /* _QED_H */

‎drivers/net/ethernet/qlogic/qed/qed_main.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,3 +2088,9 @@ void qed_get_protocol_stats(struct qed_dev *cdev,
20882088
return;
20892089
}
20902090
}
2091+
2092+
int qed_mfw_fill_tlv_data(struct qed_hwfn *hwfn, enum qed_mfw_tlv_type type,
2093+
union qed_mfw_tlv_data *tlv_buf)
2094+
{
2095+
return -EINVAL;
2096+
}

‎drivers/net/ethernet/qlogic/qed/qed_mcp.h‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,40 @@ enum qed_ov_wol {
213213
QED_OV_WOL_ENABLED
214214
};
215215

216+
enum qed_mfw_tlv_type {
217+
QED_MFW_TLV_GENERIC = 0x1, /* Core driver TLVs */
218+
QED_MFW_TLV_ETH = 0x2, /* L2 driver TLVs */
219+
QED_MFW_TLV_MAX = 0x4,
220+
};
221+
222+
struct qed_mfw_tlv_generic {
223+
#define QED_MFW_TLV_FLAGS_SIZE 2
224+
struct {
225+
u8 ipv4_csum_offload;
226+
u8 lso_supported;
227+
bool b_set;
228+
} flags;
229+
230+
#define QED_MFW_TLV_MAC_COUNT 3
231+
/* First entry for primary MAC, 2 secondary MACs possible */
232+
u8 mac[QED_MFW_TLV_MAC_COUNT][6];
233+
bool mac_set[QED_MFW_TLV_MAC_COUNT];
234+
235+
u64 rx_frames;
236+
bool rx_frames_set;
237+
u64 rx_bytes;
238+
bool rx_bytes_set;
239+
u64 tx_frames;
240+
bool tx_frames_set;
241+
u64 tx_bytes;
242+
bool tx_bytes_set;
243+
};
244+
245+
union qed_mfw_tlv_data {
246+
struct qed_mfw_tlv_generic generic;
247+
struct qed_mfw_tlv_eth eth;
248+
};
249+
216250
/**
217251
* @brief - returns the link params of the hw function
218252
*
@@ -561,6 +595,17 @@ int qed_mcp_bist_nvm_get_image_att(struct qed_hwfn *p_hwfn,
561595
struct bist_nvm_image_att *p_image_att,
562596
u32 image_index);
563597

598+
/**
599+
* @brief - Processes the TLV request from MFW i.e., get the required TLV info
600+
* from the qed client and send it to the MFW.
601+
*
602+
* @param p_hwfn
603+
* @param p_ptt
604+
*
605+
* @param return 0 upon success.
606+
*/
607+
int qed_mfw_process_tlv_req(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
608+
564609
/* Using hwfn number (and not pf_num) is required since in CMT mode,
565610
* same pf_num may be used by two different hwfn
566611
* TODO - this shouldn't really be in .h file, but until all fields
@@ -621,6 +666,14 @@ struct qed_mcp_mb_params {
621666
u32 mcp_param;
622667
};
623668

669+
struct qed_drv_tlv_hdr {
670+
u8 tlv_type;
671+
u8 tlv_length; /* In dwords - not including this header */
672+
u8 tlv_reserved;
673+
#define QED_DRV_TLV_FLAGS_CHANGED 0x01
674+
u8 tlv_flags;
675+
};
676+
624677
/**
625678
* @brief Initialize the interface with the MCP
626679
*

0 commit comments

Comments
 (0)