From: Jan Medala Date: Thu, 30 Jun 2016 15:04:56 +0000 (+0200) Subject: net/ena: disable readless communication when no HW support X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=c414455701588efb80b5fde9518f6000d35b0e66;p=dpdk.git net/ena: disable readless communication when no HW support Depending on HW revision readless communcation between host and device may be unavailable. In that case prevent PMD from setting up readless communication mechanism. "readless" refers to ability to read ENA registers without actually issuing read request from host (x86). Instead, host programs 2 registers on the device that triggers a DMA from device to host and reports a register value. However, this functionality is not going to be available in all types of devices. The decision if this mode is supported or not, is taken from revision_id in pci configuration space. Signed-off-by: Alexander Matushevsky Signed-off-by: Jakub Palider Signed-off-by: Jan Medala --- diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index e2716b5a4b..11e7d8e56c 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -338,7 +338,8 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev) host_info->driver_version = (DRV_MODULE_VER_MAJOR) | (DRV_MODULE_VER_MINOR << ENA_ADMIN_HOST_INFO_MINOR_SHIFT) | - (DRV_MODULE_VER_SUBMINOR << ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT); + (DRV_MODULE_VER_SUBMINOR << + ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT); rc = ena_com_set_host_attributes(ena_dev); if (rc) { @@ -1151,6 +1152,7 @@ static int ena_device_init(struct ena_com_dev *ena_dev, struct ena_com_dev_get_features_ctx *get_feat_ctx) { int rc; + bool readless_supported; /* Initialize mmio registers */ rc = ena_com_mmio_reg_read_request_init(ena_dev); @@ -1159,6 +1161,14 @@ static int ena_device_init(struct ena_com_dev *ena_dev, return rc; } + /* The PCIe configuration space revision id indicate if mmio reg + * read is disabled. + */ + readless_supported = + !(((struct rte_pci_device *)ena_dev->dmadev)->id.class_id + & ENA_MMIO_DISABLE_REG_READ); + ena_com_set_mmio_read_mode(ena_dev, readless_supported); + /* reset device */ rc = ena_com_dev_reset(ena_dev); if (rc) { diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h index ab9667f09f..61390a93c4 100644 --- a/drivers/net/ena/ena_ethdev.h +++ b/drivers/net/ena/ena_ethdev.h @@ -54,6 +54,8 @@ #define ENA_PKT_MAX_BUFS 17 +#define ENA_MMIO_DISABLE_REG_READ BIT(0) + #define ENA_CIRC_COUNT(head, tail, size) \ (((uint16_t)((uint16_t)(head) - (uint16_t)(tail))) & ((size) - 1))