Commit 095f2f1f authored by Arthur Kiyanovski's avatar Arthur Kiyanovski Committed by David S. Miller

net: ena: complete host info to match latest ENA spec

Add new fields and definitions to host info and fill them
according to the latest ENA spec version.
Signed-off-by: default avatarArthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0e575f85
...@@ -63,6 +63,8 @@ enum ena_admin_aq_completion_status { ...@@ -63,6 +63,8 @@ enum ena_admin_aq_completion_status {
ENA_ADMIN_ILLEGAL_PARAMETER = 5, ENA_ADMIN_ILLEGAL_PARAMETER = 5,
ENA_ADMIN_UNKNOWN_ERROR = 6, ENA_ADMIN_UNKNOWN_ERROR = 6,
ENA_ADMIN_RESOURCE_BUSY = 7,
}; };
enum ena_admin_aq_feature_id { enum ena_admin_aq_feature_id {
...@@ -702,6 +704,10 @@ enum ena_admin_os_type { ...@@ -702,6 +704,10 @@ enum ena_admin_os_type {
ENA_ADMIN_OS_FREEBSD = 4, ENA_ADMIN_OS_FREEBSD = 4,
ENA_ADMIN_OS_IPXE = 5, ENA_ADMIN_OS_IPXE = 5,
ENA_ADMIN_OS_ESXI = 6,
ENA_ADMIN_OS_GROUPS_NUM = 6,
}; };
struct ena_admin_host_info { struct ena_admin_host_info {
...@@ -723,11 +729,27 @@ struct ena_admin_host_info { ...@@ -723,11 +729,27 @@ struct ena_admin_host_info {
/* 7:0 : major /* 7:0 : major
* 15:8 : minor * 15:8 : minor
* 23:16 : sub_minor * 23:16 : sub_minor
* 31:24 : module_type
*/ */
u32 driver_version; u32 driver_version;
/* features bitmap */ /* features bitmap */
u32 supported_network_features[4]; u32 supported_network_features[2];
/* ENA spec version of driver */
u16 ena_spec_version;
/* ENA device's Bus, Device and Function
* 2:0 : function
* 7:3 : device
* 15:8 : bus
*/
u16 bdf;
/* Number of CPUs */
u16 num_cpus;
u16 reserved;
}; };
struct ena_admin_rss_ind_table_entry { struct ena_admin_rss_ind_table_entry {
...@@ -1008,6 +1030,13 @@ struct ena_admin_ena_mmio_req_read_less_resp { ...@@ -1008,6 +1030,13 @@ struct ena_admin_ena_mmio_req_read_less_resp {
#define ENA_ADMIN_HOST_INFO_MINOR_MASK GENMASK(15, 8) #define ENA_ADMIN_HOST_INFO_MINOR_MASK GENMASK(15, 8)
#define ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT 16 #define ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT 16
#define ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK GENMASK(23, 16) #define ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK GENMASK(23, 16)
#define ENA_ADMIN_HOST_INFO_MODULE_TYPE_SHIFT 24
#define ENA_ADMIN_HOST_INFO_MODULE_TYPE_MASK GENMASK(31, 24)
#define ENA_ADMIN_HOST_INFO_FUNCTION_MASK GENMASK(2, 0)
#define ENA_ADMIN_HOST_INFO_DEVICE_SHIFT 3
#define ENA_ADMIN_HOST_INFO_DEVICE_MASK GENMASK(7, 3)
#define ENA_ADMIN_HOST_INFO_BUS_SHIFT 8
#define ENA_ADMIN_HOST_INFO_BUS_MASK GENMASK(15, 8)
/* aenq_common_desc */ /* aenq_common_desc */
#define ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK BIT(0) #define ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK BIT(0)
......
...@@ -41,9 +41,6 @@ ...@@ -41,9 +41,6 @@
#define ENA_ASYNC_QUEUE_DEPTH 16 #define ENA_ASYNC_QUEUE_DEPTH 16
#define ENA_ADMIN_QUEUE_DEPTH 32 #define ENA_ADMIN_QUEUE_DEPTH 32
#define MIN_ENA_VER (((ENA_COMMON_SPEC_VERSION_MAJOR) << \
ENA_REGS_VERSION_MAJOR_VERSION_SHIFT) \
| (ENA_COMMON_SPEC_VERSION_MINOR))
#define ENA_CTRL_MAJOR 0 #define ENA_CTRL_MAJOR 0
#define ENA_CTRL_MINOR 0 #define ENA_CTRL_MINOR 0
...@@ -1400,11 +1397,6 @@ int ena_com_validate_version(struct ena_com_dev *ena_dev) ...@@ -1400,11 +1397,6 @@ int ena_com_validate_version(struct ena_com_dev *ena_dev)
ENA_REGS_VERSION_MAJOR_VERSION_SHIFT, ENA_REGS_VERSION_MAJOR_VERSION_SHIFT,
ver & ENA_REGS_VERSION_MINOR_VERSION_MASK); ver & ENA_REGS_VERSION_MINOR_VERSION_MASK);
if (ver < MIN_ENA_VER) {
pr_err("ENA version is lower than the minimal version the driver supports\n");
return -1;
}
pr_info("ena controller version: %d.%d.%d implementation version %d\n", pr_info("ena controller version: %d.%d.%d implementation version %d\n",
(ctrl_ver & ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_MASK) >> (ctrl_ver & ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_MASK) >>
ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_SHIFT, ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_SHIFT,
...@@ -2441,6 +2433,10 @@ int ena_com_allocate_host_info(struct ena_com_dev *ena_dev) ...@@ -2441,6 +2433,10 @@ int ena_com_allocate_host_info(struct ena_com_dev *ena_dev)
if (unlikely(!host_attr->host_info)) if (unlikely(!host_attr->host_info))
return -ENOMEM; return -ENOMEM;
host_attr->host_info->ena_spec_version =
((ENA_COMMON_SPEC_VERSION_MAJOR << ENA_REGS_VERSION_MAJOR_VERSION_SHIFT) |
(ENA_COMMON_SPEC_VERSION_MINOR));
return 0; return 0;
} }
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#ifndef _ENA_COMMON_H_ #ifndef _ENA_COMMON_H_
#define _ENA_COMMON_H_ #define _ENA_COMMON_H_
#define ENA_COMMON_SPEC_VERSION_MAJOR 0 /* */ #define ENA_COMMON_SPEC_VERSION_MAJOR 2
#define ENA_COMMON_SPEC_VERSION_MINOR 10 /* */ #define ENA_COMMON_SPEC_VERSION_MINOR 0
/* ENA operates with 48-bit memory addresses. ena_mem_addr_t */ /* ENA operates with 48-bit memory addresses. ena_mem_addr_t */
struct ena_common_mem_addr { struct ena_common_mem_addr {
......
...@@ -2201,7 +2201,8 @@ static u16 ena_select_queue(struct net_device *dev, struct sk_buff *skb, ...@@ -2201,7 +2201,8 @@ static u16 ena_select_queue(struct net_device *dev, struct sk_buff *skb,
return qid; return qid;
} }
static void ena_config_host_info(struct ena_com_dev *ena_dev) static void ena_config_host_info(struct ena_com_dev *ena_dev,
struct pci_dev *pdev)
{ {
struct ena_admin_host_info *host_info; struct ena_admin_host_info *host_info;
int rc; int rc;
...@@ -2215,6 +2216,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev) ...@@ -2215,6 +2216,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev)
host_info = ena_dev->host_attr.host_info; host_info = ena_dev->host_attr.host_info;
host_info->bdf = (pdev->bus->number << 8) | pdev->devfn;
host_info->os_type = ENA_ADMIN_OS_LINUX; host_info->os_type = ENA_ADMIN_OS_LINUX;
host_info->kernel_ver = LINUX_VERSION_CODE; host_info->kernel_ver = LINUX_VERSION_CODE;
strncpy(host_info->kernel_ver_str, utsname()->version, strncpy(host_info->kernel_ver_str, utsname()->version,
...@@ -2225,7 +2227,9 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev) ...@@ -2225,7 +2227,9 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev)
host_info->driver_version = host_info->driver_version =
(DRV_MODULE_VER_MAJOR) | (DRV_MODULE_VER_MAJOR) |
(DRV_MODULE_VER_MINOR << ENA_ADMIN_HOST_INFO_MINOR_SHIFT) | (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) |
("K"[0] << ENA_ADMIN_HOST_INFO_MODULE_TYPE_SHIFT);
host_info->num_cpus = num_online_cpus();
rc = ena_com_set_host_attributes(ena_dev); rc = ena_com_set_host_attributes(ena_dev);
if (rc) { if (rc) {
...@@ -2449,7 +2453,7 @@ static int ena_device_init(struct ena_com_dev *ena_dev, struct pci_dev *pdev, ...@@ -2449,7 +2453,7 @@ 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_com_set_admin_polling_mode(ena_dev, true);
ena_config_host_info(ena_dev); ena_config_host_info(ena_dev, pdev);
/* Get Device Attributes*/ /* Get Device Attributes*/
rc = ena_com_get_dev_attr_feat(ena_dev, get_feat_ctx); rc = ena_com_get_dev_attr_feat(ena_dev, get_feat_ctx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment