linux/drivers/net/ethernet/qlogic/qed/qed_dcbx.c

// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
/* QLogic qed NIC Driver
 * Copyright (c) 2015-2017  QLogic Corporation
 * Copyright (c) 2019-2020 Marvell International Ltd.
 */

#include <linux/types.h>
#include <asm/byteorder.h>
#include <linux/bitops.h>
#include <linux/dcbnl.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/string.h>
#include "qed.h"
#include "qed_cxt.h"
#include "qed_dcbx.h"
#include "qed_hsi.h"
#include "qed_sp.h"
#include "qed_sriov.h"
#include "qed_rdma.h"
#ifdef CONFIG_DCB
#include <linux/qed/qed_eth_if.h>
#endif

#define QED_DCBX_MAX_MIB_READ_TRY
#define QED_ETH_TYPE_DEFAULT
#define QED_ETH_TYPE_ROCE
#define QED_UDP_PORT_TYPE_ROCE_V2
#define QED_ETH_TYPE_FCOE
#define QED_TCP_PORT_ISCSI

#define QED_DCBX_INVALID_PRIORITY

/* Get Traffic Class from priority traffic class table, 4 bits represent
 * the traffic class corresponding to the priority.
 */
#define QED_DCBX_PRIO2TC(prio_tc_tbl, prio)

static const struct qed_dcbx_app_metadata qed_dcbx_app_update[] =;

static bool qed_dcbx_app_ethtype(u32 app_info_bitmap)
{}

static bool qed_dcbx_ieee_app_ethtype(u32 app_info_bitmap)
{}

static bool qed_dcbx_app_port(u32 app_info_bitmap)
{}

static bool qed_dcbx_ieee_app_port(u32 app_info_bitmap, u8 type)
{}

static bool qed_dcbx_default_tlv(u32 app_info_bitmap, u16 proto_id, bool ieee)
{}

static bool qed_dcbx_iscsi_tlv(u32 app_info_bitmap, u16 proto_id, bool ieee)
{}

static bool qed_dcbx_fcoe_tlv(u32 app_info_bitmap, u16 proto_id, bool ieee)
{}

static bool qed_dcbx_roce_tlv(u32 app_info_bitmap, u16 proto_id, bool ieee)
{}

static bool qed_dcbx_roce_v2_tlv(u32 app_info_bitmap, u16 proto_id, bool ieee)
{}

static void
qed_dcbx_dp_protocol(struct qed_hwfn *p_hwfn, struct qed_dcbx_results *p_data)
{}

static void
qed_dcbx_set_params(struct qed_dcbx_results *p_data,
		    struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
		    bool app_tlv, bool enable, u8 prio, u8 tc,
		    enum dcbx_protocol_type type,
		    enum qed_pci_personality personality)
{}

/* Update app protocol data and hw_info fields with the TLV info */
static void
qed_dcbx_update_app_info(struct qed_dcbx_results *p_data,
			 struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
			 bool app_tlv, bool enable, u8 prio, u8 tc,
			 enum dcbx_protocol_type type)
{}

static bool
qed_dcbx_get_app_protocol_type(struct qed_hwfn *p_hwfn,
			       u32 app_prio_bitmap,
			       u16 id, enum dcbx_protocol_type *type, bool ieee)
{}

/* Parse app TLV's to update TC information in hw_info structure for
 * reconfiguring QM. Get protocol specific data for PF update ramrod command.
 */
static int
qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
		     struct qed_dcbx_results *p_data,
		     struct dcbx_app_priority_entry *p_tbl,
		     u32 pri_tc_tbl, int count, u8 dcbx_version)
{}

/* Parse app TLV's to update TC information in hw_info structure for
 * reconfiguring QM. Get protocol specific data for PF update ramrod command.
 */
static int
qed_dcbx_process_mib_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
{}

static int
qed_dcbx_copy_mib(struct qed_hwfn *p_hwfn,
		  struct qed_ptt *p_ptt,
		  struct qed_dcbx_mib_meta_data *p_data,
		  enum qed_mib_read_type type)
{}

static void
qed_dcbx_get_priority_info(struct qed_hwfn *p_hwfn,
			   struct qed_dcbx_app_prio *p_prio,
			   struct qed_dcbx_results *p_results)
{}

static void
qed_dcbx_get_app_data(struct qed_hwfn *p_hwfn,
		      struct dcbx_app_priority_feature *p_app,
		      struct dcbx_app_priority_entry *p_tbl,
		      struct qed_dcbx_params *p_params, bool ieee)
{}

static void
qed_dcbx_get_pfc_data(struct qed_hwfn *p_hwfn,
		      u32 pfc, struct qed_dcbx_params *p_params)
{}

static void
qed_dcbx_get_ets_data(struct qed_hwfn *p_hwfn,
		      struct dcbx_ets_feature *p_ets,
		      struct qed_dcbx_params *p_params)
{}

static void
qed_dcbx_get_common_params(struct qed_hwfn *p_hwfn,
			   struct dcbx_app_priority_feature *p_app,
			   struct dcbx_app_priority_entry *p_tbl,
			   struct dcbx_ets_feature *p_ets,
			   u32 pfc, struct qed_dcbx_params *p_params, bool ieee)
{}

static void
qed_dcbx_get_local_params(struct qed_hwfn *p_hwfn, struct qed_dcbx_get *params)
{}

static void
qed_dcbx_get_remote_params(struct qed_hwfn *p_hwfn, struct qed_dcbx_get *params)
{}

static void
qed_dcbx_get_operational_params(struct qed_hwfn *p_hwfn,
				struct qed_dcbx_get *params)
{}

static void
qed_dcbx_get_local_lldp_params(struct qed_hwfn *p_hwfn,
			       struct qed_dcbx_get *params)
{}

static void
qed_dcbx_get_remote_lldp_params(struct qed_hwfn *p_hwfn,
				struct qed_dcbx_get *params)
{}

static int
qed_dcbx_get_params(struct qed_hwfn *p_hwfn, struct qed_dcbx_get *p_params,
		    enum qed_mib_read_type type)
{}

static int
qed_dcbx_read_local_lldp_mib(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
{}

static int
qed_dcbx_read_remote_lldp_mib(struct qed_hwfn *p_hwfn,
			      struct qed_ptt *p_ptt,
			      enum qed_mib_read_type type)
{}

static int
qed_dcbx_read_operational_mib(struct qed_hwfn *p_hwfn,
			      struct qed_ptt *p_ptt,
			      enum qed_mib_read_type type)
{}

static int
qed_dcbx_read_remote_mib(struct qed_hwfn *p_hwfn,
			 struct qed_ptt *p_ptt, enum qed_mib_read_type type)
{}

static int
qed_dcbx_read_local_mib(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
{}

static int qed_dcbx_read_mib(struct qed_hwfn *p_hwfn,
			     struct qed_ptt *p_ptt, enum qed_mib_read_type type)
{}

static void qed_dcbx_aen(struct qed_hwfn *hwfn, u32 mib_type)
{}

/* Read updated MIB.
 * Reconfigure QM and invoke PF update ramrod command if operational MIB
 * change is detected.
 */
int
qed_dcbx_mib_update_event(struct qed_hwfn *p_hwfn,
			  struct qed_ptt *p_ptt, enum qed_mib_read_type type)
{}

int qed_dcbx_info_alloc(struct qed_hwfn *p_hwfn)
{}

void qed_dcbx_info_free(struct qed_hwfn *p_hwfn)
{}

static void qed_dcbx_update_protocol_data(struct protocol_dcb_data *p_data,
					  struct qed_dcbx_results *p_src,
					  enum dcbx_protocol_type type)
{}

/* Set pf update ramrod command params */
void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src,
				   struct pf_update_ramrod_data *p_dest)
{}

u8 qed_dcbx_get_priority_tc(struct qed_hwfn *p_hwfn, u8 pri)
{}

#ifdef CONFIG_DCB
static int qed_dcbx_query_params(struct qed_hwfn *p_hwfn,
				 struct qed_dcbx_get *p_get,
				 enum qed_mib_read_type type)
{}

static void
qed_dcbx_set_pfc_data(struct qed_hwfn *p_hwfn,
		      u32 *pfc, struct qed_dcbx_params *p_params)
{}

static void
qed_dcbx_set_ets_data(struct qed_hwfn *p_hwfn,
		      struct dcbx_ets_feature *p_ets,
		      struct qed_dcbx_params *p_params)
{}

static void
qed_dcbx_set_app_data(struct qed_hwfn *p_hwfn,
		      struct dcbx_app_priority_feature *p_app,
		      struct qed_dcbx_params *p_params, bool ieee)
{}

static void
qed_dcbx_set_local_params(struct qed_hwfn *p_hwfn,
			  struct dcbx_local_params *local_admin,
			  struct qed_dcbx_set *params)
{}

int qed_dcbx_config_params(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
			   struct qed_dcbx_set *params, bool hw_commit)
{}

int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn,
			       struct qed_dcbx_set *params)
{}

static struct qed_dcbx_get *qed_dcbnl_get_dcbx(struct qed_hwfn *hwfn,
					       enum qed_mib_read_type type)
{}

static u8 qed_dcbnl_getstate(struct qed_dev *cdev)
{}

static u8 qed_dcbnl_setstate(struct qed_dev *cdev, u8 state)
{}

static void qed_dcbnl_getpgtccfgtx(struct qed_dev *cdev, int tc, u8 *prio_type,
				   u8 *pgid, u8 *bw_pct, u8 *up_map)
{}

static void qed_dcbnl_getpgbwgcfgtx(struct qed_dev *cdev, int pgid, u8 *bw_pct)
{}

static void qed_dcbnl_getpgtccfgrx(struct qed_dev *cdev, int tc, u8 *prio,
				   u8 *bwg_id, u8 *bw_pct, u8 *up_map)
{}

static void qed_dcbnl_getpgbwgcfgrx(struct qed_dev *cdev,
				    int bwg_id, u8 *bw_pct)
{}

static void qed_dcbnl_getpfccfg(struct qed_dev *cdev,
				int priority, u8 *setting)
{}

static void qed_dcbnl_setpfccfg(struct qed_dev *cdev, int priority, u8 setting)
{}

static u8 qed_dcbnl_getcap(struct qed_dev *cdev, int capid, u8 *cap)
{}

static int qed_dcbnl_getnumtcs(struct qed_dev *cdev, int tcid, u8 *num)
{}

static u8 qed_dcbnl_getpfcstate(struct qed_dev *cdev)
{}

static u8 qed_dcbnl_getdcbx(struct qed_dev *cdev)
{}

static void qed_dcbnl_setpgtccfgtx(struct qed_dev *cdev,
				   int tc,
				   u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map)
{}

static void qed_dcbnl_setpgtccfgrx(struct qed_dev *cdev, int prio,
				   u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map)
{}

static void qed_dcbnl_setpgbwgcfgtx(struct qed_dev *cdev, int pgid, u8 bw_pct)
{}

static void qed_dcbnl_setpgbwgcfgrx(struct qed_dev *cdev, int pgid, u8 bw_pct)
{}

static u8 qed_dcbnl_setall(struct qed_dev *cdev)
{}

static int qed_dcbnl_setnumtcs(struct qed_dev *cdev, int tcid, u8 num)
{}

static void qed_dcbnl_setpfcstate(struct qed_dev *cdev, u8 state)
{}

static int qed_dcbnl_getapp(struct qed_dev *cdev, u8 idtype, u16 idval)
{}

static int qed_dcbnl_setapp(struct qed_dev *cdev,
			    u8 idtype, u16 idval, u8 pri_map)
{}

static u8 qed_dcbnl_setdcbx(struct qed_dev *cdev, u8 mode)
{}

static u8 qed_dcbnl_getfeatcfg(struct qed_dev *cdev, int featid, u8 *flags)
{}

static u8 qed_dcbnl_setfeatcfg(struct qed_dev *cdev, int featid, u8 flags)
{}

static int qed_dcbnl_peer_getappinfo(struct qed_dev *cdev,
				     struct dcb_peer_app_info *info,
				     u16 *app_count)
{}

static int qed_dcbnl_peer_getapptable(struct qed_dev *cdev,
				      struct dcb_app *table)
{}

static int qed_dcbnl_cee_peer_getpfc(struct qed_dev *cdev, struct cee_pfc *pfc)
{}

static int qed_dcbnl_cee_peer_getpg(struct qed_dev *cdev, struct cee_pg *pg)
{}

static int qed_dcbnl_get_ieee_pfc(struct qed_dev *cdev,
				  struct ieee_pfc *pfc, bool remote)
{}

static int qed_dcbnl_ieee_getpfc(struct qed_dev *cdev, struct ieee_pfc *pfc)
{}

static int qed_dcbnl_ieee_setpfc(struct qed_dev *cdev, struct ieee_pfc *pfc)
{}

static int qed_dcbnl_get_ieee_ets(struct qed_dev *cdev,
				  struct ieee_ets *ets, bool remote)
{}

static int qed_dcbnl_ieee_getets(struct qed_dev *cdev, struct ieee_ets *ets)
{}

static int qed_dcbnl_ieee_setets(struct qed_dev *cdev, struct ieee_ets *ets)
{}

static int
qed_dcbnl_ieee_peer_getets(struct qed_dev *cdev, struct ieee_ets *ets)
{}

static int
qed_dcbnl_ieee_peer_getpfc(struct qed_dev *cdev, struct ieee_pfc *pfc)
{}

static int qed_get_sf_ieee_value(u8 selector, u8 *sf_ieee)
{}

static int qed_dcbnl_ieee_getapp(struct qed_dev *cdev, struct dcb_app *app)
{}

static int qed_dcbnl_ieee_setapp(struct qed_dev *cdev, struct dcb_app *app)
{}

const struct qed_eth_dcbnl_ops qed_dcbnl_ops_pass =;

#endif