NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
doca_dev.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES, ALL RIGHTS RESERVED.
3  *
4  * This software product is a proprietary product of NVIDIA CORPORATION &
5  * AFFILIATES (the "Company") and all right, title, and interest in and to the
6  * software product, including all associated intellectual property rights, are
7  * and shall remain exclusively with the Company.
8  *
9  * This software product is governed by the End User License Agreement
10  * provided with the software product.
11  *
12  */
13 
24 #ifndef DOCA_DEV_H_
25 #define DOCA_DEV_H_
26 
27 #include <stdint.h>
28 
29 #include <doca_types.h>
30 #include <doca_compat.h>
31 #include <doca_error.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
41 struct doca_devinfo;
46 struct doca_devinfo_rep;
47 
52 struct doca_dev;
57 struct doca_dev_rep;
58 
69 };
70 
91 doca_error_t doca_devinfo_create_list(struct doca_devinfo ***dev_list, uint32_t *nb_devs);
92 
108 doca_error_t doca_devinfo_destroy_list(struct doca_devinfo **dev_list);
109 
138  int filter,
139  struct doca_devinfo_rep ***dev_list_rep,
140  uint32_t *nb_devs_rep);
141 
158 doca_error_t doca_devinfo_rep_destroy_list(struct doca_devinfo_rep **dev_list_rep);
159 
181 doca_error_t doca_dev_open(struct doca_devinfo *devinfo, struct doca_dev **dev);
182 
197 doca_error_t doca_dev_close(struct doca_dev *dev);
198 
222 
238 doca_error_t doca_dev_rep_open(struct doca_devinfo_rep *devinfo, struct doca_dev_rep **dev_rep);
239 
253 doca_error_t doca_dev_rep_close(struct doca_dev_rep *dev);
254 
267 struct doca_devinfo *doca_dev_as_devinfo(const struct doca_dev *dev);
268 
281 struct doca_devinfo_rep *doca_dev_rep_as_devinfo(struct doca_dev_rep *dev_rep);
282 
283 /*********************************************************************************************************************
284  * DOCA Local Device Info Properties
285  *********************************************************************************************************************/
289 #define DOCA_DEVINFO_VUID_SIZE 128
293 #define DOCA_DEVINFO_IPV4_ADDR_SIZE 4
297 #define DOCA_DEVINFO_IPV6_ADDR_SIZE 16
301 #define DOCA_DEVINFO_MAC_ADDR_SIZE 6
305 #define DOCA_DEVINFO_IFACE_NAME_SIZE 256
309 #define DOCA_DEVINFO_IBDEV_NAME_SIZE 64
313 #define DOCA_DEVINFO_PCI_ADDR_SIZE 13
317 #define DOCA_DEVINFO_PCI_BDF_SIZE 8
318 
337 doca_error_t doca_devinfo_get_pci_addr_str(const struct doca_devinfo *devinfo, char *pci_addr_str);
338 
359 doca_error_t doca_devinfo_is_equal_pci_addr(const struct doca_devinfo *devinfo,
360  const char *pci_addr_str,
361  uint8_t *is_equal);
362 
383 doca_error_t doca_devinfo_get_ipv4_addr(const struct doca_devinfo *devinfo, uint8_t *ipv4_addr, uint32_t size);
384 
404 doca_error_t doca_devinfo_get_ipv6_addr(const struct doca_devinfo *devinfo, uint8_t *ipv6_addr, uint32_t size);
424 doca_error_t doca_devinfo_get_mac_addr(const struct doca_devinfo *devinfo, uint8_t *mac_addr, uint32_t size);
425 
447 doca_error_t doca_devinfo_get_iface_name(const struct doca_devinfo *devinfo, char *iface_name, uint32_t size);
448 
468 doca_error_t doca_devinfo_get_ibdev_name(const struct doca_devinfo *devinfo, char *ibdev_name, uint32_t size);
469 
488 doca_error_t doca_devinfo_get_lid(const struct doca_devinfo *devinfo, uint16_t *lid);
489 
505 doca_error_t doca_devinfo_get_active_rate(const struct doca_devinfo *devinfo, uint64_t *active_rate);
506 
520 doca_error_t doca_devinfo_get_vhca_id(const struct doca_devinfo *devinfo, uint16_t *vhca_id);
521 
540  uint8_t *is_hotplug_manager);
541 
560  uint8_t *is_notification_moderation_supported);
561 
585  uint8_t *filter_all_supported);
586 
609  uint8_t *filter_net_supported);
610 
633  uint8_t *filter_emulated_supported);
634 
653  uint8_t *is_accelerate_resource_reclaim);
654 
655 /*********************************************************************************************************************
656  * DOCA Representor Device Info Properties
657  *********************************************************************************************************************/
661 #define DOCA_DEVINFO_REP_VUID_SIZE 128
665 #define DOCA_DEVINFO_REP_PCI_ADDR_SIZE 13
669 #define DOCA_DEVINFO_REP_PCI_BDF_SIZE 8
670 
690 doca_error_t doca_devinfo_rep_get_vuid(const struct doca_devinfo_rep *devinfo_rep, char *rep_vuid, uint32_t size);
691 
711 doca_error_t doca_devinfo_rep_get_pci_addr_str(const struct doca_devinfo_rep *devinfo_rep, char *pci_addr_str);
712 
729 doca_error_t doca_devinfo_rep_get_pci_func_type(const struct doca_devinfo_rep *devinfo_rep,
730  enum doca_pci_func_type *pci_func_type);
731 
744 doca_error_t doca_devinfo_rep_get_is_hotplug(const struct doca_devinfo_rep *devinfo_rep, uint8_t *is_hotplug);
745 
767 doca_error_t doca_devinfo_rep_get_iface_name(const struct doca_devinfo_rep *devinfo_rep,
768  char *iface_name,
769  uint32_t size);
770 
783 doca_error_t doca_devinfo_rep_get_vhca_id(const struct doca_devinfo_rep *devinfo_rep, uint16_t *vhca_id);
784 
806 doca_error_t doca_devinfo_rep_is_equal_pci_addr(const struct doca_devinfo_rep *devinfo_rep,
807  const char *pci_addr_str,
808  uint8_t *is_equal);
809 
810 #ifdef __cplusplus
811 }
812 #endif
813 
816 #endif /* DOCA_DEV_H_ */
#define DOCA_EXPERIMENTAL
To set a Symbol (or specifically a function) as experimental.
Definition: doca_compat.h:103
#define DOCA_STABLE
To set a Symbol (or specifically a function) as stable API, i.e. it won't be changed.
Definition: doca_compat.h:96
DOCA_EXPERIMENTAL doca_error_t doca_devinfo_cap_is_notification_moderation_supported(const struct doca_devinfo *devinfo, uint8_t *is_notification_moderation_supported)
Check if notification moderation is supported for a device.
DOCA_STABLE doca_error_t doca_devinfo_is_equal_pci_addr(const struct doca_devinfo *devinfo, const char *pci_addr_str, uint8_t *is_equal)
Check if a PCI address belongs to a DOCA devinfo.
DOCA_STABLE doca_error_t doca_dev_rep_open(struct doca_devinfo_rep *devinfo, struct doca_dev_rep **dev_rep)
Initialize representor device for use.
DOCA_STABLE doca_error_t doca_devinfo_cap_is_hotplug_manager_supported(const struct doca_devinfo *devinfo, uint8_t *is_hotplug_manager)
Get the hotplug manager capability of a DOCA devinfo.
DOCA_STABLE doca_error_t doca_devinfo_rep_destroy_list(struct doca_devinfo_rep **dev_list_rep)
Destroy list of representor device info structures.
DOCA_STABLE doca_error_t doca_devinfo_rep_create_list(struct doca_dev *dev, int filter, struct doca_devinfo_rep ***dev_list_rep, uint32_t *nb_devs_rep)
Create list of available representor devices accessible by dev.
DOCA_STABLE doca_error_t doca_devinfo_create_list(struct doca_devinfo ***dev_list, uint32_t *nb_devs)
Creates list of all available local devices.
DOCA_EXPERIMENTAL doca_error_t doca_devinfo_get_vhca_id(const struct doca_devinfo *devinfo, uint16_t *vhca_id)
Get vhca id of a device.
DOCA_STABLE doca_error_t doca_devinfo_rep_cap_is_filter_all_supported(const struct doca_devinfo *devinfo, uint8_t *filter_all_supported)
Get the representor devices discovery capability of the device.
DOCA_STABLE doca_error_t doca_dev_rep_close(struct doca_dev_rep *dev)
Destroy allocated representor device instance.
DOCA_STABLE doca_error_t doca_devinfo_rep_get_vuid(const struct doca_devinfo_rep *devinfo_rep, char *rep_vuid, uint32_t size)
Get the Vendor Unique ID of a representor DOCA devinfo.
DOCA_STABLE doca_error_t doca_devinfo_rep_get_is_hotplug(const struct doca_devinfo_rep *devinfo_rep, uint8_t *is_hotplug)
Query whether the representor device is a hotplugged device.
DOCA_STABLE doca_error_t doca_devinfo_get_ipv6_addr(const struct doca_devinfo *devinfo, uint8_t *ipv6_addr, uint32_t size)
Get the IPv6 address of a DOCA devinfo.
DOCA_STABLE doca_error_t doca_devinfo_rep_get_pci_addr_str(const struct doca_devinfo_rep *devinfo_rep, char *pci_addr_str)
Get the PCI address of a DOCA devinfo_rep.
DOCA_STABLE doca_error_t doca_devinfo_get_ibdev_name(const struct doca_devinfo *devinfo, char *ibdev_name, uint32_t size)
Get the name of the IB device represented by a DOCA devinfo.
DOCA_STABLE doca_error_t doca_devinfo_rep_cap_is_filter_emulated_supported(const struct doca_devinfo *devinfo, uint8_t *filter_emulated_supported)
Get the remote emulated device discovery capability of the device.
doca_devinfo_rep_filter
Definition: doca_dev.h:65
DOCA_STABLE doca_error_t doca_devinfo_rep_get_pci_func_type(const struct doca_devinfo_rep *devinfo_rep, enum doca_pci_func_type *pci_func_type)
Get the PCI function type of a DOCA devinfo_rep.
DOCA_EXPERIMENTAL doca_error_t doca_dev_accelerate_resource_reclaim(struct doca_dev *dev)
Accelerates the reclaim process for a local device instance.
DOCA_STABLE doca_error_t doca_devinfo_destroy_list(struct doca_devinfo **dev_list)
Destroy list of local device info structures.
DOCA_STABLE doca_error_t doca_dev_open(struct doca_devinfo *devinfo, struct doca_dev **dev)
Initialize local device for use.
DOCA_EXPERIMENTAL doca_error_t doca_devinfo_rep_get_iface_name(const struct doca_devinfo_rep *devinfo_rep, char *iface_name, uint32_t size)
Get the name of the ethernet interface of a DOCA devinfo_rep.
DOCA_STABLE doca_error_t doca_devinfo_get_mac_addr(const struct doca_devinfo *devinfo, uint8_t *mac_addr, uint32_t size)
Get the MAC address of a DOCA devinfo.
DOCA_STABLE doca_error_t doca_devinfo_get_ipv4_addr(const struct doca_devinfo *devinfo, uint8_t *ipv4_addr, uint32_t size)
Get the IPv4 address of a DOCA devinfo.
DOCA_STABLE struct doca_devinfo_rep * doca_dev_rep_as_devinfo(struct doca_dev_rep *dev_rep)
Get representor device info from device. This should be useful when wanting to query information abou...
DOCA_STABLE doca_error_t doca_devinfo_rep_is_equal_pci_addr(const struct doca_devinfo_rep *devinfo_rep, const char *pci_addr_str, uint8_t *is_equal)
Check if a PCI address belongs to a DOCA devinfo_rep.
DOCA_STABLE struct doca_devinfo * doca_dev_as_devinfo(const struct doca_dev *dev)
Get local device info from device. This should be useful when wanting to query information about devi...
DOCA_STABLE doca_error_t doca_devinfo_rep_cap_is_filter_net_supported(const struct doca_devinfo *devinfo, uint8_t *filter_net_supported)
Get the remote net discovery capability of the device.
DOCA_EXPERIMENTAL doca_error_t doca_devinfo_cap_is_accelerate_resource_reclaim_supported(const struct doca_devinfo *devinfo, uint8_t *is_accelerate_resource_reclaim)
Get the accelerate resource reclaim capability of a DOCA devinfo.
DOCA_STABLE doca_error_t doca_devinfo_get_lid(const struct doca_devinfo *devinfo, uint16_t *lid)
Get the port LID of a DOCA devinfo.
DOCA_STABLE doca_error_t doca_devinfo_get_iface_name(const struct doca_devinfo *devinfo, char *iface_name, uint32_t size)
Get the name of the ethernet interface of a DOCA devinfo.
DOCA_STABLE doca_error_t doca_devinfo_get_pci_addr_str(const struct doca_devinfo *devinfo, char *pci_addr_str)
Get the PCI address of a DOCA devinfo.
DOCA_STABLE doca_error_t doca_dev_close(struct doca_dev *dev)
Destroy allocated local device instance.
DOCA_EXPERIMENTAL doca_error_t doca_devinfo_rep_get_vhca_id(const struct doca_devinfo_rep *devinfo_rep, uint16_t *vhca_id)
Get vhca id of a DOCA devinfo_rep.
DOCA_EXPERIMENTAL doca_error_t doca_devinfo_get_active_rate(const struct doca_devinfo *devinfo, uint64_t *active_rate)
Get the active rate of a DOCA devinfo.
@ DOCA_DEVINFO_REP_FILTER_ALL
Definition: doca_dev.h:66
@ DOCA_DEVINFO_REP_FILTER_EMULATED
Definition: doca_dev.h:68
@ DOCA_DEVINFO_REP_FILTER_NET
Definition: doca_dev.h:67
enum doca_error doca_error_t
DOCA API return codes.
doca_pci_func_type
Specifies the PCI function type for DOCA representor device.
Definition: doca_types.h:105