Lines Matching +full:re +full:- +full:enabled

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2013-2014 Chelsio Communications. All rights reserved.
15 "DCBx-CIN",
16 "DCBx-CEE 1.01",
17 "DCBx-IEEE",
36 struct port_dcb_info *dcb = &pi->dcb; in cxgb4_dcb_state_init()
37 int version_temp = dcb->dcb_version; in cxgb4_dcb_state_init()
40 dcb->state = CXGB4_DCB_STATE_START; in cxgb4_dcb_state_init()
42 dcb->dcb_version = version_temp; in cxgb4_dcb_state_init()
45 __func__, pi->port_id); in cxgb4_dcb_state_init()
51 struct port_dcb_info *dcb = &pi->dcb; in cxgb4_dcb_version_init()
56 dcb->dcb_version = FW_PORT_DCB_VER_AUTO; in cxgb4_dcb_version_init()
62 struct adapter *adap = pi->adapter; in cxgb4_dcb_cleanup_apps()
63 struct port_dcb_info *dcb = &pi->dcb; in cxgb4_dcb_cleanup_apps()
72 if (!dcb->app_priority[i].protocolid) in cxgb4_dcb_cleanup_apps()
75 app.protocol = dcb->app_priority[i].protocolid; in cxgb4_dcb_cleanup_apps()
77 if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) { in cxgb4_dcb_cleanup_apps()
78 app.priority = dcb->app_priority[i].user_prio_map; in cxgb4_dcb_cleanup_apps()
79 app.selector = dcb->app_priority[i].sel_field + 1; in cxgb4_dcb_cleanup_apps()
82 app.selector = !!(dcb->app_priority[i].sel_field); in cxgb4_dcb_cleanup_apps()
87 dev_err(adap->pdev_dev, in cxgb4_dcb_cleanup_apps()
89 dcb_ver_array[dcb->dcb_version], app.selector, in cxgb4_dcb_cleanup_apps()
90 app.protocol, -err); in cxgb4_dcb_cleanup_apps()
112 if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) { in cxgb4_dcb_update_support()
113 if (dcb->supported & DCB_CAP_DCBX_VER_CEE) in cxgb4_dcb_update_support()
114 dcb->supported &= ~DCB_CAP_DCBX_VER_CEE; in cxgb4_dcb_update_support()
115 dcb->supported |= DCB_CAP_DCBX_VER_IEEE; in cxgb4_dcb_update_support()
116 } else if (dcb->dcb_version == FW_PORT_DCB_VER_CEE1D01) { in cxgb4_dcb_update_support()
117 if (dcb->supported & DCB_CAP_DCBX_VER_IEEE) in cxgb4_dcb_update_support()
118 dcb->supported &= ~DCB_CAP_DCBX_VER_IEEE; in cxgb4_dcb_update_support()
119 dcb->supported |= DCB_CAP_DCBX_VER_CEE; in cxgb4_dcb_update_support()
129 struct port_dcb_info *dcb = &pi->dcb; in cxgb4_dcb_state_fsm()
130 struct adapter *adap = pi->adapter; in cxgb4_dcb_state_fsm()
131 enum cxgb4_dcb_state current_state = dcb->state; in cxgb4_dcb_state_fsm()
134 __func__, dcb->state, transition_to, dev->name); in cxgb4_dcb_state_fsm()
140 /* we're going to use Host DCB */ in cxgb4_dcb_state_fsm()
141 dcb->state = CXGB4_DCB_STATE_HOST; in cxgb4_dcb_state_fsm()
142 dcb->supported = CXGB4_DCBX_HOST_SUPPORT; in cxgb4_dcb_state_fsm()
147 /* we're going to use Firmware DCB */ in cxgb4_dcb_state_fsm()
148 dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; in cxgb4_dcb_state_fsm()
149 dcb->supported = DCB_CAP_DCBX_LLD_MANAGED; in cxgb4_dcb_state_fsm()
150 if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) in cxgb4_dcb_state_fsm()
151 dcb->supported |= DCB_CAP_DCBX_VER_IEEE; in cxgb4_dcb_state_fsm()
153 dcb->supported |= DCB_CAP_DCBX_VER_CEE; in cxgb4_dcb_state_fsm()
163 dcb->state = CXGB4_DCB_STATE_FW_ALLSYNCED; in cxgb4_dcb_state_fsm()
185 /* we're alreaady in firmware DCB mode */ in cxgb4_dcb_state_fsm()
190 /* we're already incomplete */ in cxgb4_dcb_state_fsm()
195 dcb->state = CXGB4_DCB_STATE_FW_ALLSYNCED; in cxgb4_dcb_state_fsm()
196 dcb->enabled = 1; in cxgb4_dcb_state_fsm()
210 /* we're alreaady in firmware DCB mode */ in cxgb4_dcb_state_fsm()
221 dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; in cxgb4_dcb_state_fsm()
222 dcb->supported = CXGB4_DCBX_FW_SUPPORT; in cxgb4_dcb_state_fsm()
228 /* we're already all sync'ed in cxgb4_dcb_state_fsm()
232 dcb->enabled = 1; in cxgb4_dcb_state_fsm()
246 /* we're alreaady in Host DCB mode */ in cxgb4_dcb_state_fsm()
262 dev_err(adap->pdev_dev, "cxgb4_dcb_state_fsm: illegal input symbol %d\n", in cxgb4_dcb_state_fsm()
267 dev_err(adap->pdev_dev, "cxgb4_dcb_state_fsm: bad state transition, state = %d, input = %d\n", in cxgb4_dcb_state_fsm()
276 const union fw_port_dcb *fwdcb = &pcmd->u.dcb; in cxgb4_dcb_handle_fw_update()
277 int port = FW_PORT_CMD_PORTID_G(be32_to_cpu(pcmd->op_to_portid)); in cxgb4_dcb_handle_fw_update()
278 struct net_device *dev = adap->port[adap->chan_map[port]]; in cxgb4_dcb_handle_fw_update()
280 struct port_dcb_info *dcb = &pi->dcb; in cxgb4_dcb_handle_fw_update()
281 int dcb_type = pcmd->u.dcb.pgid.type; in cxgb4_dcb_handle_fw_update()
289 ((pcmd->u.dcb.control.all_syncd_pkd & in cxgb4_dcb_handle_fw_update()
294 if (dcb->dcb_version != FW_PORT_DCB_VER_UNKNOWN) { in cxgb4_dcb_handle_fw_update()
297 pcmd->u.dcb.control.dcb_version_to_app_state)); in cxgb4_dcb_handle_fw_update()
300 dcb->dcb_version = dcb_running_version; in cxgb4_dcb_handle_fw_update()
301 dev_warn(adap->pdev_dev, "Interface %s is running %s\n", in cxgb4_dcb_handle_fw_update()
302 dev->name, in cxgb4_dcb_handle_fw_update()
303 dcb_ver_array[dcb->dcb_version]); in cxgb4_dcb_handle_fw_update()
305 dev_warn(adap->pdev_dev, in cxgb4_dcb_handle_fw_update()
307 dcb_ver_array[dcb->dcb_version], in cxgb4_dcb_handle_fw_update()
309 dcb->dcb_version = FW_PORT_DCB_VER_UNKNOWN; in cxgb4_dcb_handle_fw_update()
318 * messages when we either haven't been told whether we're going to be in cxgb4_dcb_handle_fw_update()
320 * that we're doing Host DCB! in cxgb4_dcb_handle_fw_update()
322 if (dcb->state == CXGB4_DCB_STATE_START || in cxgb4_dcb_handle_fw_update()
323 dcb->state == CXGB4_DCB_STATE_HOST) { in cxgb4_dcb_handle_fw_update()
324 dev_err(adap->pdev_dev, "Receiving Firmware DCB messages in State %d\n", in cxgb4_dcb_handle_fw_update()
325 dcb->state); in cxgb4_dcb_handle_fw_update()
333 dcb->pgid = be32_to_cpu(fwdcb->pgid.pgid); in cxgb4_dcb_handle_fw_update()
334 dcb->msgs |= CXGB4_DCB_FW_PGID; in cxgb4_dcb_handle_fw_update()
338 dcb->pg_num_tcs_supported = fwdcb->pgrate.num_tcs_supported; in cxgb4_dcb_handle_fw_update()
339 memcpy(dcb->pgrate, &fwdcb->pgrate.pgrate, in cxgb4_dcb_handle_fw_update()
340 sizeof(dcb->pgrate)); in cxgb4_dcb_handle_fw_update()
341 memcpy(dcb->tsa, &fwdcb->pgrate.tsa, in cxgb4_dcb_handle_fw_update()
342 sizeof(dcb->tsa)); in cxgb4_dcb_handle_fw_update()
343 dcb->msgs |= CXGB4_DCB_FW_PGRATE; in cxgb4_dcb_handle_fw_update()
344 if (dcb->msgs & CXGB4_DCB_FW_PGID) in cxgb4_dcb_handle_fw_update()
349 memcpy(dcb->priorate, &fwdcb->priorate.strict_priorate, in cxgb4_dcb_handle_fw_update()
350 sizeof(dcb->priorate)); in cxgb4_dcb_handle_fw_update()
351 dcb->msgs |= CXGB4_DCB_FW_PRIORATE; in cxgb4_dcb_handle_fw_update()
355 dcb->pfcen = fwdcb->pfc.pfcen; in cxgb4_dcb_handle_fw_update()
356 dcb->pfc_num_tcs_supported = fwdcb->pfc.max_pfc_tcs; in cxgb4_dcb_handle_fw_update()
357 dcb->msgs |= CXGB4_DCB_FW_PFC; in cxgb4_dcb_handle_fw_update()
362 const struct fw_port_app_priority *fwap = &fwdcb->app_priority; in cxgb4_dcb_handle_fw_update()
363 int idx = fwap->idx; in cxgb4_dcb_handle_fw_update()
364 struct app_priority *ap = &dcb->app_priority[idx]; in cxgb4_dcb_handle_fw_update()
367 .protocol = be16_to_cpu(fwap->protocolid), in cxgb4_dcb_handle_fw_update()
374 if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) { in cxgb4_dcb_handle_fw_update()
375 app.selector = (fwap->sel_field + 1); in cxgb4_dcb_handle_fw_update()
376 app.priority = ffs(fwap->user_prio_map) - 1; in cxgb4_dcb_handle_fw_update()
381 app.selector = !!(fwap->sel_field); in cxgb4_dcb_handle_fw_update()
382 app.priority = fwap->user_prio_map; in cxgb4_dcb_handle_fw_update()
387 dev_err(adap->pdev_dev, in cxgb4_dcb_handle_fw_update()
389 app.selector, app.protocol, app.priority, -err); in cxgb4_dcb_handle_fw_update()
391 ap->user_prio_map = fwap->user_prio_map; in cxgb4_dcb_handle_fw_update()
392 ap->sel_field = fwap->sel_field; in cxgb4_dcb_handle_fw_update()
393 ap->protocolid = be16_to_cpu(fwap->protocolid); in cxgb4_dcb_handle_fw_update()
394 dcb->msgs |= CXGB4_DCB_FW_APP_ID; in cxgb4_dcb_handle_fw_update()
399 dev_err(adap->pdev_dev, "Unknown DCB update type received %x\n", in cxgb4_dcb_handle_fw_update()
409 /* Get current DCB enabled/disabled state.
415 return pi->dcb.enabled; in cxgb4_getstate()
418 /* Set DCB enabled/disabled.
420 static u8 cxgb4_setstate(struct net_device *dev, u8 enabled) in cxgb4_setstate() argument
424 /* If DCBx is host-managed, dcb is enabled by outside lldp agents */ in cxgb4_setstate()
425 if (pi->dcb.state == CXGB4_DCB_STATE_HOST) { in cxgb4_setstate()
426 pi->dcb.enabled = enabled; in cxgb4_setstate()
432 if (enabled != (pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED)) in cxgb4_setstate()
444 struct adapter *adap = pi->adapter; in cxgb4_getpgtccfg()
450 INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); in cxgb4_getpgtccfg()
452 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); in cxgb4_getpgtccfg()
455 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_getpgtccfg()
457 dev_err(adap->pdev_dev, "DCB read PGID failed with %d\n", -err); in cxgb4_getpgtccfg()
463 INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); in cxgb4_getpgtccfg()
465 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); in cxgb4_getpgtccfg()
467 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_getpgtccfg()
469 dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", in cxgb4_getpgtccfg()
470 -err); in cxgb4_getpgtccfg()
487 return cxgb4_getpgtccfg(dev, (7 - tc), prio_type, pgid, bw_per, in cxgb4_getpgtccfg_tx()
497 return cxgb4_getpgtccfg(dev, (7 - tc), prio_type, pgid, bw_per, in cxgb4_getpgtccfg_rx()
507 struct adapter *adap = pi->adapter; in cxgb4_setpgtccfg_tx()
508 int fw_tc = 7 - tc; in cxgb4_setpgtccfg_tx()
517 INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); in cxgb4_setpgtccfg_tx()
520 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_setpgtccfg_tx()
522 dev_err(adap->pdev_dev, "DCB read PGID failed with %d\n", -err); in cxgb4_setpgtccfg_tx()
531 INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); in cxgb4_setpgtccfg_tx()
533 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_setpgtccfg_tx()
535 dev_err(adap->pdev_dev, "DCB write PGID failed with %d\n", in cxgb4_setpgtccfg_tx()
536 -err); in cxgb4_setpgtccfg_tx()
542 INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); in cxgb4_setpgtccfg_tx()
545 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_setpgtccfg_tx()
547 dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", in cxgb4_setpgtccfg_tx()
548 -err); in cxgb4_setpgtccfg_tx()
554 INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); in cxgb4_setpgtccfg_tx()
555 if (pi->dcb.state == CXGB4_DCB_STATE_HOST) in cxgb4_setpgtccfg_tx()
558 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_setpgtccfg_tx()
560 dev_err(adap->pdev_dev, "DCB write PGRATE failed with %d\n", in cxgb4_setpgtccfg_tx()
561 -err); in cxgb4_setpgtccfg_tx()
569 struct adapter *adap = pi->adapter; in cxgb4_getpgbwgcfg()
573 INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); in cxgb4_getpgbwgcfg()
575 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); in cxgb4_getpgbwgcfg()
578 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_getpgbwgcfg()
580 dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", in cxgb4_getpgbwgcfg()
581 -err); in cxgb4_getpgbwgcfg()
603 struct adapter *adap = pi->adapter; in cxgb4_setpgbwgcfg_tx()
606 INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); in cxgb4_setpgbwgcfg_tx()
609 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_setpgbwgcfg_tx()
611 dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", in cxgb4_setpgbwgcfg_tx()
612 -err); in cxgb4_setpgbwgcfg_tx()
618 INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); in cxgb4_setpgbwgcfg_tx()
619 if (pi->dcb.state == CXGB4_DCB_STATE_HOST) in cxgb4_setpgbwgcfg_tx()
622 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_setpgbwgcfg_tx()
625 dev_err(adap->pdev_dev, "DCB write PGRATE failed with %d\n", in cxgb4_setpgbwgcfg_tx()
626 -err); in cxgb4_setpgbwgcfg_tx()
630 * Frames enabled.
635 struct port_dcb_info *dcb = &pi->dcb; in cxgb4_getpfccfg()
637 if (!cxgb4_dcb_state_synced(dcb->state) || in cxgb4_getpfccfg()
641 *pfccfg = (pi->dcb.pfcen >> (7 - priority)) & 1; in cxgb4_getpfccfg()
651 struct adapter *adap = pi->adapter; in cxgb4_setpfccfg()
654 if (!cxgb4_dcb_state_synced(pi->dcb.state) || in cxgb4_setpfccfg()
658 INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); in cxgb4_setpfccfg()
659 if (pi->dcb.state == CXGB4_DCB_STATE_HOST) in cxgb4_setpfccfg()
663 pcmd.u.dcb.pfc.pfcen = pi->dcb.pfcen; in cxgb4_setpfccfg()
666 pcmd.u.dcb.pfc.pfcen |= (1 << (7 - priority)); in cxgb4_setpfccfg()
668 pcmd.u.dcb.pfc.pfcen &= (~(1 << (7 - priority))); in cxgb4_setpfccfg()
670 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_setpfccfg()
672 dev_err(adap->pdev_dev, "DCB PFC write failed with %d\n", -err); in cxgb4_setpfccfg()
676 pi->dcb.pfcen = pcmd.u.dcb.pfc.pfcen; in cxgb4_setpfccfg()
716 *caps = pi->dcb.supported; in cxgb4_getcap()
734 if (pi->dcb.msgs & CXGB4_DCB_FW_PGRATE) in cxgb4_getnumtcs()
735 *num = pi->dcb.pg_num_tcs_supported; in cxgb4_getnumtcs()
745 return -EINVAL; in cxgb4_getnumtcs()
758 return -ENOSYS; in cxgb4_setnumtcs()
761 /* Return whether Priority Flow Control is enabled. */
766 if (!cxgb4_dcb_state_synced(pi->dcb.state)) in cxgb4_getpfcstate()
769 return pi->dcb.pfcen != 0; in cxgb4_getpfcstate()
787 struct adapter *adap = pi->adapter; in __cxgb4_getapp()
790 if (!cxgb4_dcb_state_synced(pi->dcb.state)) in __cxgb4_getapp()
798 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); in __cxgb4_getapp()
800 INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); in __cxgb4_getapp()
805 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in __cxgb4_getapp()
807 dev_err(adap->pdev_dev, "DCB APP read failed with %d\n", in __cxgb4_getapp()
808 -err); in __cxgb4_getapp()
820 return -EEXIST; in __cxgb4_getapp()
840 struct adapter *adap = pi->adapter; in __cxgb4_setapp()
844 if (!cxgb4_dcb_state_synced(pi->dcb.state)) in __cxgb4_setapp()
845 return -EINVAL; in __cxgb4_setapp()
849 return -ENOLINK; in __cxgb4_setapp()
852 INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); in __cxgb4_setapp()
855 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in __cxgb4_setapp()
858 dev_err(adap->pdev_dev, "DCB app table read failed with %d\n", in __cxgb4_setapp()
859 -err); in __cxgb4_setapp()
874 dev_err(adap->pdev_dev, "DCB app table full\n"); in __cxgb4_setapp()
875 return -EBUSY; in __cxgb4_setapp()
879 INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); in __cxgb4_setapp()
880 if (pi->dcb.state == CXGB4_DCB_STATE_HOST) in __cxgb4_setapp()
889 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in __cxgb4_setapp()
891 dev_err(adap->pdev_dev, "DCB app table write failed with %d\n", in __cxgb4_setapp()
892 -err); in __cxgb4_setapp()
912 return -EINVAL; in cxgb4_setapp()
930 struct port_dcb_info *dcb = &pi->dcb; in cxgb4_ieee_negotiation_complete()
932 if (dcb->state == CXGB4_DCB_STATE_FW_ALLSYNCED) in cxgb4_ieee_negotiation_complete()
933 if (dcb_subtype && !(dcb->msgs & dcb_subtype)) in cxgb4_ieee_negotiation_complete()
936 return (cxgb4_dcb_state_synced(dcb->state) && in cxgb4_ieee_negotiation_complete()
937 (dcb->supported & DCB_CAP_DCBX_VER_IEEE)); in cxgb4_ieee_negotiation_complete()
944 struct port_dcb_info *dcb = &pi->dcb; in cxgb4_ieee_read_ets()
945 struct adapter *adap = pi->adapter; in cxgb4_ieee_read_ets()
950 if (!(dcb->msgs & (CXGB4_DCB_FW_PGID | CXGB4_DCB_FW_PGRATE))) in cxgb4_ieee_read_ets()
953 ets->ets_cap = dcb->pg_num_tcs_supported; in cxgb4_ieee_read_ets()
956 ets->willing = 1; in cxgb4_ieee_read_ets()
957 INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); in cxgb4_ieee_read_ets()
959 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); in cxgb4_ieee_read_ets()
963 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_ieee_read_ets()
965 dev_err(adap->pdev_dev, "DCB read PGID failed with %d\n", -err); in cxgb4_ieee_read_ets()
972 INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id); in cxgb4_ieee_read_ets()
974 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); in cxgb4_ieee_read_ets()
977 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_ieee_read_ets()
979 dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", in cxgb4_ieee_read_ets()
980 -err); in cxgb4_ieee_read_ets()
985 bwg = (tc_info >> ((7 - i) * 4)) & 0xF; in cxgb4_ieee_read_ets()
986 ets->prio_tc[i] = bwg; in cxgb4_ieee_read_ets()
987 ets->tc_tx_bw[i] = pcmd.u.dcb.pgrate.pgrate[i]; in cxgb4_ieee_read_ets()
988 ets->tc_rx_bw[i] = ets->tc_tx_bw[i]; in cxgb4_ieee_read_ets()
989 ets->tc_tsa[i] = pcmd.u.dcb.pgrate.tsa[i]; in cxgb4_ieee_read_ets()
1000 /* We reuse this for peer PFC as well, as we can't have it enabled one way */
1004 struct port_dcb_info *dcb = &pi->dcb; in cxgb4_ieee_get_pfc()
1008 if (!(dcb->msgs & CXGB4_DCB_FW_PFC)) in cxgb4_ieee_get_pfc()
1011 pfc->pfc_cap = dcb->pfc_num_tcs_supported; in cxgb4_ieee_get_pfc()
1012 pfc->pfc_en = bitswap_1(dcb->pfcen); in cxgb4_ieee_get_pfc()
1031 return -EINVAL; in cxgb4_ieee_getapp()
1032 if (!(app->selector && app->protocol)) in cxgb4_ieee_getapp()
1033 return -EINVAL; in cxgb4_ieee_getapp()
1036 prio = __cxgb4_getapp(dev, app->selector - 1, app->protocol, 0); in cxgb4_ieee_getapp()
1041 app->priority = ffs(prio) - 1; in cxgb4_ieee_getapp()
1053 return -EINVAL; in cxgb4_ieee_setapp()
1054 if (!(app->selector && app->protocol)) in cxgb4_ieee_setapp()
1055 return -EINVAL; in cxgb4_ieee_setapp()
1057 if (!(app->selector > IEEE_8021QAZ_APP_SEL_ETHERTYPE && in cxgb4_ieee_setapp()
1058 app->selector < IEEE_8021QAZ_APP_SEL_ANY)) in cxgb4_ieee_setapp()
1059 return -EINVAL; in cxgb4_ieee_setapp()
1062 ret = __cxgb4_setapp(dev, app->selector - 1, app->protocol, in cxgb4_ieee_setapp()
1063 (1 << app->priority)); in cxgb4_ieee_setapp()
1077 return pi->dcb.supported; in cxgb4_getdcbx()
1094 if (!cxgb4_dcb_state_synced(pi->dcb.state)) in cxgb4_setdcbx()
1102 if (dcb_request != pi->dcb.supported) in cxgb4_setdcbx()
1105 pi->dcb.supported = dcb_request; in cxgb4_setdcbx()
1114 struct adapter *adap = pi->adapter; in cxgb4_getpeer_app()
1117 if (!cxgb4_dcb_state_synced(pi->dcb.state)) in cxgb4_getpeer_app()
1120 info->willing = 0; in cxgb4_getpeer_app()
1121 info->error = 0; in cxgb4_getpeer_app()
1125 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); in cxgb4_getpeer_app()
1128 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_getpeer_app()
1131 dev_err(adap->pdev_dev, "DCB app table read failed with %d\n", in cxgb4_getpeer_app()
1132 -err); in cxgb4_getpeer_app()
1148 struct adapter *adap = pi->adapter; in cxgb4_getpeerapp_tbl()
1151 if (!cxgb4_dcb_state_synced(pi->dcb.state)) in cxgb4_getpeerapp_tbl()
1155 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); in cxgb4_getpeerapp_tbl()
1158 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_getpeerapp_tbl()
1161 dev_err(adap->pdev_dev, "DCB app table read failed with %d\n", in cxgb4_getpeerapp_tbl()
1162 -err); in cxgb4_getpeerapp_tbl()
1174 ffs(pcmd.u.dcb.app_priority.user_prio_map) - 1; in cxgb4_getpeerapp_tbl()
1185 struct adapter *adap = pi->adapter; in cxgb4_cee_peer_getpg()
1189 /* We're always "willing" -- the Switch Fabric always dictates the in cxgb4_cee_peer_getpg()
1192 pg->willing = true; in cxgb4_cee_peer_getpg()
1194 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); in cxgb4_cee_peer_getpg()
1196 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_cee_peer_getpg()
1198 dev_err(adap->pdev_dev, "DCB read PGID failed with %d\n", -err); in cxgb4_cee_peer_getpg()
1204 pg->prio_pg[7 - i] = (pgid >> (i * 4)) & 0xF; in cxgb4_cee_peer_getpg()
1206 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); in cxgb4_cee_peer_getpg()
1208 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); in cxgb4_cee_peer_getpg()
1210 dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", in cxgb4_cee_peer_getpg()
1211 -err); in cxgb4_cee_peer_getpg()
1216 pg->pg_bw[i] = pcmd.u.dcb.pgrate.pgrate[i]; in cxgb4_cee_peer_getpg()
1218 pg->tcs_supported = pcmd.u.dcb.pgrate.num_tcs_supported; in cxgb4_cee_peer_getpg()
1229 cxgb4_getnumtcs(dev, DCB_NUMTCS_ATTR_PFC, &(pfc->tcs_supported)); in cxgb4_cee_peer_getpfc()
1235 pfc->pfc_en = bitswap_1(pi->dcb.pfcen); in cxgb4_cee_peer_getpfc()
1237 pfc->tcs_supported = pi->dcb.pfc_num_tcs_supported; in cxgb4_cee_peer_getpfc()