-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathena_devlink.h
More file actions
45 lines (39 loc) · 1.58 KB
/
ena_devlink.h
File metadata and controls
45 lines (39 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/* Copyright (c) Amazon.com, Inc. or its affiliates.
* All rights reserved.
*/
#ifndef DEVLINK_H
#define DEVLINK_H
#include "ena_netdev.h"
#ifdef ENA_HAS_DEVLINK_HEADERS
#include <net/devlink.h>
#endif /* ENA_HAS_DEVLINK_HEADERS */
#ifdef ENA_DEVLINK_SUPPORT
#define ENA_DEVLINK_PRIV(devlink) \
(*(struct ena_adapter **)devlink_priv(devlink))
struct devlink *ena_devlink_alloc(struct ena_adapter *adapter);
void ena_devlink_free(struct devlink *devlink);
void ena_devlink_register(struct devlink *devlink, struct device *dev);
void ena_devlink_unregister(struct devlink *devlink);
void ena_devlink_params_get(struct devlink *devlink);
#ifdef ENA_PHC_SUPPORT
void ena_devlink_disable_phc_param(struct devlink *devlink);
#endif /* ENA_PHC_SUPPORT */
#else /* ENA_DEVLINK_SUPPORT */
#ifndef ENA_HAS_DEVLINK_HEADERS
struct devlink {};
#endif /* ENA_HAS_DEVLINK_HEADERS */
/* Return a value of 1 so the caller wouldn't think the function failed (returned NULL) */
static inline struct devlink *ena_devlink_alloc(struct ena_adapter *adapter)
{
return (struct devlink *)1;
}
static inline void ena_devlink_free(struct devlink *devlink) { }
static inline void ena_devlink_register(struct devlink *devlink, struct device *dev) { }
static inline void ena_devlink_unregister(struct devlink *devlink) { }
static inline void ena_devlink_params_get(struct devlink *devlink) {}
#ifdef ENA_PHC_SUPPORT
static inline void ena_devlink_disable_phc_param(struct devlink *devlink) {}
#endif /* ENA_PHC_SUPPORT */
#endif /* ENA_DEVLINK_SUPPORT */
#endif /* DEVLINK_H */