qlcnic_dcb.c 28.4 KB
Newer Older
1 2 3 4 5 6 7
/*
 * QLogic qlcnic NIC Driver
 * Copyright (c)  2009-2013 QLogic Corporation
 *
 * See LICENSE.qlcnic for copyright and licensing details.
 */

8
#include <linux/types.h>
9 10
#include "qlcnic.h"

11
#define QLC_DCB_NUM_PARAM		3
12 13 14 15 16
#define QLC_DCB_LOCAL_IDX		0
#define QLC_DCB_OPER_IDX		1
#define QLC_DCB_PEER_IDX		2

#define QLC_DCB_GET_MAP(V)		(1 << V)
17

18
#define QLC_DCB_AEN_BIT			0x2
19
#define QLC_DCB_FW_VER			0x2
20
#define QLC_DCB_MAX_TC			0x8
21
#define QLC_DCB_MAX_APP			0x8
22 23
#define QLC_DCB_MAX_PRIO		QLC_DCB_MAX_TC
#define QLC_DCB_MAX_PG			QLC_DCB_MAX_TC
24 25 26 27 28 29 30

#define QLC_DCB_TSA_SUPPORT(V)		(V & 0x1)
#define QLC_DCB_ETS_SUPPORT(V)		((V >> 1) & 0x1)
#define QLC_DCB_VERSION_SUPPORT(V)	((V >> 2) & 0xf)
#define QLC_DCB_MAX_NUM_TC(V)		((V >> 20) & 0xf)
#define QLC_DCB_MAX_NUM_ETS_TC(V)	((V >> 24) & 0xf)
#define QLC_DCB_MAX_NUM_PFC_TC(V)	((V >> 28) & 0xf)
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
#define QLC_DCB_GET_TC_PRIO(X, P)	((X >> (P * 3)) & 0x7)
#define QLC_DCB_GET_PGID_PRIO(X, P)	((X >> (P * 8)) & 0xff)
#define QLC_DCB_GET_BWPER_PG(X, P)	((X >> (P * 8)) & 0xff)
#define QLC_DCB_GET_TSA_PG(X, P)	((X >> (P * 8)) & 0xff)
#define QLC_DCB_GET_PFC_PRIO(X, P)	(((X >> 24) >> P) & 0x1)
#define QLC_DCB_GET_PROTO_ID_APP(X)	((X >> 8) & 0xffff)
#define QLC_DCB_GET_SELECTOR_APP(X)	(X & 0xff)

#define QLC_DCB_LOCAL_PARAM_FWID	0x3
#define QLC_DCB_OPER_PARAM_FWID		0x1
#define QLC_DCB_PEER_PARAM_FWID		0x2

#define QLC_83XX_DCB_GET_NUMAPP(X)	((X >> 2) & 0xf)
#define QLC_83XX_DCB_TSA_VALID(X)	(X & 0x1)
#define QLC_83XX_DCB_PFC_VALID(X)	((X >> 1) & 0x1)
#define QLC_83XX_DCB_GET_PRIOMAP_APP(X)	(X >> 24)

#define QLC_82XX_DCB_GET_NUMAPP(X)	((X >> 12) & 0xf)
#define QLC_82XX_DCB_TSA_VALID(X)	((X >> 4) & 0x1)
#define QLC_82XX_DCB_PFC_VALID(X)	((X >> 5) & 0x1)
#define QLC_82XX_DCB_GET_PRIOVAL_APP(X)	((X >> 24) & 0x7)
#define QLC_82XX_DCB_GET_PRIOMAP_APP(X)	(1 << X)
#define QLC_82XX_DCB_PRIO_TC_MAP	(0x76543210)
54

55 56
static const struct dcbnl_rtnl_ops qlcnic_dcbnl_ops;

57
static void qlcnic_dcb_aen_work(struct work_struct *);
58
static void qlcnic_dcb_data_cee_param_map(struct qlcnic_adapter *);
59

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
static inline void __qlcnic_init_dcbnl_ops(struct qlcnic_dcb *);
static void __qlcnic_dcb_free(struct qlcnic_dcb *);
static int __qlcnic_dcb_attach(struct qlcnic_dcb *);
static int __qlcnic_dcb_query_hw_capability(struct qlcnic_dcb *, char *);
static void __qlcnic_dcb_get_info(struct qlcnic_dcb *);

static int qlcnic_82xx_dcb_get_hw_capability(struct qlcnic_dcb *);
static int qlcnic_82xx_dcb_query_cee_param(struct qlcnic_dcb *, char *, u8);
static int qlcnic_82xx_dcb_get_cee_cfg(struct qlcnic_dcb *);
static void qlcnic_82xx_dcb_aen_handler(struct qlcnic_dcb *, void *);

static int qlcnic_83xx_dcb_get_hw_capability(struct qlcnic_dcb *);
static int qlcnic_83xx_dcb_query_cee_param(struct qlcnic_dcb *, char *, u8);
static int qlcnic_83xx_dcb_get_cee_cfg(struct qlcnic_dcb *);
static int qlcnic_83xx_dcb_register_aen(struct qlcnic_dcb *, bool);
static void qlcnic_83xx_dcb_aen_handler(struct qlcnic_dcb *, void *);
76 77 78 79 80 81 82 83 84 85

struct qlcnic_dcb_capability {
	bool	tsa_capability;
	bool	ets_capability;
	u8	max_num_tc;
	u8	max_ets_tc;
	u8	max_pfc_tc;
	u8	dcb_capability;
};

86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
struct qlcnic_dcb_param {
	u32 hdr_prio_pfc_map[2];
	u32 prio_pg_map[2];
	u32 pg_bw_map[2];
	u32 pg_tsa_map[2];
	u32 app[QLC_DCB_MAX_APP];
};

struct qlcnic_dcb_mbx_params {
	/* 1st local, 2nd operational 3rd remote */
	struct qlcnic_dcb_param type[3];
	u32 prio_tc_map;
};

struct qlcnic_82xx_dcb_param_mbx_le {
	__le32 hdr_prio_pfc_map[2];
	__le32 prio_pg_map[2];
	__le32 pg_bw_map[2];
	__le32 pg_tsa_map[2];
	__le32 app[QLC_DCB_MAX_APP];
};

108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
enum qlcnic_dcb_selector {
	QLC_SELECTOR_DEF = 0x0,
	QLC_SELECTOR_ETHER,
	QLC_SELECTOR_TCP,
	QLC_SELECTOR_UDP,
};

enum qlcnic_dcb_prio_type {
	QLC_PRIO_NONE = 0,
	QLC_PRIO_GROUP,
	QLC_PRIO_LINK,
};

enum qlcnic_dcb_pfc_type {
	QLC_PFC_DISABLED = 0,
	QLC_PFC_FULL,
	QLC_PFC_TX,
	QLC_PFC_RX
};

struct qlcnic_dcb_prio_cfg {
	bool valid;
	enum qlcnic_dcb_pfc_type pfc_type;
};

struct qlcnic_dcb_pg_cfg {
	bool valid;
	u8 total_bw_percent;		/* of Link/ port BW */
	u8 prio_count;
	u8 tsa_type;
};

struct qlcnic_dcb_tc_cfg {
	bool valid;
	struct qlcnic_dcb_prio_cfg prio_cfg[QLC_DCB_MAX_PRIO];
	enum qlcnic_dcb_prio_type prio_type;	/* always prio_link */
	u8 link_percent;			/* % of link bandwidth */
	u8 bwg_percent;				/* % of BWG's bandwidth */
	u8 up_tc_map;
	u8 pgid;
};

struct qlcnic_dcb_app {
	bool valid;
	enum qlcnic_dcb_selector selector;
	u16 protocol;
	u8 priority;
};

struct qlcnic_dcb_cee {
	struct qlcnic_dcb_tc_cfg tc_cfg[QLC_DCB_MAX_TC];
	struct qlcnic_dcb_pg_cfg pg_cfg[QLC_DCB_MAX_PG];
	struct qlcnic_dcb_app app[QLC_DCB_MAX_APP];
	bool tc_param_valid;
	bool pfc_mode_enable;
};

165
struct qlcnic_dcb_cfg {
166 167
	/* 0 - local, 1 - operational, 2 - remote */
	struct qlcnic_dcb_cee type[QLC_DCB_NUM_PARAM];
168 169 170 171 172
	struct qlcnic_dcb_capability capability;
	u32 version;
};

static struct qlcnic_dcb_ops qlcnic_83xx_dcb_ops = {
173
	.init_dcbnl_ops		= __qlcnic_init_dcbnl_ops,
174 175 176 177 178 179
	.free			= __qlcnic_dcb_free,
	.attach			= __qlcnic_dcb_attach,
	.query_hw_capability	= __qlcnic_dcb_query_hw_capability,
	.get_info		= __qlcnic_dcb_get_info,

	.get_hw_capability	= qlcnic_83xx_dcb_get_hw_capability,
180 181
	.query_cee_param	= qlcnic_83xx_dcb_query_cee_param,
	.get_cee_cfg		= qlcnic_83xx_dcb_get_cee_cfg,
182
	.register_aen		= qlcnic_83xx_dcb_register_aen,
183
	.aen_handler		= qlcnic_83xx_dcb_aen_handler,
184 185 186
};

static struct qlcnic_dcb_ops qlcnic_82xx_dcb_ops = {
187
	.init_dcbnl_ops		= __qlcnic_init_dcbnl_ops,
188 189 190 191 192 193
	.free			= __qlcnic_dcb_free,
	.attach			= __qlcnic_dcb_attach,
	.query_hw_capability	= __qlcnic_dcb_query_hw_capability,
	.get_info		= __qlcnic_dcb_get_info,

	.get_hw_capability	= qlcnic_82xx_dcb_get_hw_capability,
194 195
	.query_cee_param	= qlcnic_82xx_dcb_query_cee_param,
	.get_cee_cfg		= qlcnic_82xx_dcb_get_cee_cfg,
196
	.aen_handler		= qlcnic_82xx_dcb_aen_handler,
197 198
};

199 200 201 202 203 204 205 206
static u8 qlcnic_dcb_get_num_app(struct qlcnic_adapter *adapter, u32 val)
{
	if (qlcnic_82xx_check(adapter))
		return QLC_82XX_DCB_GET_NUMAPP(val);
	else
		return QLC_83XX_DCB_GET_NUMAPP(val);
}

207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
static inline u8 qlcnic_dcb_pfc_hdr_valid(struct qlcnic_adapter *adapter,
					  u32 val)
{
	if (qlcnic_82xx_check(adapter))
		return QLC_82XX_DCB_PFC_VALID(val);
	else
		return QLC_83XX_DCB_PFC_VALID(val);
}

static inline u8 qlcnic_dcb_tsa_hdr_valid(struct qlcnic_adapter *adapter,
					  u32 val)
{
	if (qlcnic_82xx_check(adapter))
		return QLC_82XX_DCB_TSA_VALID(val);
	else
		return QLC_83XX_DCB_TSA_VALID(val);
}

static inline u8 qlcnic_dcb_get_prio_map_app(struct qlcnic_adapter *adapter,
					     u32 val)
{
	if (qlcnic_82xx_check(adapter))
		return QLC_82XX_DCB_GET_PRIOMAP_APP(val);
	else
		return QLC_83XX_DCB_GET_PRIOMAP_APP(val);
}

static int qlcnic_dcb_prio_count(u8 up_tc_map)
{
	int j;

	for (j = 0; j < QLC_DCB_MAX_TC; j++)
		if (up_tc_map & QLC_DCB_GET_MAP(j))
			break;

	return j;
}

245
static inline void __qlcnic_init_dcbnl_ops(struct qlcnic_dcb *dcb)
246
{
247 248
	if (test_bit(QLCNIC_DCB_STATE, &dcb->state))
		dcb->adapter->netdev->dcbnl_ops = &qlcnic_dcbnl_ops;
249 250
}

251
static void qlcnic_set_dcb_ops(struct qlcnic_adapter *adapter)
252 253 254 255 256 257 258
{
	if (qlcnic_82xx_check(adapter))
		adapter->dcb->ops = &qlcnic_82xx_dcb_ops;
	else if (qlcnic_83xx_check(adapter))
		adapter->dcb->ops = &qlcnic_83xx_dcb_ops;
}

259
int qlcnic_register_dcb(struct qlcnic_adapter *adapter)
260 261 262 263 264 265 266 267
{
	struct qlcnic_dcb *dcb;

	dcb = kzalloc(sizeof(struct qlcnic_dcb), GFP_ATOMIC);
	if (!dcb)
		return -ENOMEM;

	adapter->dcb = dcb;
268
	dcb->adapter = adapter;
269
	qlcnic_set_dcb_ops(adapter);
270
	dcb->state = 0;
271 272 273 274

	return 0;
}

275
static void __qlcnic_dcb_free(struct qlcnic_dcb *dcb)
276
{
277
	struct qlcnic_adapter *adapter;
278 279 280 281

	if (!dcb)
		return;

282 283
	adapter = dcb->adapter;
	qlcnic_dcb_register_aen(dcb, 0);
284

285
	while (test_bit(QLCNIC_DCB_AEN_MODE, &dcb->state))
286 287 288 289 290 291 292 293 294
		usleep_range(10000, 11000);

	cancel_delayed_work_sync(&dcb->aen_work);

	if (dcb->wq) {
		destroy_workqueue(dcb->wq);
		dcb->wq = NULL;
	}

295 296
	kfree(dcb->cfg);
	dcb->cfg = NULL;
297 298
	kfree(dcb->param);
	dcb->param = NULL;
299 300 301 302
	kfree(dcb);
	adapter->dcb = NULL;
}

303
static void __qlcnic_dcb_get_info(struct qlcnic_dcb *dcb)
304
{
305 306 307
	qlcnic_dcb_get_hw_capability(dcb);
	qlcnic_dcb_get_cee_cfg(dcb);
	qlcnic_dcb_register_aen(dcb, 1);
308 309
}

310
static int __qlcnic_dcb_attach(struct qlcnic_dcb *dcb)
311
{
312
	int err = 0;
313

314 315 316 317
	INIT_DELAYED_WORK(&dcb->aen_work, qlcnic_dcb_aen_work);

	dcb->wq = create_singlethread_workqueue("qlcnic-dcb");
	if (!dcb->wq) {
318
		dev_err(&dcb->adapter->pdev->dev,
319 320 321 322
			"DCB workqueue allocation failed. DCB will be disabled\n");
		return -1;
	}

323
	dcb->cfg = kzalloc(sizeof(struct qlcnic_dcb_cfg), GFP_ATOMIC);
324 325 326 327
	if (!dcb->cfg) {
		err = -ENOMEM;
		goto out_free_wq;
	}
328

329 330 331 332 333 334
	dcb->param = kzalloc(sizeof(struct qlcnic_dcb_mbx_params), GFP_ATOMIC);
	if (!dcb->param) {
		err = -ENOMEM;
		goto out_free_cfg;
	}

335
	qlcnic_dcb_get_info(dcb);
336 337

	return 0;
338 339 340 341
out_free_cfg:
	kfree(dcb->cfg);
	dcb->cfg = NULL;

342 343 344 345
out_free_wq:
	destroy_workqueue(dcb->wq);
	dcb->wq = NULL;

346
	return err;
347 348
}

349
static int __qlcnic_dcb_query_hw_capability(struct qlcnic_dcb *dcb, char *buf)
350
{
351
	struct qlcnic_adapter *adapter = dcb->adapter;
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
	struct qlcnic_cmd_args cmd;
	u32 mbx_out;
	int err;

	err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DCB_QUERY_CAP);
	if (err)
		return err;

	err = qlcnic_issue_cmd(adapter, &cmd);
	if (err) {
		dev_err(&adapter->pdev->dev,
			"Failed to query DCBX capability, err %d\n", err);
	} else {
		mbx_out = cmd.rsp.arg[1];
		if (buf)
			memcpy(buf, &mbx_out, sizeof(u32));
	}

	qlcnic_free_mbx_args(&cmd);

	return err;
}

375
static int __qlcnic_dcb_get_capability(struct qlcnic_dcb *dcb, u32 *val)
376
{
377
	struct qlcnic_dcb_capability *cap = &dcb->cfg->capability;
378 379 380 381 382
	u32 mbx_out;
	int err;

	memset(cap, 0, sizeof(struct qlcnic_dcb_capability));

383
	err = qlcnic_dcb_query_hw_capability(dcb, (char *)val);
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
	if (err)
		return err;

	mbx_out = *val;
	if (QLC_DCB_TSA_SUPPORT(mbx_out))
		cap->tsa_capability = true;

	if (QLC_DCB_ETS_SUPPORT(mbx_out))
		cap->ets_capability = true;

	cap->max_num_tc = QLC_DCB_MAX_NUM_TC(mbx_out);
	cap->max_ets_tc = QLC_DCB_MAX_NUM_ETS_TC(mbx_out);
	cap->max_pfc_tc = QLC_DCB_MAX_NUM_PFC_TC(mbx_out);

	if (cap->max_num_tc > QLC_DCB_MAX_TC ||
	    cap->max_ets_tc > cap->max_num_tc ||
	    cap->max_pfc_tc > cap->max_num_tc) {
401
		dev_err(&dcb->adapter->pdev->dev, "Invalid DCB configuration\n");
402 403 404 405 406 407
		return -EINVAL;
	}

	return err;
}

408
static int qlcnic_82xx_dcb_get_hw_capability(struct qlcnic_dcb *dcb)
409
{
410
	struct qlcnic_dcb_cfg *cfg = dcb->cfg;
411 412 413 414
	struct qlcnic_dcb_capability *cap;
	u32 mbx_out;
	int err;

415
	err = __qlcnic_dcb_get_capability(dcb, &mbx_out);
416 417 418 419 420 421 422
	if (err)
		return err;

	cap = &cfg->capability;
	cap->dcb_capability = DCB_CAP_DCBX_VER_CEE | DCB_CAP_DCBX_LLD_MANAGED;

	if (cap->dcb_capability && cap->tsa_capability && cap->ets_capability)
423
		set_bit(QLCNIC_DCB_STATE, &dcb->state);
424 425 426 427

	return err;
}

428
static int qlcnic_82xx_dcb_query_cee_param(struct qlcnic_dcb *dcb,
429 430 431
					   char *buf, u8 type)
{
	u16 size = sizeof(struct qlcnic_82xx_dcb_param_mbx_le);
432
	struct qlcnic_adapter *adapter = dcb->adapter;
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
	struct qlcnic_82xx_dcb_param_mbx_le *prsp_le;
	struct device *dev = &adapter->pdev->dev;
	dma_addr_t cardrsp_phys_addr;
	struct qlcnic_dcb_param rsp;
	struct qlcnic_cmd_args cmd;
	u64 phys_addr;
	void *addr;
	int err, i;

	switch (type) {
	case QLC_DCB_LOCAL_PARAM_FWID:
	case QLC_DCB_OPER_PARAM_FWID:
	case QLC_DCB_PEER_PARAM_FWID:
		break;
	default:
		dev_err(dev, "Invalid parameter type %d\n", type);
		return -EINVAL;
	}

452
	addr = dma_alloc_coherent(dev, size, &cardrsp_phys_addr, GFP_KERNEL);
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
	if (addr == NULL)
		return -ENOMEM;

	prsp_le = addr;

	err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DCB_QUERY_PARAM);
	if (err)
		goto out_free_rsp;

	phys_addr = cardrsp_phys_addr;
	cmd.req.arg[1] = size | (type << 16);
	cmd.req.arg[2] = MSD(phys_addr);
	cmd.req.arg[3] = LSD(phys_addr);

	err = qlcnic_issue_cmd(adapter, &cmd);
	if (err) {
		dev_err(dev, "Failed to query DCBX parameter, err %d\n", err);
		goto out;
	}

	memset(&rsp, 0, sizeof(struct qlcnic_dcb_param));
	rsp.hdr_prio_pfc_map[0] = le32_to_cpu(prsp_le->hdr_prio_pfc_map[0]);
	rsp.hdr_prio_pfc_map[1] = le32_to_cpu(prsp_le->hdr_prio_pfc_map[1]);
	rsp.prio_pg_map[0] = le32_to_cpu(prsp_le->prio_pg_map[0]);
	rsp.prio_pg_map[1] = le32_to_cpu(prsp_le->prio_pg_map[1]);
	rsp.pg_bw_map[0] = le32_to_cpu(prsp_le->pg_bw_map[0]);
	rsp.pg_bw_map[1] = le32_to_cpu(prsp_le->pg_bw_map[1]);
	rsp.pg_tsa_map[0] = le32_to_cpu(prsp_le->pg_tsa_map[0]);
	rsp.pg_tsa_map[1] = le32_to_cpu(prsp_le->pg_tsa_map[1]);

	for (i = 0; i < QLC_DCB_MAX_APP; i++)
		rsp.app[i] = le32_to_cpu(prsp_le->app[i]);

	if (buf)
		memcpy(buf, &rsp, size);
out:
	qlcnic_free_mbx_args(&cmd);

out_free_rsp:
492
	dma_free_coherent(dev, size, addr, cardrsp_phys_addr);
493 494 495 496

	return err;
}

497
static int qlcnic_82xx_dcb_get_cee_cfg(struct qlcnic_dcb *dcb)
498 499 500 501
{
	struct qlcnic_dcb_mbx_params *mbx;
	int err;

502
	mbx = dcb->param;
503 504 505
	if (!mbx)
		return 0;

506
	err = qlcnic_dcb_query_cee_param(dcb, (char *)&mbx->type[0],
507 508 509 510
					 QLC_DCB_LOCAL_PARAM_FWID);
	if (err)
		return err;

511
	err = qlcnic_dcb_query_cee_param(dcb, (char *)&mbx->type[1],
512 513 514 515
					 QLC_DCB_OPER_PARAM_FWID);
	if (err)
		return err;

516
	err = qlcnic_dcb_query_cee_param(dcb, (char *)&mbx->type[2],
517 518 519 520 521 522
					 QLC_DCB_PEER_PARAM_FWID);
	if (err)
		return err;

	mbx->prio_tc_map = QLC_82XX_DCB_PRIO_TC_MAP;

523
	qlcnic_dcb_data_cee_param_map(dcb->adapter);
524

525 526 527
	return err;
}

528 529 530 531 532 533
static void qlcnic_dcb_aen_work(struct work_struct *work)
{
	struct qlcnic_dcb *dcb;

	dcb = container_of(work, struct qlcnic_dcb, aen_work.work);

534 535
	qlcnic_dcb_get_cee_cfg(dcb);
	clear_bit(QLCNIC_DCB_AEN_MODE, &dcb->state);
536 537
}

538
static void qlcnic_82xx_dcb_aen_handler(struct qlcnic_dcb *dcb, void *data)
539
{
540
	if (test_and_set_bit(QLCNIC_DCB_AEN_MODE, &dcb->state))
541 542 543 544 545
		return;

	queue_delayed_work(dcb->wq, &dcb->aen_work, 0);
}

546
static int qlcnic_83xx_dcb_get_hw_capability(struct qlcnic_dcb *dcb)
547
{
548
	struct qlcnic_dcb_capability *cap = &dcb->cfg->capability;
549 550 551
	u32 mbx_out;
	int err;

552
	err = __qlcnic_dcb_get_capability(dcb, &mbx_out);
553 554 555 556 557 558 559 560 561 562 563
	if (err)
		return err;

	if (mbx_out & BIT_2)
		cap->dcb_capability = DCB_CAP_DCBX_VER_CEE;
	if (mbx_out & BIT_3)
		cap->dcb_capability |= DCB_CAP_DCBX_VER_IEEE;
	if (cap->dcb_capability)
		cap->dcb_capability |= DCB_CAP_DCBX_LLD_MANAGED;

	if (cap->dcb_capability && cap->tsa_capability && cap->ets_capability)
564
		set_bit(QLCNIC_DCB_STATE, &dcb->state);
565 566 567

	return err;
}
568

569
static int qlcnic_83xx_dcb_query_cee_param(struct qlcnic_dcb *dcb,
570 571
					   char *buf, u8 idx)
{
572
	struct qlcnic_adapter *adapter = dcb->adapter;
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631
	struct qlcnic_dcb_mbx_params mbx_out;
	int err, i, j, k, max_app, size;
	struct qlcnic_dcb_param *each;
	struct qlcnic_cmd_args cmd;
	u32 val;
	char *p;

	size = 0;
	memset(&mbx_out, 0, sizeof(struct qlcnic_dcb_mbx_params));
	memset(buf, 0, sizeof(struct qlcnic_dcb_mbx_params));

	err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_DCB_QUERY_PARAM);
	if (err)
		return err;

	cmd.req.arg[0] |= QLC_DCB_FW_VER << 29;
	err = qlcnic_issue_cmd(adapter, &cmd);
	if (err) {
		dev_err(&adapter->pdev->dev,
			"Failed to query DCBX param, err %d\n", err);
		goto out;
	}

	mbx_out.prio_tc_map = cmd.rsp.arg[1];
	p = memcpy(buf, &mbx_out, sizeof(u32));
	k = 2;
	p += sizeof(u32);

	for (j = 0; j < QLC_DCB_NUM_PARAM; j++) {
		each = &mbx_out.type[j];

		each->hdr_prio_pfc_map[0] = cmd.rsp.arg[k++];
		each->hdr_prio_pfc_map[1] = cmd.rsp.arg[k++];
		each->prio_pg_map[0] = cmd.rsp.arg[k++];
		each->prio_pg_map[1] = cmd.rsp.arg[k++];
		each->pg_bw_map[0] = cmd.rsp.arg[k++];
		each->pg_bw_map[1] = cmd.rsp.arg[k++];
		each->pg_tsa_map[0] = cmd.rsp.arg[k++];
		each->pg_tsa_map[1] = cmd.rsp.arg[k++];
		val = each->hdr_prio_pfc_map[0];

		max_app = qlcnic_dcb_get_num_app(adapter, val);
		for (i = 0; i < max_app; i++)
			each->app[i] = cmd.rsp.arg[i + k];

		size = 16 * sizeof(u32);
		memcpy(p, &each->hdr_prio_pfc_map[0], size);
		p += size;
		if (j == 0)
			k = 18;
		else
			k = 34;
	}
out:
	qlcnic_free_mbx_args(&cmd);

	return err;
}

632
static int qlcnic_83xx_dcb_get_cee_cfg(struct qlcnic_dcb *dcb)
633
{
634
	int err;
635

636
	err = qlcnic_dcb_query_cee_param(dcb, (char *)dcb->param, 0);
637 638 639
	if (err)
		return err;

640
	qlcnic_dcb_data_cee_param_map(dcb->adapter);
641 642

	return err;
643
}
644

645
static int qlcnic_83xx_dcb_register_aen(struct qlcnic_dcb *dcb, bool flag)
646 647
{
	u8 val = (flag ? QLCNIC_CMD_INIT_NIC_FUNC : QLCNIC_CMD_STOP_NIC_FUNC);
648
	struct qlcnic_adapter *adapter = dcb->adapter;
649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667
	struct qlcnic_cmd_args cmd;
	int err;

	err = qlcnic_alloc_mbx_args(&cmd, adapter, val);
	if (err)
		return err;

	cmd.req.arg[1] = QLC_DCB_AEN_BIT;

	err = qlcnic_issue_cmd(adapter, &cmd);
	if (err)
		dev_err(&adapter->pdev->dev, "Failed to %s DCBX AEN, err %d\n",
			(flag ? "register" : "unregister"), err);

	qlcnic_free_mbx_args(&cmd);

	return err;
}

668
static void qlcnic_83xx_dcb_aen_handler(struct qlcnic_dcb *dcb, void *data)
669 670 671
{
	u32 *val = data;

672
	if (test_and_set_bit(QLCNIC_DCB_AEN_MODE, &dcb->state))
673 674 675
		return;

	if (*val & BIT_8)
676
		set_bit(QLCNIC_DCB_STATE, &dcb->state);
677
	else
678
		clear_bit(QLCNIC_DCB_STATE, &dcb->state);
679 680 681

	queue_delayed_work(dcb->wq, &dcb->aen_work, 0);
}
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810

static void qlcnic_dcb_fill_cee_tc_params(struct qlcnic_dcb_mbx_params *mbx,
					  struct qlcnic_dcb_param *each,
					  struct qlcnic_dcb_cee *type)
{
	struct qlcnic_dcb_tc_cfg *tc_cfg;
	u8 i, tc, pgid;

	for (i = 0; i < QLC_DCB_MAX_PRIO; i++) {
		tc = QLC_DCB_GET_TC_PRIO(mbx->prio_tc_map, i);
		tc_cfg = &type->tc_cfg[tc];
		tc_cfg->valid = true;
		tc_cfg->up_tc_map |= QLC_DCB_GET_MAP(i);

		if (QLC_DCB_GET_PFC_PRIO(each->hdr_prio_pfc_map[1], i) &&
		    type->pfc_mode_enable) {
			tc_cfg->prio_cfg[i].valid = true;
			tc_cfg->prio_cfg[i].pfc_type = QLC_PFC_FULL;
		}

		if (i < 4)
			pgid = QLC_DCB_GET_PGID_PRIO(each->prio_pg_map[0], i);
		else
			pgid = QLC_DCB_GET_PGID_PRIO(each->prio_pg_map[1], i);

		tc_cfg->pgid = pgid;

		tc_cfg->prio_type = QLC_PRIO_LINK;
		type->pg_cfg[tc_cfg->pgid].prio_count++;
	}
}

static void qlcnic_dcb_fill_cee_pg_params(struct qlcnic_dcb_param *each,
					  struct qlcnic_dcb_cee *type)
{
	struct qlcnic_dcb_pg_cfg *pg_cfg;
	u8 i, tsa, bw_per;

	for (i = 0; i < QLC_DCB_MAX_PG; i++) {
		pg_cfg = &type->pg_cfg[i];
		pg_cfg->valid = true;

		if (i < 4) {
			bw_per = QLC_DCB_GET_BWPER_PG(each->pg_bw_map[0], i);
			tsa = QLC_DCB_GET_TSA_PG(each->pg_tsa_map[0], i);
		} else {
			bw_per = QLC_DCB_GET_BWPER_PG(each->pg_bw_map[1], i);
			tsa = QLC_DCB_GET_TSA_PG(each->pg_tsa_map[1], i);
		}

		pg_cfg->total_bw_percent = bw_per;
		pg_cfg->tsa_type = tsa;
	}
}

static void
qlcnic_dcb_fill_cee_app_params(struct qlcnic_adapter *adapter, u8 idx,
			       struct qlcnic_dcb_param *each,
			       struct qlcnic_dcb_cee *type)
{
	struct qlcnic_dcb_app *app;
	u8 i, num_app, map, cnt;
	struct dcb_app new_app;

	num_app = qlcnic_dcb_get_num_app(adapter, each->hdr_prio_pfc_map[0]);
	for (i = 0; i < num_app; i++) {
		app = &type->app[i];
		app->valid = true;

		/* Only for CEE (-1) */
		app->selector = QLC_DCB_GET_SELECTOR_APP(each->app[i]) - 1;
		new_app.selector = app->selector;
		app->protocol = QLC_DCB_GET_PROTO_ID_APP(each->app[i]);
		new_app.protocol = app->protocol;
		map = qlcnic_dcb_get_prio_map_app(adapter, each->app[i]);
		cnt = qlcnic_dcb_prio_count(map);

		if (cnt >= QLC_DCB_MAX_TC)
			cnt = 0;

		app->priority = cnt;
		new_app.priority = cnt;

		if (idx == QLC_DCB_OPER_IDX && adapter->netdev->dcbnl_ops)
			dcb_setapp(adapter->netdev, &new_app);
	}
}

static void qlcnic_dcb_map_cee_params(struct qlcnic_adapter *adapter, u8 idx)
{
	struct qlcnic_dcb_mbx_params *mbx = adapter->dcb->param;
	struct qlcnic_dcb_param *each = &mbx->type[idx];
	struct qlcnic_dcb_cfg *cfg = adapter->dcb->cfg;
	struct qlcnic_dcb_cee *type = &cfg->type[idx];

	type->tc_param_valid = false;
	type->pfc_mode_enable = false;
	memset(type->tc_cfg, 0,
	       sizeof(struct qlcnic_dcb_tc_cfg) * QLC_DCB_MAX_TC);
	memset(type->pg_cfg, 0,
	       sizeof(struct qlcnic_dcb_pg_cfg) * QLC_DCB_MAX_TC);

	if (qlcnic_dcb_pfc_hdr_valid(adapter, each->hdr_prio_pfc_map[0]) &&
	    cfg->capability.max_pfc_tc)
		type->pfc_mode_enable = true;

	if (qlcnic_dcb_tsa_hdr_valid(adapter, each->hdr_prio_pfc_map[0]) &&
	    cfg->capability.max_ets_tc)
		type->tc_param_valid = true;

	qlcnic_dcb_fill_cee_tc_params(mbx, each, type);
	qlcnic_dcb_fill_cee_pg_params(each, type);
	qlcnic_dcb_fill_cee_app_params(adapter, idx, each, type);
}

static void qlcnic_dcb_data_cee_param_map(struct qlcnic_adapter *adapter)
{
	int i;

	for (i = 0; i < QLC_DCB_NUM_PARAM; i++)
		qlcnic_dcb_map_cee_params(adapter, i);

	dcbnl_cee_notify(adapter->netdev, RTM_GETDCB, DCB_CMD_CEE_GET, 0, 0);
}

static u8 qlcnic_dcb_get_state(struct net_device *netdev)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);

811
	return test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state);
812 813 814 815
}

static void qlcnic_dcb_get_perm_hw_addr(struct net_device *netdev, u8 *addr)
{
816
	memcpy(addr, netdev->perm_addr, netdev->addr_len);
817 818 819 820 821 822 823 824 825 826 827 828 829 830
}

static void
qlcnic_dcb_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, u8 *prio,
			    u8 *pgid, u8 *bw_per, u8 *up_tc_map)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	struct qlcnic_dcb_tc_cfg *tc_cfg, *temp;
	struct qlcnic_dcb_cee *type;
	u8 i, cnt, pg;

	type = &adapter->dcb->cfg->type[QLC_DCB_OPER_IDX];
	*prio = *pgid = *bw_per = *up_tc_map = 0;

831
	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state) ||
832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866
	    !type->tc_param_valid)
		return;

	if (tc < 0 || (tc > QLC_DCB_MAX_TC))
		return;

	tc_cfg = &type->tc_cfg[tc];
	if (!tc_cfg->valid)
		return;

	*pgid = tc_cfg->pgid;
	*prio = tc_cfg->prio_type;
	*up_tc_map = tc_cfg->up_tc_map;
	pg = *pgid;

	for (i = 0, cnt = 0; i < QLC_DCB_MAX_TC; i++) {
		temp = &type->tc_cfg[i];
		if (temp->valid && (pg == temp->pgid))
			cnt++;
	}

	tc_cfg->bwg_percent = (100 / cnt);
	*bw_per = tc_cfg->bwg_percent;
}

static void qlcnic_dcb_get_pg_bwg_cfg_tx(struct net_device *netdev, int pgid,
					 u8 *bw_pct)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	struct qlcnic_dcb_pg_cfg *pgcfg;
	struct qlcnic_dcb_cee *type;

	*bw_pct = 0;
	type = &adapter->dcb->cfg->type[QLC_DCB_OPER_IDX];

867
	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state) ||
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892
	    !type->tc_param_valid)
		return;

	if (pgid < 0 || pgid > QLC_DCB_MAX_PG)
		return;

	pgcfg = &type->pg_cfg[pgid];
	if (!pgcfg->valid)
		return;

	*bw_pct = pgcfg->total_bw_percent;
}

static void qlcnic_dcb_get_pfc_cfg(struct net_device *netdev, int prio,
				   u8 *setting)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	struct qlcnic_dcb_tc_cfg *tc_cfg;
	u8 val = QLC_DCB_GET_MAP(prio);
	struct qlcnic_dcb_cee *type;
	u8 i;

	*setting = 0;
	type = &adapter->dcb->cfg->type[QLC_DCB_OPER_IDX];

893
	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state) ||
894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911
	    !type->pfc_mode_enable)
		return;

	for (i = 0; i < QLC_DCB_MAX_TC; i++) {
		tc_cfg = &type->tc_cfg[i];
		if (!tc_cfg->valid)
			continue;

		if ((val & tc_cfg->up_tc_map) && (tc_cfg->prio_cfg[prio].valid))
			*setting = tc_cfg->prio_cfg[prio].pfc_type;
	}
}

static u8 qlcnic_dcb_get_capability(struct net_device *netdev, int capid,
				    u8 *cap)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);

912
	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940
		return 0;

	switch (capid) {
	case DCB_CAP_ATTR_PG:
	case DCB_CAP_ATTR_UP2TC:
	case DCB_CAP_ATTR_PFC:
	case DCB_CAP_ATTR_GSP:
		*cap = true;
		break;
	case DCB_CAP_ATTR_PG_TCS:
	case DCB_CAP_ATTR_PFC_TCS:
		*cap = 0x80;	/* 8 priorities for PGs */
		break;
	case DCB_CAP_ATTR_DCBX:
		*cap = adapter->dcb->cfg->capability.dcb_capability;
		break;
	default:
		*cap = false;
	}

	return 0;
}

static int qlcnic_dcb_get_num_tcs(struct net_device *netdev, int attr, u8 *num)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	struct qlcnic_dcb_cfg *cfg = adapter->dcb->cfg;

941
	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963
		return -EINVAL;

	switch (attr) {
	case DCB_NUMTCS_ATTR_PG:
		*num = cfg->capability.max_ets_tc;
		return 0;
	case DCB_NUMTCS_ATTR_PFC:
		*num = cfg->capability.max_pfc_tc;
		return 0;
	default:
		return -EINVAL;
	}
}

static u8 qlcnic_dcb_get_app(struct net_device *netdev, u8 idtype, u16 id)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	struct dcb_app app = {
				.selector = idtype,
				.protocol = id,
			     };

964
	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
965 966 967 968 969 970 971 972 973 974
		return 0;

	return dcb_getapp(netdev, &app);
}

static u8 qlcnic_dcb_get_pfc_state(struct net_device *netdev)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	struct qlcnic_dcb *dcb = adapter->dcb;

975
	if (!test_bit(QLCNIC_DCB_STATE, &dcb->state))
976 977 978 979 980 981 982 983 984 985
		return 0;

	return dcb->cfg->type[QLC_DCB_OPER_IDX].pfc_mode_enable;
}

static u8 qlcnic_dcb_get_dcbx(struct net_device *netdev)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	struct qlcnic_dcb_cfg *cfg = adapter->dcb->cfg;

986
	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
987 988 989 990 991 992 993 994 995 996
		return 0;

	return cfg->capability.dcb_capability;
}

static u8 qlcnic_dcb_get_feat_cfg(struct net_device *netdev, int fid, u8 *flag)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	struct qlcnic_dcb_cee *type;

997
	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
		return 1;

	type = &adapter->dcb->cfg->type[QLC_DCB_OPER_IDX];
	*flag = 0;

	switch (fid) {
	case DCB_FEATCFG_ATTR_PG:
		if (type->tc_param_valid)
			*flag |= DCB_FEATCFG_ENABLE;
		else
			*flag |= DCB_FEATCFG_ERROR;
		break;
	case DCB_FEATCFG_ATTR_PFC:
		if (type->pfc_mode_enable) {
			if (type->tc_cfg[0].prio_cfg[0].pfc_type)
				*flag |= DCB_FEATCFG_ENABLE;
		} else {
			*flag |= DCB_FEATCFG_ERROR;
		}
		break;
	case DCB_FEATCFG_ATTR_APP:
		*flag |= DCB_FEATCFG_ENABLE;
		break;
	default:
		netdev_err(netdev, "Invalid Feature ID %d\n", fid);
		return 1;
	}

	return 0;
}

static inline void
qlcnic_dcb_get_pg_tc_cfg_rx(struct net_device *netdev, int prio, u8 *prio_type,
			    u8 *pgid, u8 *bw_pct, u8 *up_map)
{
	*prio_type = *pgid = *bw_pct = *up_map = 0;
}

static inline void
qlcnic_dcb_get_pg_bwg_cfg_rx(struct net_device *netdev, int pgid, u8 *bw_pct)
{
	*bw_pct = 0;
}

static int qlcnic_dcb_peer_app_info(struct net_device *netdev,
				    struct dcb_peer_app_info *info,
				    u16 *app_count)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	struct qlcnic_dcb_cee *peer;
	int i;

	*app_count = 0;

1052
	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072
		return 0;

	peer = &adapter->dcb->cfg->type[QLC_DCB_PEER_IDX];

	for (i = 0; i < QLC_DCB_MAX_APP; i++) {
		if (peer->app[i].valid)
			(*app_count)++;
	}

	return 0;
}

static int qlcnic_dcb_peer_app_table(struct net_device *netdev,
				     struct dcb_app *table)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	struct qlcnic_dcb_cee *peer;
	struct qlcnic_dcb_app *app;
	int i, j;

1073
	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097
		return 0;

	peer = &adapter->dcb->cfg->type[QLC_DCB_PEER_IDX];

	for (i = 0, j = 0; i < QLC_DCB_MAX_APP; i++) {
		app = &peer->app[i];
		if (!app->valid)
			continue;

		table[j].selector = app->selector;
		table[j].priority = app->priority;
		table[j++].protocol = app->protocol;
	}

	return 0;
}

static int qlcnic_dcb_cee_peer_get_pg(struct net_device *netdev,
				      struct cee_pg *pg)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	struct qlcnic_dcb_cee *peer;
	u8 i, j, k, map;

1098
	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132
		return 0;

	peer = &adapter->dcb->cfg->type[QLC_DCB_PEER_IDX];

	for (i = 0, j = 0; i < QLC_DCB_MAX_PG; i++) {
		if (!peer->pg_cfg[i].valid)
			continue;

		pg->pg_bw[j] = peer->pg_cfg[i].total_bw_percent;

		for (k = 0; k < QLC_DCB_MAX_TC; k++) {
			if (peer->tc_cfg[i].valid &&
			    (peer->tc_cfg[i].pgid == i)) {
				map = peer->tc_cfg[i].up_tc_map;
				pg->prio_pg[j++] = map;
				break;
			}
		}
	}

	return 0;
}

static int qlcnic_dcb_cee_peer_get_pfc(struct net_device *netdev,
				       struct cee_pfc *pfc)
{
	struct qlcnic_adapter *adapter = netdev_priv(netdev);
	struct qlcnic_dcb_cfg *cfg = adapter->dcb->cfg;
	struct qlcnic_dcb_tc_cfg *tc;
	struct qlcnic_dcb_cee *peer;
	u8 i, setting, prio;

	pfc->pfc_en = 0;

1133
	if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173
		return 0;

	peer = &cfg->type[QLC_DCB_PEER_IDX];

	for (i = 0; i < QLC_DCB_MAX_TC; i++) {
		tc = &peer->tc_cfg[i];
		prio = qlcnic_dcb_prio_count(tc->up_tc_map);

		setting = 0;
		qlcnic_dcb_get_pfc_cfg(netdev, prio, &setting);
		if (setting)
			pfc->pfc_en |= QLC_DCB_GET_MAP(i);
	}

	pfc->tcs_supported = cfg->capability.max_pfc_tc;

	return 0;
}

static const struct dcbnl_rtnl_ops qlcnic_dcbnl_ops = {
	.getstate		= qlcnic_dcb_get_state,
	.getpermhwaddr		= qlcnic_dcb_get_perm_hw_addr,
	.getpgtccfgtx		= qlcnic_dcb_get_pg_tc_cfg_tx,
	.getpgbwgcfgtx		= qlcnic_dcb_get_pg_bwg_cfg_tx,
	.getpfccfg		= qlcnic_dcb_get_pfc_cfg,
	.getcap			= qlcnic_dcb_get_capability,
	.getnumtcs		= qlcnic_dcb_get_num_tcs,
	.getapp			= qlcnic_dcb_get_app,
	.getpfcstate		= qlcnic_dcb_get_pfc_state,
	.getdcbx		= qlcnic_dcb_get_dcbx,
	.getfeatcfg		= qlcnic_dcb_get_feat_cfg,

	.getpgtccfgrx		= qlcnic_dcb_get_pg_tc_cfg_rx,
	.getpgbwgcfgrx		= qlcnic_dcb_get_pg_bwg_cfg_rx,

	.peer_getappinfo	= qlcnic_dcb_peer_app_info,
	.peer_getapptable	= qlcnic_dcb_peer_app_table,
	.cee_peer_getpg		= qlcnic_dcb_cee_peer_get_pg,
	.cee_peer_getpfc	= qlcnic_dcb_cee_peer_get_pfc,
};