net/ena: change condition for host attribute configuration
authorNetanel Belgazal <netanel@annapurnalabs.com>
Thu, 9 Feb 2017 13:21:38 +0000 (15:21 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 10 Feb 2017 03:27:06 +0000 (22:27 -0500)
Move the host info config to be the first admin command that is executed.
This change require the driver to remove the 'feature check'
from host info configuration flow.
The check is removed since the supported features bitmask field
is retrieved only after calling ENA_ADMIN_DEVICE_ATTRIBUTES admin command.

If set host info is not supported an error will be returned by the device.

Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amazon/ena/ena_com.c
drivers/net/ethernet/amazon/ena/ena_netdev.c

index 8029e7c1caf5c71fd99aa483a92311b1236ae5bc..08d11cede9c972596ee683c5d255fe143b76b9b8 100644 (file)
@@ -2451,11 +2451,9 @@ int ena_com_set_host_attributes(struct ena_com_dev *ena_dev)
 
        int ret;
 
-       if (!ena_com_check_supported_feature_id(ena_dev,
-                                               ENA_ADMIN_HOST_ATTR_CONFIG)) {
-               pr_warn("Set host attribute isn't supported\n");
-               return -EPERM;
-       }
+       /* 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;
index 50793665707c0e51258c7285e499a4e3336ad71d..d8c920be5e916d2e2d2a1dcf9f35105a24a06d18 100644 (file)
@@ -2414,6 +2414,8 @@ static int ena_device_init(struct ena_com_dev *ena_dev, struct pci_dev *pdev,
         */
        ena_com_set_admin_polling_mode(ena_dev, true);
 
+       ena_config_host_info(ena_dev);
+
        /* Get Device Attributes*/
        rc = ena_com_get_dev_attr_feat(ena_dev, get_feat_ctx);
        if (rc) {
@@ -2438,11 +2440,10 @@ static int ena_device_init(struct ena_com_dev *ena_dev, struct pci_dev *pdev,
 
        *wd_state = !!(aenq_groups & BIT(ENA_ADMIN_KEEP_ALIVE));
 
-       ena_config_host_info(ena_dev);
-
        return 0;
 
 err_admin_init:
+       ena_com_delete_host_info(ena_dev);
        ena_com_admin_destroy(ena_dev);
 err_mmio_read_less:
        ena_com_mmio_reg_read_request_destroy(ena_dev);