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 1300D1B29E for ; Wed, 21 Feb 2018 15:14:41 +0100 (CET) Received: by mail-lf0-f66.google.com with SMTP id 70so2563437lfw.2 for ; Wed, 21 Feb 2018 06:14:41 -0800 (PST) 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=lHra+SSFoWgIRw78qsfAz17cycHiru3gf9feuuM0tYc=; b=f+d9QxiILTBcx14xrkwEE4+OfkqyiC7UZlXUsoAzNaAZ42xjQupCXoZrtNeWXH4fF4 ufL8hAdPdipfwW/M0t6AvNXa7l5rNuPv+YHDR3A0OUMlJWxSsL5QZbD7G3LPrvnXls1K zIeZ/fIVMGY5haT6KvvrC8gCCaXZWssN8iIMIJEffoo6eyGSh4COgCGgf5cDZEt2hrOR SInofFbCd374Z8Vswlst4qw5evQ9XFXkqJElPFJJLIWAZvyc5vdWU5XTZ1pjSa3g8CI9 qfvcdjiXy32zn0Rid01cJThWUkhtBClIWlla/GPj2JHr2W+oSSoCmDNKyM7keVzF9KIE l45w== 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=lHra+SSFoWgIRw78qsfAz17cycHiru3gf9feuuM0tYc=; b=sWAa6Dt437Z1x/3jILNM9xmE6taYKiueEUAWWwU1sQ7nmcn4MLCZ7/guFFQmKhYBSn QyHlrAOebGsPUjKwCIPGlD8TnzFRAxtyf6Qx8gwOGM5AKJLRGd7bxXatAWiY2rY+eOJn L8ZT+XXdmEkHtpVv3br473KOkD0OQDqUF6e91eQ8yXeD9vKW33Gw+vGtY7Xt6jZzHCxm Wf2tSXpzHxChOBu+sPifpTZPuq6dE0JAB/8/XTjHw5ttbFBT5CzQKYFqz4yQaK85Y61f b3e7manRba5bZQO3B530icMxVofDyUnx0NwuOZ+55QhVICAiaGorwxhrwY+EIsXnPe4q 8pKg== X-Gm-Message-State: APf1xPAFiCDHEH0E0c7gVc1WG5lJkmgzi3rtSmv7g6G6BUsXKaA22y5P s/T01cmf4jVdCWrfmMEG9goRc6EOH1w= X-Google-Smtp-Source: AH8x224YKGaJsxMo8QQI9aylOY16D47asDf/UwY/we8koSocLulxMvPyWkZM7YTWupcHmxow2GdwZw== X-Received: by 10.25.15.98 with SMTP id e95mr2645265lfi.36.1519222479760; Wed, 21 Feb 2018 06:14:39 -0800 (PST) Received: from sh.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id e27sm5038177lff.89.2018.02.21.06.14.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 06:14:39 -0800 (PST) From: Tomasz Duszynski To: dev@dpdk.org Cc: mw@semihalf.com, dima@marvell.com, nsamsono@marvell.com, jck@semihalf.com, Tomasz Duszynski Date: Wed, 21 Feb 2018 15:14:19 +0100 Message-Id: <1519222460-14605-8-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519222460-14605-1-git-send-email-tdu@semihalf.com> References: <1519222460-14605-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH 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: Wed, 21 Feb 2018 14:14:41 -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 bccd2d0..08c0b03 100644 --- a/drivers/net/mrvl/mrvl_ethdev.c +++ b/drivers/net/mrvl/mrvl_ethdev.c @@ -1724,6 +1724,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 @@ -1930,6 +2006,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