From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D46BCA04B3; Mon, 9 Dec 2019 22:50:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2DD061BFB8; Mon, 9 Dec 2019 22:48:58 +0100 (CET) Received: from mail.ntop.org (mail-digitalocean.ntop.org [167.99.215.164]) by dpdk.org (Postfix) with ESMTP id 34F771BDFD for ; Mon, 9 Dec 2019 22:48:34 +0100 (CET) Received: from devele.ntop.org (net-93-145-196-230.cust.vodafonedsl.it [93.145.196.230]) by mail.ntop.org (Postfix) with ESMTPSA id D11FF41BA4; Mon, 9 Dec 2019 22:48:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntop.org; s=mail; t=1575928114; bh=C9hEv7516bw9m/S5P3vpLl7FJ76GKl1DHyDiTlF3j+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b7jE2+Fkzvaq14WyZGzP20Y5DUCbr3+vl6RWj1kdpz9/8D0wziOzIRPR7Vlop6DcG 8FUkPIkN/V5JwYmFyE0IjowaDsm5urL4mmKi41FpRZPq8xdgNnp5pnEwWbe8WGeglM Rt5gPsdTEa/9seSuHyPx9lDW8Izvk1Zyff0iH5oo= From: Alfredo Cardigliano To: Alfredo Cardigliano , John McNamara , Marko Kovacevic Cc: dev@dpdk.org Date: Mon, 9 Dec 2019 22:46:51 +0100 Message-Id: <20191209214656.27347-13-cardigliano@ntop.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191209214656.27347-1-cardigliano@ntop.org> References: <20191209214656.27347-1-cardigliano@ntop.org> Subject: [dpdk-dev] [PATCH v3 12/17] net/ionic: add Flow Control support 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add support for managing Flow Control. Signed-off-by: Alfredo Cardigliano Reviewed-by: Shannon Nelson --- doc/guides/nics/features/ionic.ini | 1 + drivers/net/ionic/ionic_ethdev.c | 56 ++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/doc/guides/nics/features/ionic.ini b/doc/guides/nics/features/ionic.ini index 3dd5dab45..05bdb2d98 100644 --- a/doc/guides/nics/features/ionic.ini +++ b/doc/guides/nics/features/ionic.ini @@ -12,6 +12,7 @@ Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y VLAN filter = Y +Flow control = Y Linux UIO = Y Linux VFIO = Y x86-64 = Y diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 60151341a..9872740b7 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -29,6 +29,10 @@ static int ionic_dev_set_link_up(struct rte_eth_dev *dev); static int ionic_dev_set_link_down(struct rte_eth_dev *dev); static int ionic_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete); +static int ionic_flow_ctrl_get(struct rte_eth_dev *eth_dev, + struct rte_eth_fc_conf *fc_conf); +static int ionic_flow_ctrl_set(struct rte_eth_dev *eth_dev, + struct rte_eth_fc_conf *fc_conf); int ionic_logtype_driver; @@ -57,6 +61,8 @@ static const struct eth_dev_ops ionic_eth_dev_ops = { .promiscuous_disable = ionic_dev_promiscuous_disable, .allmulticast_enable = ionic_dev_allmulticast_enable, .allmulticast_disable = ionic_dev_allmulticast_disable, + .flow_ctrl_get = ionic_flow_ctrl_get, + .flow_ctrl_set = ionic_flow_ctrl_set, }; /* @@ -246,6 +252,56 @@ ionic_dev_info_get(struct rte_eth_dev *eth_dev, return 0; } +static int +ionic_flow_ctrl_get(struct rte_eth_dev *eth_dev, + struct rte_eth_fc_conf *fc_conf) +{ + struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); + struct ionic_adapter *adapter = lif->adapter; + struct ionic_dev *idev = &adapter->idev; + + if (idev->port_info) { + fc_conf->autoneg = idev->port_info->config.an_enable; + + if (idev->port_info->config.pause_type) + fc_conf->mode = RTE_FC_FULL; + else + fc_conf->mode = RTE_FC_NONE; + } + + return 0; +} + +static int +ionic_flow_ctrl_set(struct rte_eth_dev *eth_dev, + struct rte_eth_fc_conf *fc_conf) +{ + struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); + struct ionic_adapter *adapter = lif->adapter; + struct ionic_dev *idev = &adapter->idev; + uint8_t pause_type = IONIC_PORT_PAUSE_TYPE_NONE; + uint8_t an_enable; + + switch (fc_conf->mode) { + case RTE_FC_NONE: + pause_type = IONIC_PORT_PAUSE_TYPE_NONE; + break; + case RTE_FC_FULL: + pause_type = IONIC_PORT_PAUSE_TYPE_LINK; + break; + case RTE_FC_RX_PAUSE: + case RTE_FC_TX_PAUSE: + return -ENOTSUP; + } + + an_enable = fc_conf->autoneg; + + ionic_dev_cmd_port_pause(idev, pause_type); + ionic_dev_cmd_port_autoneg(idev, an_enable); + + return 0; +} + static int ionic_dev_configure(struct rte_eth_dev *eth_dev) { -- 2.17.1