DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] net/ena: solve problem with host attributes
@ 2017-02-06 11:56 Jakub Palider
  2017-02-07 14:11 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Palider @ 2017-02-06 11:56 UTC (permalink / raw)
  To: dev; +Cc: Jakub Palider

The hardware may reject adding host_info in case support for
host_info is missing in the list of supported features. On the
other hand the list of supported featues may contain support
for the host_info - typical bootstrap problem.
This patch solves it by removing check against support for
host_info attribute and improves error handling by reacting
only to host attribute write failure to the hardware.

v2 changes:
 - added Signed-off

Signed-off-by: Jakub Palider <jpa@semihalf.com>
---
 drivers/net/ena/base/ena_com.c | 16 ++++------------
 drivers/net/ena/ena_ethdev.c   | 21 ++++++++-------------
 2 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ena/base/ena_com.c b/drivers/net/ena/base/ena_com.c
index 88053e3..bd6f3c6 100644
--- a/drivers/net/ena/base/ena_com.c
+++ b/drivers/net/ena/base/ena_com.c
@@ -2590,19 +2590,11 @@ int ena_com_set_host_attributes(struct ena_com_dev *ena_dev)
 	struct ena_com_admin_queue *admin_queue;
 	struct ena_admin_set_feat_cmd cmd;
 	struct ena_admin_set_feat_resp resp;
+	int ret;
 
-	int ret = 0;
-
-	if (unlikely(!ena_dev)) {
-		ena_trc_err("%s : ena_dev is NULL\n", __func__);
-		return ENA_COM_NO_DEVICE;
-	}
-
-	if (!ena_com_check_supported_feature_id(ena_dev,
-						ENA_ADMIN_HOST_ATTR_CONFIG)) {
-		ena_trc_warn("Set host attribute isn't supported\n");
-		return ENA_COM_PERMISSION;
-	}
+	/* Host attribute config is called before ena_com_get_dev_attr_feat
+	 * so ena_com can't check if the feature is supported.
+	 */
 
 	memset(&cmd, 0x0, sizeof(cmd));
 	admin_queue = &ena_dev->admin_queue;
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index e99bf29..f3666e5 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -368,12 +368,9 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev)
 
 	rc = ena_com_set_host_attributes(ena_dev);
 	if (rc) {
-		if (rc == -EPERM)
-			RTE_LOG(ERR, PMD, "Cannot set host attributes\n");
-		else
-			RTE_LOG(ERR, PMD, "Cannot set host attributes\n");
-
-		goto err;
+		RTE_LOG(ERR, PMD, "Cannot set host attributes\n");
+		if (rc != -EPERM)
+			goto err;
 	}
 
 	return;
@@ -424,11 +421,9 @@ static void ena_config_debug_area(struct ena_adapter *adapter)
 
 	rc = ena_com_set_host_attributes(&adapter->ena_dev);
 	if (rc) {
-		if (rc == -EPERM)
-			RTE_LOG(WARNING, PMD, "Cannot set host attributes\n");
-		else
-			RTE_LOG(ERR, PMD, "Cannot set host attributes\n");
-		goto err;
+		RTE_LOG(WARNING, PMD, "Cannot set host attributes\n");
+		if (rc != -EPERM)
+			goto err;
 	}
 
 	return;
@@ -1239,14 +1234,14 @@ static int ena_device_init(struct ena_com_dev *ena_dev,
 		goto err_mmio_read_less;
 	}
 
-	ena_config_host_info(ena_dev);
-
 	/* To enable the msix interrupts the driver needs to know the number
 	 * of queues. So the driver uses polling mode to retrieve this
 	 * information.
 	 */
 	ena_com_set_admin_polling_mode(ena_dev, true);
 
+	ena_config_host_info(ena_dev);
+
 	/* Get Device Attributes and features */
 	rc = ena_com_get_dev_attr_feat(ena_dev, get_feat_ctx);
 	if (rc) {
-- 
2.5.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/ena: solve problem with host attributes
  2017-02-06 11:56 [dpdk-dev] [PATCH v2] net/ena: solve problem with host attributes Jakub Palider
@ 2017-02-07 14:11 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2017-02-07 14:11 UTC (permalink / raw)
  To: Jakub Palider, dev; +Cc: dpdk stable

On 2/6/2017 11:56 AM, Jakub Palider wrote:
> The hardware may reject adding host_info in case support for
> host_info is missing in the list of supported features. On the
> other hand the list of supported featues may contain support
> for the host_info - typical bootstrap problem.
> This patch solves it by removing check against support for
> host_info attribute and improves error handling by reacting
> only to host attribute write failure to the hardware.
> 
> v2 changes:
>  - added Signed-off
> 
> Signed-off-by: Jakub Palider <jpa@semihalf.com>

    net/ena: fix setting host attributes

    Fixes: 99ecfbf845b3 ("ena: import communication layer")
    Cc: stable@dpdk.org

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-07 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-06 11:56 [dpdk-dev] [PATCH v2] net/ena: solve problem with host attributes Jakub Palider
2017-02-07 14:11 ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).