From: Liron Himi Date: Wed, 27 Jan 2021 16:09:42 +0000 (+0200) Subject: net/mvpp2: apply flow control after port init X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7f2ae5ddb1b3567655555a34fb014fdef9caabc2;p=dpdk.git net/mvpp2: apply flow control after port init In case ppio was not initialized yet (only at 'start' function) the flow-ctrl setting should be saved for later stage. Signed-off-by: Liron Himi --- diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index b50fda5315..fa5e6f78a0 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -164,6 +164,8 @@ static int mrvl_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static int mrvl_promiscuous_enable(struct rte_eth_dev *dev); static int mrvl_allmulticast_enable(struct rte_eth_dev *dev); +static int +mrvl_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); #define MRVL_XSTATS_TBL_ENTRY(name) { \ #name, offsetof(struct pp2_ppio_statistics, name), \ @@ -915,6 +917,15 @@ mrvl_dev_start(struct rte_eth_dev *dev) if (dev->data->promiscuous == 1) mrvl_promiscuous_enable(dev); + if (priv->flow_ctrl) { + ret = mrvl_flow_ctrl_set(dev, &priv->fc_conf); + if (ret) { + MRVL_LOG(ERR, "Failed to configure flow control"); + goto out; + } + priv->flow_ctrl = 0; + } + if (dev->data->dev_link.link_status == ETH_LINK_UP) { ret = mrvl_dev_set_link_up(dev); if (ret) { @@ -2150,8 +2161,10 @@ mrvl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) struct mrvl_priv *priv = dev->data->dev_private; int ret, en; - if (!priv) - return -EPERM; + if (!priv->ppio) { + memcpy(fc_conf, &priv->fc_conf, sizeof(struct rte_eth_fc_conf)); + return 0; + } fc_conf->autoneg = 1; ret = pp2_ppio_get_rx_pause(priv->ppio, &en); @@ -2197,9 +2210,6 @@ mrvl_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) int ret; int rx_en, tx_en; - if (!priv) - return -EPERM; - if (fc_conf->high_water || fc_conf->low_water || fc_conf->pause_time || @@ -2214,6 +2224,12 @@ mrvl_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) return -EINVAL; } + if (!priv->ppio) { + memcpy(&priv->fc_conf, fc_conf, sizeof(struct rte_eth_fc_conf)); + priv->flow_ctrl = 1; + return 0; + } + switch (fc_conf->mode) { case RTE_FC_FULL: rx_en = 1; diff --git a/drivers/net/mvpp2/mrvl_ethdev.h b/drivers/net/mvpp2/mrvl_ethdev.h index 42b0cc0531..0ee7208fbd 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.h +++ b/drivers/net/mvpp2/mrvl_ethdev.h @@ -160,6 +160,8 @@ struct mrvl_priv { uint8_t isolated; uint8_t multiseg; uint16_t max_mtu; + uint8_t flow_ctrl; + struct rte_eth_fc_conf fc_conf; struct pp2_ppio_params ppio_params; struct pp2_cls_qos_tbl_params qos_tbl_params;