[v4] net/gve: check driver compatibility
Ferruh Yigit
ferruh.yigit at amd.com
Mon May 22 10:52:15 CEST 2023
On 5/19/2023 9:46 PM, Rushil Gupta wrote:
> +static int
> +gve_verify_driver_compatibility(struct gve_priv *priv)
> +{
> + const struct rte_memzone *driver_info_mem;
> + struct gve_driver_info *driver_info;
> + int err;
> +
> + driver_info_mem = rte_memzone_reserve_aligned("verify_driver_compatibility",
> + sizeof(struct gve_driver_info),
> + rte_socket_id(),
> + RTE_MEMZONE_IOVA_CONTIG, PAGE_SIZE);
> +
> + if (driver_info_mem == NULL) {
> + PMD_DRV_LOG(ERR,
> + "Could not alloc memzone for driver compatibility");
> + return -ENOMEM;
> + }
> + driver_info = (struct gve_driver_info *)driver_info_mem->addr;
> +
> + *driver_info = (struct gve_driver_info) {
> + .os_type = 5, /* DPDK */
> + .driver_major = GVE_VERSION_MAJOR,
> + .driver_minor = GVE_VERSION_MINOR,
> + .driver_sub = GVE_VERSION_SUB,
> + .os_version_major = cpu_to_be32(DPDK_VERSION_MAJOR),
> + .os_version_minor = cpu_to_be32(DPDK_VERSION_MINOR),
> + .os_version_sub = cpu_to_be32(DPDK_VERSION_SUB),
> + .driver_capability_flags = {
> + cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS1),
> + cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS2),
> + cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS3),
> + cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS4),
> + },
> + };
> +
> + populate_driver_version_strings((char *)driver_info->os_version_str1,
> + (char *)driver_info->os_version_str2);
> +
> + err = gve_adminq_verify_driver_compatibility(priv,
> + sizeof(struct gve_driver_info), (dma_addr_t)driver_info);
Back to previous discussion, other commands pass physical address to the
admin command, but this pass virtual address.
To follow the same semantic, shouldn't above be 'driver_info_mem.iova'?
I asked before but not able to get an answer, what is the memory type
requirement for device?
Why virtual address obtained via 'calloc()' is not working, but virtual
address from hugepages are working?
More information about the dev
mailing list