MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sfc_flow_ctrl_set

Function sfc_flow_ctrl_set

dpdk/drivers/net/sfc/sfc_ethdev.c:1027–1081  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1025}
1026
1027static int
1028sfc_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
1029{
1030 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
1031 struct sfc_port *port = &sa->port;
1032 unsigned int fcntl;
1033 int rc;
1034
1035 if (fc_conf->high_water != 0 || fc_conf->low_water != 0 ||
1036 fc_conf->pause_time != 0 || fc_conf->send_xon != 0 ||
1037 fc_conf->mac_ctrl_frame_fwd != 0) {
1038 sfc_err(sa, "unsupported flow control settings specified");
1039 rc = EINVAL;
1040 goto fail_inval;
1041 }
1042
1043 switch (fc_conf->mode) {
1044 case RTE_ETH_FC_NONE:
1045 fcntl = 0;
1046 break;
1047 case RTE_ETH_FC_RX_PAUSE:
1048 fcntl = EFX_FCNTL_RESPOND;
1049 break;
1050 case RTE_ETH_FC_TX_PAUSE:
1051 fcntl = EFX_FCNTL_GENERATE;
1052 break;
1053 case RTE_ETH_FC_FULL:
1054 fcntl = EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE;
1055 break;
1056 default:
1057 rc = EINVAL;
1058 goto fail_inval;
1059 }
1060
1061 sfc_adapter_lock(sa);
1062
1063 if (sa->state == SFC_ETHDEV_STARTED) {
1064 rc = efx_mac_fcntl_set(sa->nic, fcntl, fc_conf->autoneg);
1065 if (rc != 0)
1066 goto fail_mac_fcntl_set;
1067 }
1068
1069 port->flow_ctrl = fcntl;
1070 port->flow_ctrl_autoneg = fc_conf->autoneg;
1071
1072 sfc_adapter_unlock(sa);
1073
1074 return 0;
1075
1076fail_mac_fcntl_set:
1077 sfc_adapter_unlock(sa);
1078fail_inval:
1079 SFC_ASSERT(rc > 0);
1080 return -rc;
1081}
1082
1083static int
1084sfc_check_scatter_on_all_rx_queues(struct sfc_adapter *sa, size_t pdu)

Callers

nothing calls this directly

Calls 2

sfc_adapter_by_eth_devFunction · 0.85
efx_mac_fcntl_setFunction · 0.85

Tested by

no test coverage detected