Linux Audio

Check our new training course

Loading...
v6.8
  1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
  2/* QLogic qed NIC Driver
  3 * Copyright (c) 2015-2017  QLogic Corporation
  4 * Copyright (c) 2019-2020 Marvell International Ltd.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  5 */
  6
  7#ifndef _QED_DCBX_H
  8#define _QED_DCBX_H
  9#include <linux/types.h>
 10#include <linux/slab.h>
 11#include "qed.h"
 12#include "qed_hsi.h"
 13#include "qed_hw.h"
 14#include "qed_mcp.h"
 15#include "qed_reg_addr.h"
 16
 17#define DCBX_CONFIG_MAX_APP_PROTOCOL    4
 18
 19enum qed_mib_read_type {
 20	QED_DCBX_OPERATIONAL_MIB,
 21	QED_DCBX_REMOTE_MIB,
 22	QED_DCBX_LOCAL_MIB,
 23	QED_DCBX_REMOTE_LLDP_MIB,
 24	QED_DCBX_LOCAL_LLDP_MIB
 25};
 26
 27struct qed_dcbx_app_data {
 28	bool enable;		/* DCB enabled */
 29	u8 update;		/* Update indication */
 30	u8 priority;		/* Priority */
 31	u8 tc;			/* Traffic Class */
 32	bool dont_add_vlan0;	/* Do not insert a vlan tag with id 0 */
 33};
 34
 35#define QED_DCBX_VERSION_DISABLED       0
 36#define QED_DCBX_VERSION_IEEE           1
 37#define QED_DCBX_VERSION_CEE            2
 38
 39struct qed_dcbx_set {
 40#define QED_DCBX_OVERRIDE_STATE	        BIT(0)
 41#define QED_DCBX_OVERRIDE_PFC_CFG       BIT(1)
 42#define QED_DCBX_OVERRIDE_ETS_CFG       BIT(2)
 43#define QED_DCBX_OVERRIDE_APP_CFG       BIT(3)
 44#define QED_DCBX_OVERRIDE_DSCP_CFG      BIT(4)
 45	u32 override_flags;
 46	bool enabled;
 47	struct qed_dcbx_admin_params config;
 48	u32 ver_num;
 49};
 50
 51struct qed_dcbx_results {
 52	bool dcbx_enabled;
 53	u8 pf_id;
 54	struct qed_dcbx_app_data arr[DCBX_MAX_PROTOCOL_TYPE];
 55};
 56
 57struct qed_dcbx_app_metadata {
 58	enum dcbx_protocol_type id;
 59	char *name;
 60	enum qed_pci_personality personality;
 61};
 62
 63struct qed_dcbx_info {
 64	struct lldp_status_params_s lldp_remote[LLDP_MAX_LLDP_AGENTS];
 65	struct lldp_config_params_s lldp_local[LLDP_MAX_LLDP_AGENTS];
 66	struct dcbx_local_params local_admin;
 67	struct qed_dcbx_results results;
 68	struct dcbx_mib operational;
 69	struct dcbx_mib remote;
 70	struct qed_dcbx_set set;
 71	struct qed_dcbx_get get;
 72	u8 dcbx_cap;
 73};
 74
 75struct qed_dcbx_mib_meta_data {
 76	struct lldp_config_params_s *lldp_local;
 77	struct lldp_status_params_s *lldp_remote;
 78	struct dcbx_local_params *local_admin;
 79	struct dcbx_mib *mib;
 80	size_t size;
 81	u32 addr;
 82};
 83
 84extern const struct qed_eth_dcbnl_ops qed_dcbnl_ops_pass;
 85
 86#ifdef CONFIG_DCB
 87int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn,
 88			       struct qed_dcbx_set *params);
 89
 90int qed_dcbx_config_params(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
 91			   struct qed_dcbx_set *params, bool hw_commit);
 92#endif
 93
 94/* QED local interface routines */
 95int
 96qed_dcbx_mib_update_event(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
 97			  enum qed_mib_read_type type);
 98
 99int qed_dcbx_info_alloc(struct qed_hwfn *p_hwfn);
100void qed_dcbx_info_free(struct qed_hwfn *p_hwfn);
101void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src,
102				   struct pf_update_ramrod_data *p_dest);
103
104#define QED_DCBX_DEFAULT_TC	0
105
106u8 qed_dcbx_get_priority_tc(struct qed_hwfn *p_hwfn, u8 pri);
107#endif
v5.4
 
  1/* QLogic qed NIC Driver
  2 * Copyright (c) 2015-2017  QLogic Corporation
  3 *
  4 * This software is available to you under a choice of one of two
  5 * licenses.  You may choose to be licensed under the terms of the GNU
  6 * General Public License (GPL) Version 2, available from the file
  7 * COPYING in the main directory of this source tree, or the
  8 * OpenIB.org BSD license below:
  9 *
 10 *     Redistribution and use in source and binary forms, with or
 11 *     without modification, are permitted provided that the following
 12 *     conditions are met:
 13 *
 14 *      - Redistributions of source code must retain the above
 15 *        copyright notice, this list of conditions and the following
 16 *        disclaimer.
 17 *
 18 *      - Redistributions in binary form must reproduce the above
 19 *        copyright notice, this list of conditions and the following
 20 *        disclaimer in the documentation and /or other materials
 21 *        provided with the distribution.
 22 *
 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 30 * SOFTWARE.
 31 */
 32
 33#ifndef _QED_DCBX_H
 34#define _QED_DCBX_H
 35#include <linux/types.h>
 36#include <linux/slab.h>
 37#include "qed.h"
 38#include "qed_hsi.h"
 39#include "qed_hw.h"
 40#include "qed_mcp.h"
 41#include "qed_reg_addr.h"
 42
 43#define DCBX_CONFIG_MAX_APP_PROTOCOL    4
 44
 45enum qed_mib_read_type {
 46	QED_DCBX_OPERATIONAL_MIB,
 47	QED_DCBX_REMOTE_MIB,
 48	QED_DCBX_LOCAL_MIB,
 49	QED_DCBX_REMOTE_LLDP_MIB,
 50	QED_DCBX_LOCAL_LLDP_MIB
 51};
 52
 53struct qed_dcbx_app_data {
 54	bool enable;		/* DCB enabled */
 55	u8 update;		/* Update indication */
 56	u8 priority;		/* Priority */
 57	u8 tc;			/* Traffic Class */
 58	bool dont_add_vlan0;	/* Do not insert a vlan tag with id 0 */
 59};
 60
 61#define QED_DCBX_VERSION_DISABLED       0
 62#define QED_DCBX_VERSION_IEEE           1
 63#define QED_DCBX_VERSION_CEE            2
 64
 65struct qed_dcbx_set {
 66#define QED_DCBX_OVERRIDE_STATE	        BIT(0)
 67#define QED_DCBX_OVERRIDE_PFC_CFG       BIT(1)
 68#define QED_DCBX_OVERRIDE_ETS_CFG       BIT(2)
 69#define QED_DCBX_OVERRIDE_APP_CFG       BIT(3)
 70#define QED_DCBX_OVERRIDE_DSCP_CFG      BIT(4)
 71	u32 override_flags;
 72	bool enabled;
 73	struct qed_dcbx_admin_params config;
 74	u32 ver_num;
 75};
 76
 77struct qed_dcbx_results {
 78	bool dcbx_enabled;
 79	u8 pf_id;
 80	struct qed_dcbx_app_data arr[DCBX_MAX_PROTOCOL_TYPE];
 81};
 82
 83struct qed_dcbx_app_metadata {
 84	enum dcbx_protocol_type id;
 85	char *name;
 86	enum qed_pci_personality personality;
 87};
 88
 89struct qed_dcbx_info {
 90	struct lldp_status_params_s lldp_remote[LLDP_MAX_LLDP_AGENTS];
 91	struct lldp_config_params_s lldp_local[LLDP_MAX_LLDP_AGENTS];
 92	struct dcbx_local_params local_admin;
 93	struct qed_dcbx_results results;
 94	struct dcbx_mib operational;
 95	struct dcbx_mib remote;
 96	struct qed_dcbx_set set;
 97	struct qed_dcbx_get get;
 98	u8 dcbx_cap;
 99};
100
101struct qed_dcbx_mib_meta_data {
102	struct lldp_config_params_s *lldp_local;
103	struct lldp_status_params_s *lldp_remote;
104	struct dcbx_local_params *local_admin;
105	struct dcbx_mib *mib;
106	size_t size;
107	u32 addr;
108};
109
 
 
110#ifdef CONFIG_DCB
111int qed_dcbx_get_config_params(struct qed_hwfn *, struct qed_dcbx_set *);
 
112
113int qed_dcbx_config_params(struct qed_hwfn *,
114			   struct qed_ptt *, struct qed_dcbx_set *, bool);
115#endif
116
117/* QED local interface routines */
118int
119qed_dcbx_mib_update_event(struct qed_hwfn *,
120			  struct qed_ptt *, enum qed_mib_read_type);
121
122int qed_dcbx_info_alloc(struct qed_hwfn *p_hwfn);
123void qed_dcbx_info_free(struct qed_hwfn *p_hwfn);
124void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src,
125				   struct pf_update_ramrod_data *p_dest);
126
127#define QED_DCBX_DEFAULT_TC	0
128
129u8 qed_dcbx_get_priority_tc(struct qed_hwfn *p_hwfn, u8 pri);
130#endif