From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by dpdk.org (Postfix) with ESMTP id 396525B32 for ; Mon, 12 Mar 2018 09:42:32 +0100 (CET) Received: by mail-lf0-f66.google.com with SMTP id q69-v6so21858322lfi.10 for ; Mon, 12 Mar 2018 01:42:32 -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=ESzetlyEvA/0uP0vCj60sQfoewdDHVIwcQMgu1F3Boo=; b=CXbm3PRbtuWM22cH1USiREtdzYDV1/l7fzm3/Gas+czBRpnwLWtcCOVsBjOK3MmlrU 81CM8G95kXMUolPmB2UaM5hPk3GhMQNRLzJlS/HLm9XeHh0/0HD/3k2ZAJrtwSEoT1on mD64drFYd4WAw/RK43c1GVNURJzboIx26sDd2OiVQQ34Xlo8mhqDDv7+dS1PavuNXzBn DZwNNHHeW/yOXqL7D3PEq5lovieiD+LsN9tt8E6LWQoO3TGgbymFL2UJf9fHum3RIH1i LHgmylUqYXJXbuU4pHQtdWVcxjZXxehs+dBH3+Vkt55wDW+52bRZMkoIlE/sHYOfIekH /GIw== 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=ESzetlyEvA/0uP0vCj60sQfoewdDHVIwcQMgu1F3Boo=; b=V7LxRjwmdKdzinl2lQzU6vS7vSWgEFyqrpoNJlx9M3uVuMDGpsc6ktMfiijH/KgM93 aRFhLoD/6ORLZ2uXgZrqCi4lueUttM8qMTyZNqBq2jo3m8YZ7RCt3a3ovUS7Whl8QNoS uZdbD5/WOJimQWSirXYcICAdI12EwOpLThxCmhdgXAY967NuWXWU++ZTmHbDzatBEShF Mt4rAX4Gp1EIxn/Tn7Z2iEJTp+7tPFB6zURc3w/RCmVmWLbvE46W7nUAChu3hHEGNR6V XRJ5sW6dhvWbU9MJ3vFogODV8mZ7LvlE8PSuqHrhAsLpCai5eWp/oSEk9anXP+Chn8Yt 2+/Q== X-Gm-Message-State: AElRT7F50mufC59P5AvkJAfbevKGATzbsaT4tJ8nBFhAcT864oi3oMM2 XPRuRiszZMCGYhSfyC/cEgk73wN5+vU= X-Google-Smtp-Source: AG47ELtlxagBwFkRjlrdG08DXMycZ4vbYyKrTzEYJ+0quSnHaPILDwHKKw6KOqjVKSgDfHyoQeKZGw== X-Received: by 10.46.27.211 with SMTP id c80mr4805683ljf.46.1520844151705; Mon, 12 Mar 2018 01:42:31 -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 t21sm1549933ljd.55.2018.03.12.01.42.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Mar 2018 01:42:31 -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: Mon, 12 Mar 2018 09:42:11 +0100 Message-Id: <1520844132-29969-8-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520844132-29969-1-git-send-email-tdu@semihalf.com> References: <1519222460-14605-1-git-send-email-tdu@semihalf.com> <1520844132-29969-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH v2 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: Mon, 12 Mar 2018 08:42:32 -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 cbe3f4d..21a83c9 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 @@ -1902,6 +1978,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