FreeBSD kernel IXGBE device code
ixgbe_dcb.h
Go to the documentation of this file.
1/******************************************************************************
2 SPDX-License-Identifier: BSD-3-Clause
3
4 Copyright (c) 2001-2020, Intel Corporation
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9
10 1. Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12
13 2. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution.
16
17 3. Neither the name of the Intel Corporation nor the names of its
18 contributors may be used to endorse or promote products derived from
19 this software without specific prior written permission.
20
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 POSSIBILITY OF SUCH DAMAGE.
32
33******************************************************************************/
34/*$FreeBSD$*/
35
36#ifndef _IXGBE_DCB_H_
37#define _IXGBE_DCB_H_
38
39#include "ixgbe_type.h"
40
41/* DCB defines */
42/* DCB credit calculation defines */
43#define IXGBE_DCB_CREDIT_QUANTUM 64
44#define IXGBE_DCB_MAX_CREDIT_REFILL 200 /* 200 * 64B = 12800B */
45#define IXGBE_DCB_MAX_TSO_SIZE (32 * 1024) /* Max TSO pkt size in DCB*/
46#define IXGBE_DCB_MAX_CREDIT (2 * IXGBE_DCB_MAX_CREDIT_REFILL)
47
48/* 513 for 32KB TSO packet */
49#define IXGBE_DCB_MIN_TSO_CREDIT \
50 ((IXGBE_DCB_MAX_TSO_SIZE / IXGBE_DCB_CREDIT_QUANTUM) + 1)
51
52/* DCB configuration defines */
53#define IXGBE_DCB_MAX_USER_PRIORITY 8
54#define IXGBE_DCB_MAX_BW_GROUP 8
55#define IXGBE_DCB_BW_PERCENT 100
56
57#define IXGBE_DCB_TX_CONFIG 0
58#define IXGBE_DCB_RX_CONFIG 1
59
60/* DCB capability defines */
61#define IXGBE_DCB_PG_SUPPORT 0x00000001
62#define IXGBE_DCB_PFC_SUPPORT 0x00000002
63#define IXGBE_DCB_BCN_SUPPORT 0x00000004
64#define IXGBE_DCB_UP2TC_SUPPORT 0x00000008
65#define IXGBE_DCB_GSP_SUPPORT 0x00000010
66
68 u32 capabilities; /* DCB capabilities */
69
70 /* Each bit represents a number of TCs configurable in the hw.
71 * If 8 traffic classes can be configured, the value is 0x80. */
74};
75
80};
81
82/* Traffic class bandwidth allocation per direction */
84 u8 bwg_id; /* Bandwidth Group (BWG) ID */
85 u8 bwg_percent; /* % of BWG's bandwidth */
86 u8 link_percent; /* % of link bandwidth */
87 u8 up_to_tc_bitmap; /* User Priority to Traffic Class mapping */
88 u16 data_credits_refill; /* Credit refill amount in 64B granularity */
89 u16 data_credits_max; /* Max credits for a configured packet buffer
90 * in 64B granularity.*/
91 enum ixgbe_dcb_tsa tsa; /* Link or Group Strict Priority */
92};
93
99};
100
101/* Traffic class configuration */
103 struct ixgbe_dcb_tc_path path[2]; /* One each for Tx/Rx */
104 enum ixgbe_dcb_pfc pfc; /* Class based flow control setting */
105
106 u16 desc_credits_max; /* For Tx Descriptor arbitration */
107 u8 tc; /* Traffic class (TC) */
108};
109
111 /* PBA[0-7] each use 64KB FIFO */
113 /* PBA[0-3] each use 80KB, PBA[4-7] each use 48KB */
116
120};
121
126 u8 bw_percentage[2][IXGBE_DCB_MAX_BW_GROUP]; /* One each for Tx/Rx */
129
131
132 u32 dcb_cfg_version; /* Not used...OS-specific? */
133 u32 link_speed; /* For bandwidth allocation validation purpose */
135};
136
137/* DCB driver APIs */
138
139/* DCB rule checking */
141
142/* DCB credits calculation */
145 struct ixgbe_dcb_config *, u32, u8);
146
147/* DCB PFC */
150
151/* DCB stats */
155
156/* DCB config arbiters */
158 struct ixgbe_dcb_config *);
160 struct ixgbe_dcb_config *);
162 struct ixgbe_dcb_config *);
163
164/* DCB unpack routines */
168void ixgbe_dcb_unpack_bwgid_cee(struct ixgbe_dcb_config *, int, u8 *);
169void ixgbe_dcb_unpack_tsa_cee(struct ixgbe_dcb_config *, int, u8 *);
170void ixgbe_dcb_unpack_map_cee(struct ixgbe_dcb_config *, int, u8 *);
172
173/* DCB initialization */
174s32 ixgbe_dcb_hw_config(struct ixgbe_hw *, u16 *, u16 *, u8 *, u8 *, u8 *);
176#endif /* _IXGBE_DCB_H_ */
s32 ixgbe_dcb_config_rx_arbiter_cee(struct ixgbe_hw *, struct ixgbe_dcb_config *)
Definition: ixgbe_dcb.c:456
s32 ixgbe_dcb_check_config_cee(struct ixgbe_dcb_config *)
Definition: ixgbe_dcb.c:310
void ixgbe_dcb_unpack_max_cee(struct ixgbe_dcb_config *, u16 *)
Definition: ixgbe_dcb.c:235
ixgbe_dcb_pfc
Definition: ixgbe_dcb.h:94
@ ixgbe_dcb_pfc_disabled
Definition: ixgbe_dcb.h:95
@ ixgbe_dcb_pfc_enabled
Definition: ixgbe_dcb.h:96
@ ixgbe_dcb_pfc_enabled_txonly
Definition: ixgbe_dcb.h:97
@ ixgbe_dcb_pfc_enabled_rxonly
Definition: ixgbe_dcb.h:98
s32 ixgbe_dcb_config_tc_stats(struct ixgbe_hw *)
Definition: ixgbe_dcb.c:614
void ixgbe_dcb_unpack_tsa_cee(struct ixgbe_dcb_config *, int, u8 *)
Definition: ixgbe_dcb.c:254
s32 ixgbe_dcb_get_tc_stats(struct ixgbe_hw *, struct ixgbe_hw_stats *, u8)
Definition: ixgbe_dcb.c:399
s32 ixgbe_dcb_config_tx_desc_arbiter_cee(struct ixgbe_hw *, struct ixgbe_dcb_config *)
Definition: ixgbe_dcb.c:497
s32 ixgbe_dcb_config_pfc(struct ixgbe_hw *, u8, u8 *)
Definition: ixgbe_dcb.c:692
ixgbe_dcb_tsa
Definition: ixgbe_dcb.h:76
@ ixgbe_dcb_tsa_group_strict_cee
Definition: ixgbe_dcb.h:78
@ ixgbe_dcb_tsa_strict
Definition: ixgbe_dcb.h:79
@ ixgbe_dcb_tsa_ets
Definition: ixgbe_dcb.h:77
void ixgbe_dcb_unpack_pfc_cee(struct ixgbe_dcb_config *, u8 *, u8 *)
Definition: ixgbe_dcb.c:210
s32 ixgbe_dcb_config_tx_data_arbiter_cee(struct ixgbe_hw *, struct ixgbe_dcb_config *)
Definition: ixgbe_dcb.c:537
s32 ixgbe_dcb_get_pfc_stats(struct ixgbe_hw *, struct ixgbe_hw_stats *, u8)
Definition: ixgbe_dcb.c:428
s32 ixgbe_dcb_config_pfc_cee(struct ixgbe_hw *, struct ixgbe_dcb_config *)
Definition: ixgbe_dcb.c:580
void ixgbe_dcb_unpack_map_cee(struct ixgbe_dcb_config *, int, u8 *)
Definition: ixgbe_dcb.c:287
s32 ixgbe_dcb_hw_config(struct ixgbe_hw *, u16 *, u16 *, u8 *, u8 *, u8 *)
Definition: ixgbe_dcb.c:713
ixgbe_dcb_pba
Definition: ixgbe_dcb.h:110
@ ixgbe_dcb_pba_80_48
Definition: ixgbe_dcb.h:114
@ ixgbe_dcb_pba_equal
Definition: ixgbe_dcb.h:112
void ixgbe_dcb_unpack_bwgid_cee(struct ixgbe_dcb_config *, int, u8 *)
Definition: ixgbe_dcb.c:244
u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *, int, u8)
Definition: ixgbe_dcb.c:264
s32 ixgbe_dcb_calculate_tc_credits(u8 *, u16 *, u16 *, int)
Definition: ixgbe_dcb.c:53
void ixgbe_dcb_unpack_refill_cee(struct ixgbe_dcb_config *, int, u16 *)
Definition: ixgbe_dcb.c:225
s32 ixgbe_dcb_calculate_tc_credits_cee(struct ixgbe_hw *, struct ixgbe_dcb_config *, u32, u8)
Definition: ixgbe_dcb.c:95
#define IXGBE_DCB_MAX_BW_GROUP
Definition: ixgbe_dcb.h:54
s32 ixgbe_dcb_hw_config_cee(struct ixgbe_hw *, struct ixgbe_dcb_config *)
Definition: ixgbe_dcb.c:641
uint8_t u8
Definition: ixgbe_osdep.h:143
uint16_t u16
Definition: ixgbe_osdep.h:145
int32_t s32
Definition: ixgbe_osdep.h:148
uint32_t u32
Definition: ixgbe_osdep.h:147
#define IXGBE_DCB_MAX_TRAFFIC_CLASS
Definition: ixgbe_type.h:709
@ PBA_STRATEGY_WEIGHTED
Definition: ixgbe_type.h:1773
@ PBA_STRATEGY_EQUAL
Definition: ixgbe_type.h:1771
u8 bw_percentage[2][IXGBE_DCB_MAX_BW_GROUP]
Definition: ixgbe_dcb.h:126
struct ixgbe_dcb_tc_config tc_config[IXGBE_DCB_MAX_TRAFFIC_CLASS]
Definition: ixgbe_dcb.h:123
struct ixgbe_dcb_support support
Definition: ixgbe_dcb.h:124
enum ixgbe_dcb_pba rx_pba_cfg
Definition: ixgbe_dcb.h:130
bool round_robin_enable
Definition: ixgbe_dcb.h:128
struct ixgbe_dcb_num_tcs num_tcs
Definition: ixgbe_dcb.h:125
bool pfc_mode_enable
Definition: ixgbe_dcb.h:127
struct ixgbe_dcb_tc_path path[2]
Definition: ixgbe_dcb.h:103
enum ixgbe_dcb_pfc pfc
Definition: ixgbe_dcb.h:104
u16 data_credits_refill
Definition: ixgbe_dcb.h:88
enum ixgbe_dcb_tsa tsa
Definition: ixgbe_dcb.h:91