bus/vmbus: make driver-only headers private
The vmbus bus interface is for drivers only. Mark as internal and move the header in the driver headers list. While at it, cleanup the code: - fix indentation, - remove unneeded reference to bus specific singleton object, - remove unneeded list head structure type, - reorder the definitions and macro manipulating the bus singleton object, - remove inclusion of rte_bus.h and fix the code that relied on implicit inclusion, Signed-off-by: David Marchand <david.marchand@redhat.com>
This commit is contained in:
parent
4851ef2b40
commit
84aaf06d81
@ -89,7 +89,7 @@ API Changes
|
||||
to update their code.
|
||||
|
||||
* drivers: Registering a driver on the ``auxiliary``, ``ifpga``, ``pci``,
|
||||
``vdev`` buses has been marked as an internal API.
|
||||
``vdev``, ``vmbus`` buses has been marked as an internal API.
|
||||
External users may still register their driver using the associated driver
|
||||
headers (see ``enable_driver_sdk`` meson option).
|
||||
|
||||
|
106
drivers/bus/vmbus/bus_vmbus_driver.h
Normal file
106
drivers/bus/vmbus/bus_vmbus_driver.h
Normal file
@ -0,0 +1,106 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
* Copyright (c) 2018, Microsoft Corporation.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef BUS_VMBUS_DRIVER_H
|
||||
#define BUS_VMBUS_DRIVER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rte_bus_vmbus.h>
|
||||
#include <rte_compat.h>
|
||||
#include <rte_dev.h>
|
||||
|
||||
struct vmbus_channel;
|
||||
struct vmbus_mon_page;
|
||||
|
||||
/** Maximum number of VMBUS resources. */
|
||||
enum hv_uio_map {
|
||||
HV_TXRX_RING_MAP = 0,
|
||||
HV_INT_PAGE_MAP,
|
||||
HV_MON_PAGE_MAP,
|
||||
HV_RECV_BUF_MAP,
|
||||
HV_SEND_BUF_MAP
|
||||
};
|
||||
#define VMBUS_MAX_RESOURCE 5
|
||||
|
||||
/**
|
||||
* A structure describing a VMBUS device.
|
||||
*/
|
||||
struct rte_vmbus_device {
|
||||
RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
|
||||
const struct rte_vmbus_driver *driver; /**< Associated driver */
|
||||
struct rte_device device; /**< Inherit core device */
|
||||
rte_uuid_t device_id; /**< VMBUS device id */
|
||||
rte_uuid_t class_id; /**< VMBUS device type */
|
||||
uint32_t relid; /**< id for primary */
|
||||
uint8_t monitor_id; /**< monitor page */
|
||||
int uio_num; /**< UIO device number */
|
||||
uint32_t *int_page; /**< VMBUS interrupt page */
|
||||
struct vmbus_channel *primary; /**< VMBUS primary channel */
|
||||
struct vmbus_mon_page *monitor_page; /**< VMBUS monitor page */
|
||||
|
||||
struct rte_intr_handle *intr_handle; /**< Interrupt handle */
|
||||
struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialization function for the driver called during VMBUS probing.
|
||||
*/
|
||||
typedef int (vmbus_probe_t)(struct rte_vmbus_driver *,
|
||||
struct rte_vmbus_device *);
|
||||
|
||||
/**
|
||||
* Initialization function for the driver called during hot plugging.
|
||||
*/
|
||||
typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
|
||||
|
||||
/**
|
||||
* A structure describing a VMBUS driver.
|
||||
*/
|
||||
struct rte_vmbus_driver {
|
||||
RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
|
||||
struct rte_driver driver;
|
||||
vmbus_probe_t *probe; /**< Device Probe function. */
|
||||
vmbus_remove_t *remove; /**< Device Remove function. */
|
||||
|
||||
const rte_uuid_t *id_table; /**< ID table. */
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a VMBUS driver.
|
||||
*
|
||||
* @param driver
|
||||
* A pointer to a rte_vmbus_driver structure describing the driver
|
||||
* to be registered.
|
||||
*/
|
||||
__rte_internal
|
||||
void rte_vmbus_register(struct rte_vmbus_driver *driver);
|
||||
|
||||
/**
|
||||
* Unregister a VMBUS driver.
|
||||
*
|
||||
* @param driver
|
||||
* A pointer to a rte_vmbus_driver structure describing the driver
|
||||
* to be unregistered.
|
||||
*/
|
||||
__rte_internal
|
||||
void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
|
||||
|
||||
/** Helper for VMBUS device registration from driver instance */
|
||||
#define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv) \
|
||||
RTE_INIT(vmbusinitfn_ ##nm) \
|
||||
{ \
|
||||
(vmbus_drv).driver.name = RTE_STR(nm); \
|
||||
rte_vmbus_register(&vmbus_drv); \
|
||||
} \
|
||||
RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BUS_VMBUS_DRIVER_H */
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include <rte_eal.h>
|
||||
#include <rte_log.h>
|
||||
#include <rte_bus.h>
|
||||
#include <rte_memory.h>
|
||||
#include <rte_common.h>
|
||||
#include <rte_malloc.h>
|
||||
|
@ -8,6 +8,7 @@ endif
|
||||
|
||||
|
||||
headers = files('rte_bus_vmbus.h','rte_vmbus_reg.h')
|
||||
driver_sdk_headers = files('bus_vmbus_driver.h')
|
||||
|
||||
sources = files(
|
||||
'vmbus_bufring.c',
|
||||
|
@ -8,13 +8,31 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include <rte_bus.h>
|
||||
#include <bus_vmbus_driver.h>
|
||||
#include <rte_log.h>
|
||||
#include <rte_eal_paging.h>
|
||||
#include <rte_vmbus_reg.h>
|
||||
#include <rte_bus_vmbus.h>
|
||||
|
||||
/**
|
||||
* Structure describing the VM bus
|
||||
*/
|
||||
struct rte_vmbus_bus {
|
||||
struct rte_bus bus; /**< Inherit the generic class */
|
||||
RTE_TAILQ_HEAD(, rte_vmbus_device) device_list; /**< List of devices */
|
||||
RTE_TAILQ_HEAD(, rte_vmbus_driver) driver_list; /**< List of drivers */
|
||||
};
|
||||
|
||||
extern struct rte_vmbus_bus rte_vmbus_bus;
|
||||
|
||||
/* VMBus iterators */
|
||||
#define FOREACH_DEVICE_ON_VMBUS(p) \
|
||||
RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
|
||||
|
||||
#define FOREACH_DRIVER_ON_VMBUS(p) \
|
||||
RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
|
||||
|
||||
extern int vmbus_logtype_bus;
|
||||
#define VMBUS_LOG(level, fmt, args...) \
|
||||
rte_log(RTE_LOG_ ## level, vmbus_logtype_bus, "%s(): " fmt "\n", \
|
||||
|
@ -27,89 +27,12 @@ extern "C" {
|
||||
#include <rte_uuid.h>
|
||||
#include <rte_debug.h>
|
||||
#include <rte_interrupts.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vmbus_reg.h>
|
||||
|
||||
/* Forward declarations */
|
||||
struct rte_vmbus_device;
|
||||
struct rte_vmbus_driver;
|
||||
struct rte_vmbus_bus;
|
||||
struct vmbus_channel;
|
||||
struct vmbus_mon_page;
|
||||
|
||||
RTE_TAILQ_HEAD(rte_vmbus_device_list, rte_vmbus_device);
|
||||
RTE_TAILQ_HEAD(rte_vmbus_driver_list, rte_vmbus_driver);
|
||||
|
||||
/* VMBus iterators */
|
||||
#define FOREACH_DEVICE_ON_VMBUS(p) \
|
||||
RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.device_list), next)
|
||||
|
||||
#define FOREACH_DRIVER_ON_VMBUS(p) \
|
||||
RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next)
|
||||
|
||||
/** Maximum number of VMBUS resources. */
|
||||
enum hv_uio_map {
|
||||
HV_TXRX_RING_MAP = 0,
|
||||
HV_INT_PAGE_MAP,
|
||||
HV_MON_PAGE_MAP,
|
||||
HV_RECV_BUF_MAP,
|
||||
HV_SEND_BUF_MAP
|
||||
};
|
||||
#define VMBUS_MAX_RESOURCE 5
|
||||
|
||||
/**
|
||||
* A structure describing a VMBUS device.
|
||||
*/
|
||||
struct rte_vmbus_device {
|
||||
RTE_TAILQ_ENTRY(rte_vmbus_device) next; /**< Next probed VMBUS device */
|
||||
const struct rte_vmbus_driver *driver; /**< Associated driver */
|
||||
struct rte_device device; /**< Inherit core device */
|
||||
rte_uuid_t device_id; /**< VMBUS device id */
|
||||
rte_uuid_t class_id; /**< VMBUS device type */
|
||||
uint32_t relid; /**< id for primary */
|
||||
uint8_t monitor_id; /**< monitor page */
|
||||
int uio_num; /**< UIO device number */
|
||||
uint32_t *int_page; /**< VMBUS interrupt page */
|
||||
struct vmbus_channel *primary; /**< VMBUS primary channel */
|
||||
struct vmbus_mon_page *monitor_page; /**< VMBUS monitor page */
|
||||
|
||||
struct rte_intr_handle *intr_handle; /**< Interrupt handle */
|
||||
struct rte_mem_resource resource[VMBUS_MAX_RESOURCE];
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialization function for the driver called during VMBUS probing.
|
||||
*/
|
||||
typedef int (vmbus_probe_t)(struct rte_vmbus_driver *,
|
||||
struct rte_vmbus_device *);
|
||||
|
||||
/**
|
||||
* Initialization function for the driver called during hot plugging.
|
||||
*/
|
||||
typedef int (vmbus_remove_t)(struct rte_vmbus_device *);
|
||||
|
||||
/**
|
||||
* A structure describing a VMBUS driver.
|
||||
*/
|
||||
struct rte_vmbus_driver {
|
||||
RTE_TAILQ_ENTRY(rte_vmbus_driver) next; /**< Next in list. */
|
||||
struct rte_driver driver;
|
||||
struct rte_vmbus_bus *bus; /**< VM bus reference. */
|
||||
vmbus_probe_t *probe; /**< Device Probe function. */
|
||||
vmbus_remove_t *remove; /**< Device Remove function. */
|
||||
|
||||
const rte_uuid_t *id_table; /**< ID table. */
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Structure describing the VM bus
|
||||
*/
|
||||
struct rte_vmbus_bus {
|
||||
struct rte_bus bus; /**< Inherit the generic class */
|
||||
struct rte_vmbus_device_list device_list; /**< List of devices */
|
||||
struct rte_vmbus_driver_list driver_list; /**< List of drivers */
|
||||
};
|
||||
|
||||
/**
|
||||
* Scan the content of the VMBUS bus, and the devices in the devices
|
||||
@ -378,15 +301,6 @@ void rte_vmbus_set_latency(const struct rte_vmbus_device *dev,
|
||||
const struct vmbus_channel *chan,
|
||||
uint32_t latency);
|
||||
|
||||
/**
|
||||
* Register a VMBUS driver.
|
||||
*
|
||||
* @param driver
|
||||
* A pointer to a rte_vmbus_driver structure describing the driver
|
||||
* to be registered.
|
||||
*/
|
||||
void rte_vmbus_register(struct rte_vmbus_driver *driver);
|
||||
|
||||
/**
|
||||
* For debug dump contents of ring buffer.
|
||||
*
|
||||
@ -395,24 +309,6 @@ void rte_vmbus_register(struct rte_vmbus_driver *driver);
|
||||
*/
|
||||
void rte_vmbus_chan_dump(FILE *f, const struct vmbus_channel *chan);
|
||||
|
||||
/**
|
||||
* Unregister a VMBUS driver.
|
||||
*
|
||||
* @param driver
|
||||
* A pointer to a rte_vmbus_driver structure describing the driver
|
||||
* to be unregistered.
|
||||
*/
|
||||
void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
|
||||
|
||||
/** Helper for VMBUS device registration from driver instance */
|
||||
#define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv) \
|
||||
RTE_INIT(vmbusinitfn_ ##nm) \
|
||||
{ \
|
||||
(vmbus_drv).driver.name = RTE_STR(nm); \
|
||||
rte_vmbus_register(&vmbus_drv); \
|
||||
} \
|
||||
RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -16,13 +16,18 @@ DPDK_23 {
|
||||
rte_vmbus_map_device;
|
||||
rte_vmbus_max_channels;
|
||||
rte_vmbus_probe;
|
||||
rte_vmbus_register;
|
||||
rte_vmbus_scan;
|
||||
rte_vmbus_set_latency;
|
||||
rte_vmbus_sub_channel_index;
|
||||
rte_vmbus_subchan_open;
|
||||
rte_vmbus_unmap_device;
|
||||
rte_vmbus_unregister;
|
||||
|
||||
local: *;
|
||||
};
|
||||
|
||||
INTERNAL {
|
||||
global:
|
||||
|
||||
rte_vmbus_register;
|
||||
rte_vmbus_unregister;
|
||||
};
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <rte_tailq.h>
|
||||
#include <rte_log.h>
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_bus.h>
|
||||
#include <rte_atomic.h>
|
||||
#include <rte_memory.h>
|
||||
#include <rte_pause.h>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <rte_tailq.h>
|
||||
#include <rte_log.h>
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_bus.h>
|
||||
#include <rte_atomic.h>
|
||||
#include <rte_memory.h>
|
||||
#include <rte_bus_vmbus.h>
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <rte_log.h>
|
||||
#include <rte_bus.h>
|
||||
#include <rte_eal.h>
|
||||
#include <rte_tailq.h>
|
||||
#include <rte_devargs.h>
|
||||
@ -235,7 +234,6 @@ rte_vmbus_register(struct rte_vmbus_driver *driver)
|
||||
"Registered driver %s", driver->driver.name);
|
||||
|
||||
TAILQ_INSERT_TAIL(&rte_vmbus_bus.driver_list, driver, next);
|
||||
driver->bus = &rte_vmbus_bus;
|
||||
}
|
||||
|
||||
/* unregister vmbus driver */
|
||||
@ -243,7 +241,6 @@ void
|
||||
rte_vmbus_unregister(struct rte_vmbus_driver *driver)
|
||||
{
|
||||
TAILQ_REMOVE(&rte_vmbus_bus.driver_list, driver, next);
|
||||
driver->bus = NULL;
|
||||
}
|
||||
|
||||
/* Add a device to VMBUS bus */
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <rte_tailq.h>
|
||||
#include <rte_log.h>
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_bus.h>
|
||||
#include <rte_bus_vmbus.h>
|
||||
|
||||
#include "private.h"
|
||||
|
@ -31,7 +31,8 @@
|
||||
#include <rte_memory.h>
|
||||
#include <rte_eal.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_bus_vmbus.h>
|
||||
#include <rte_bus.h>
|
||||
#include <bus_vmbus_driver.h>
|
||||
#include <rte_alarm.h>
|
||||
|
||||
#include "hn_logs.h"
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <rte_memory.h>
|
||||
#include <rte_eal.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_bus_vmbus.h>
|
||||
#include <bus_vmbus_driver.h>
|
||||
|
||||
#include "hn_logs.h"
|
||||
#include "hn_var.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <rte_memory.h>
|
||||
#include <rte_eal.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_bus_vmbus.h>
|
||||
#include <bus_vmbus_driver.h>
|
||||
|
||||
#include "hn_logs.h"
|
||||
#include "hn_var.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <rte_eal.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_net.h>
|
||||
#include <rte_bus_vmbus.h>
|
||||
#include <bus_vmbus_driver.h>
|
||||
#include <rte_spinlock.h>
|
||||
|
||||
#include "hn_logs.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <ethdev_driver.h>
|
||||
#include <rte_lcore.h>
|
||||
#include <rte_memory.h>
|
||||
#include <rte_bus_vmbus.h>
|
||||
#include <bus_vmbus_driver.h>
|
||||
#include <rte_pci.h>
|
||||
#include <bus_pci_driver.h>
|
||||
#include <rte_log.h>
|
||||
|
Loading…
Reference in New Issue
Block a user