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

Function mrvl_flow_ctrl_set

dpdk/drivers/net/mvpp2/mrvl_ethdev.c:2223–2292  ·  view source on GitHub ↗

* DPDK callback to set flow control configuration. * * @param dev * Pointer to Ethernet device structure. * @param fc_conf * Pointer to the flow control configuration. * * @return * 0 on success, negative error value otherwise. */

Source from the content-addressed store, hash-verified

2221 * 0 on success, negative error value otherwise.
2222 */
2223static int
2224mrvl_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
2225{
2226 struct mrvl_priv *priv = dev->data->dev_private;
2227 struct pp2_ppio_tx_pause_params mrvl_pause_params;
2228 int ret;
2229 int rx_en, tx_en;
2230
2231 if (fc_conf->high_water ||
2232 fc_conf->low_water ||
2233 fc_conf->pause_time ||
2234 fc_conf->mac_ctrl_frame_fwd) {
2235 MRVL_LOG(ERR, "Flowctrl parameter is not supported");
2236
2237 return -EINVAL;
2238 }
2239
2240 if (fc_conf->autoneg == 0) {
2241 MRVL_LOG(ERR, "Flowctrl Autoneg disable is not supported");
2242 return -EINVAL;
2243 }
2244
2245 if (!priv->ppio) {
2246 memcpy(&priv->fc_conf, fc_conf, sizeof(struct rte_eth_fc_conf));
2247 priv->flow_ctrl = 1;
2248 return 0;
2249 }
2250
2251 switch (fc_conf->mode) {
2252 case RTE_ETH_FC_FULL:
2253 rx_en = 1;
2254 tx_en = 1;
2255 break;
2256 case RTE_ETH_FC_TX_PAUSE:
2257 rx_en = 0;
2258 tx_en = 1;
2259 break;
2260 case RTE_ETH_FC_RX_PAUSE:
2261 rx_en = 1;
2262 tx_en = 0;
2263 break;
2264 case RTE_ETH_FC_NONE:
2265 rx_en = 0;
2266 tx_en = 0;
2267 break;
2268 default:
2269 MRVL_LOG(ERR, "Incorrect Flow control flag (%d)",
2270 fc_conf->mode);
2271 return -EINVAL;
2272 }
2273
2274 /* Set RX flow control */
2275 ret = pp2_ppio_set_rx_pause(priv->ppio, rx_en);
2276 if (ret) {
2277 MRVL_LOG(ERR, "Failed to change RX flowctrl");
2278 return ret;
2279 }
2280

Callers 1

mrvl_dev_startFunction · 0.85

Calls 1

memcpyFunction · 0.50

Tested by

no test coverage detected