From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by dpdk.org (Postfix) with ESMTP id 26B42A499 for ; Thu, 15 Mar 2018 08:52:24 +0100 (CET) Received: by mail-lf0-f67.google.com with SMTP id a22-v6so8673563lfg.9 for ; Thu, 15 Mar 2018 00:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Jh47L+i/4mRE0RrjIiU+xt60iiXdTfow0wk3A2qusKs=; b=a96lIOWish1D2c2T2Rl2ICy9eb1F/hg9nw56/geaN7CfEzOS3on4fk/GsNEZMfyRRw KfH9e4QWkO+VPkFaBCW5ak90AgEPs4kl2sD/S349lyWUINONN+96Q8/STodROLV6BKJI LBLU3Ng9CjxG6EDfKon84NTMqlaPQ2Eu+f5yNWCzFd5FW5jJgEn5CuRkzSsNo8TttnGG L5Ej+pNqYPns7UICSaYwLyYwCwx3Chf0RQDEoI93O1c9n1iEoRpOF8tnUQ7AT3+VXhd2 gjMWHX5f9vS9uJPlL31EvoYIfizuaXbczJCchGdbMtOK9S2hSDBHiKLFwKJZNQ1HnYp9 E2Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Jh47L+i/4mRE0RrjIiU+xt60iiXdTfow0wk3A2qusKs=; b=lhh+Okm3PUEJ6z5+y+sPE0SEbVQO42LveAa3aW/RmwChoEqGl0damiFccSzeRPKKBq yZ8OkO4X8g1kSchur3peGzwyQyTE845fP2SR6CvT6wQ/k2DuAkbEpuHixFaFQYwa0v/9 iAcHCDIWx8VQhd3OSRuyP2q6z1Faisnf86I75NxyDd8PeAdlvHrtDp+gT+vTyJkQMoNf wYoQC35iBSqDUvP/65YdOX9tHoYrOlXu522kJb78R7XfC7TEN97XjRVIi6uKdn/MwHas vA/2FtseqCzrVjdgQ7nJ9EHM4w6S/SpQKybPuHAHaafM8C295PyI/UE75SJA6zmHgEKj cDUA== X-Gm-Message-State: AElRT7FDnrAsBYAhbLN7NK536+wXG2XjbVnsPPcgMW72LK6XaoyiM+bq bCsyCLssLaYk6rA6WfEKFa2KzmHWGao= X-Google-Smtp-Source: AG47ELvTSCFuJXPS/JI9yii9UHUcln36/NT5UdwdX/LkzsvXvSuVilIJwhW8ICq/6XM5Xj5gzsMnZg== X-Received: by 2002:a19:a003:: with SMTP id j3-v6mr4315352lfe.8.1521100342486; Thu, 15 Mar 2018 00:52:22 -0700 (PDT) Received: from sh.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id d14sm972925ljd.31.2018.03.15.00.52.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Mar 2018 00:52:21 -0700 (PDT) From: Tomasz Duszynski To: dev@dpdk.org Cc: mw@semihalf.com, dima@marvell.com, nsamsono@marvell.com, jck@semihalf.com, jianbo.liu@arm.com, Tomasz Duszynski Date: Thu, 15 Mar 2018 08:52:03 +0100 Message-Id: <1521100324-26558-8-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521100324-26558-1-git-send-email-tdu@semihalf.com> References: <1520844132-29969-1-git-send-email-tdu@semihalf.com> <1521100324-26558-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH v3 7/8] net/mrvl: add Rx flow control X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Mar 2018 07:52:25 -0000 Add Rx side flow control support. Signed-off-by: Natalie Samsonov Signed-off-by: Tomasz Duszynski --- doc/guides/nics/features/mrvl.ini | 1 + doc/guides/nics/mrvl.rst | 1 + drivers/net/mrvl/mrvl_ethdev.c | 78 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) diff --git a/doc/guides/nics/features/mrvl.ini b/doc/guides/nics/features/mrvl.ini index 120fd4d..8673a56 100644 --- a/doc/guides/nics/features/mrvl.ini +++ b/doc/guides/nics/features/mrvl.ini @@ -13,6 +13,7 @@ Allmulticast mode = Y Unicast MAC filter = Y Multicast MAC filter = Y RSS hash = Y +Flow control = Y VLAN filter = Y CRC offload = Y L3 checksum offload = Y diff --git a/doc/guides/nics/mrvl.rst b/doc/guides/nics/mrvl.rst index 7678265..550bd79 100644 --- a/doc/guides/nics/mrvl.rst +++ b/doc/guides/nics/mrvl.rst @@ -72,6 +72,7 @@ Features of the MRVL PMD are: - Basic stats - Extended stats - QoS +- RX flow control Limitations diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c index 880bd0b..bf596f4 100644 --- a/drivers/net/mrvl/mrvl_ethdev.c +++ b/drivers/net/mrvl/mrvl_ethdev.c @@ -1696,6 +1696,82 @@ mrvl_tx_queue_release(void *txq) } /** + * DPDK callback to get 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. + */ +static int +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; + + ret = pp2_ppio_get_rx_pause(priv->ppio, &en); + if (ret) { + RTE_LOG(ERR, PMD, "Failed to read rx pause state\n"); + return ret; + } + + fc_conf->mode = en ? RTE_FC_RX_PAUSE : RTE_FC_NONE; + + return 0; +} + +/** + * 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. + */ +static int +mrvl_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +{ + struct mrvl_priv *priv = dev->data->dev_private; + + if (!priv) + return -EPERM; + + if (fc_conf->high_water || + fc_conf->low_water || + fc_conf->pause_time || + fc_conf->mac_ctrl_frame_fwd || + fc_conf->autoneg) { + RTE_LOG(ERR, PMD, "Flowctrl parameter is not supported\n"); + + return -EINVAL; + } + + if (fc_conf->mode == RTE_FC_NONE || + fc_conf->mode == RTE_FC_RX_PAUSE) { + int ret, en; + + en = fc_conf->mode == RTE_FC_NONE ? 0 : 1; + ret = pp2_ppio_set_rx_pause(priv->ppio, en); + if (ret) + RTE_LOG(ERR, PMD, + "Failed to change flowctrl on RX side\n"); + + return ret; + } + + return 0; +} + +/** * Update RSS hash configuration * * @param dev @@ -1814,6 +1890,8 @@ static const struct eth_dev_ops mrvl_ops = { .rx_queue_release = mrvl_rx_queue_release, .tx_queue_setup = mrvl_tx_queue_setup, .tx_queue_release = mrvl_tx_queue_release, + .flow_ctrl_get = mrvl_flow_ctrl_get, + .flow_ctrl_set = mrvl_flow_ctrl_set, .rss_hash_update = mrvl_rss_hash_update, .rss_hash_conf_get = mrvl_rss_hash_conf_get, .filter_ctrl = mrvl_eth_filter_ctrl, -- 2.7.4