]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/udev/net/link-config.h
udevd: Add ReceivePacketSteeringCPUMask for systemd.link
[thirdparty/systemd.git] / src / udev / net / link-config.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
0ef6f454
LP
2#pragma once
3
e5eadf53 4#include "sd-device.h"
751dcd8d 5#include "sd-netlink.h"
07630cea 6
134e56dc 7#include "condition.h"
538f15cf 8#include "conf-parser.h"
0f30bf58 9#include "cpu-set-util.h"
07630cea 10#include "ethtool-util.h"
bd29dfef 11#include "hashmap.h"
af6f0d42 12#include "list.h"
5722fb89 13#include "net-condition.h"
ff516b43 14#include "netif-naming-scheme.h"
af6f0d42 15
afca7ac1 16typedef struct LinkConfigContext LinkConfigContext;
ce01c07f 17typedef struct LinkConfig LinkConfig;
af6f0d42 18
54ed9f88
ZJS
19typedef enum MACAddressPolicy {
20 MAC_ADDRESS_POLICY_PERSISTENT,
21 MAC_ADDRESS_POLICY_RANDOM,
22 MAC_ADDRESS_POLICY_NONE,
23 _MAC_ADDRESS_POLICY_MAX,
2d93c20e 24 _MAC_ADDRESS_POLICY_INVALID = -EINVAL,
54ed9f88 25} MACAddressPolicy;
5fde13d7 26
613701a4
YW
27typedef struct Link {
28 int ifindex;
29 const char *ifname;
30 const char *new_name;
9094ae52 31 char **altnames;
613701a4
YW
32
33 LinkConfig *config;
34 sd_device *device;
046286e8 35 sd_device *device_db_clone;
613701a4
YW
36 sd_device_action_t action;
37
65022cd7 38 char *kind;
2b5b25f1 39 const char *driver;
613701a4
YW
40 uint16_t iftype;
41 uint32_t flags;
42 struct hw_addr_data hw_addr;
43 struct hw_addr_data permanent_hw_addr;
44 unsigned name_assign_type;
45 unsigned addr_assign_type;
46} Link;
47
ce01c07f 48struct LinkConfig {
af6f0d42 49 char *filename;
a2640646 50 char **dropins;
af6f0d42 51
5722fb89 52 NetMatch match;
1beabe08 53 LIST_HEAD(Condition, conditions);
af6f0d42
TG
54
55 char *description;
046286e8
YW
56 char **properties;
57 char **import_properties;
58 char **unset_properties;
9e2b7763 59 struct hw_addr_data hw_addr;
54ed9f88 60 MACAddressPolicy mac_address_policy;
5fde13d7 61 NamePolicy *name_policy;
ef1d2c07 62 NamePolicy *alternative_names_policy;
43b3a5ef 63 char *name;
a5053a15 64 char **alternative_names;
d2df0d0e 65 char *alias;
face9fcc
YW
66 uint32_t txqueues;
67 uint32_t rxqueues;
ef4a91a7 68 uint32_t txqueuelen;
4e964aa0 69 uint32_t mtu;
1e270127
SS
70 uint32_t gso_max_segments;
71 size_t gso_max_size;
50299121 72 uint64_t speed;
5fde13d7 73 Duplex duplex;
a39f92d3 74 int autonegotiation;
5c2316c6 75 uint32_t advertise[N_ADVERTISE];
c50404ae 76 uint32_t wol;
d3867133
YW
77 char *wol_password_file;
78 uint8_t *wol_password;
593022fa 79 NetDevPort port;
cc2ff878 80 int features[_NET_DEV_FEAT_MAX];
5f945202 81 netdev_channels channels;
224ded67 82 netdev_ring_param ring;
a34811e4
YW
83 int rx_flow_control;
84 int tx_flow_control;
85 int autoneg_flow_control;
6c35ea5e 86 netdev_coalesce_param coalesce;
18f84f8a 87 uint8_t mdi;
0f30bf58 88 CPUSet *rps_cpu_mask;
af6f0d42 89
41ce9d76 90 uint32_t sr_iov_num_vfs;
bd29dfef
YW
91 OrderedHashmap *sr_iov_by_section;
92
418c02c3 93 LIST_FIELDS(LinkConfig, configs);
af6f0d42
TG
94};
95
afca7ac1
YW
96int link_config_ctx_new(LinkConfigContext **ret);
97LinkConfigContext* link_config_ctx_free(LinkConfigContext *ctx);
98DEFINE_TRIVIAL_CLEANUP_FUNC(LinkConfigContext*, link_config_ctx_free);
af6f0d42 99
afca7ac1
YW
100int link_load_one(LinkConfigContext *ctx, const char *filename);
101int link_config_load(LinkConfigContext *ctx);
102bool link_config_should_reload(LinkConfigContext *ctx);
af6f0d42 103
046286e8 104int link_new(LinkConfigContext *ctx, sd_netlink **rtnl, sd_device *device, sd_device *device_db_clone, Link **ret);
613701a4
YW
105Link *link_free(Link *link);
106DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);
107
108int link_get_config(LinkConfigContext *ctx, Link *link);
3e00171d 109int link_apply_config(LinkConfigContext *ctx, sd_netlink **rtnl, Link *link, bool test);
847a8a5f 110
54ed9f88
ZJS
111const char *mac_address_policy_to_string(MACAddressPolicy p) _const_;
112MACAddressPolicy mac_address_policy_from_string(const char *p) _pure_;
5fde13d7 113
af6f0d42 114/* gperf lookup function */
c9f7b4d3 115const struct ConfigPerfItem* link_config_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
5fde13d7 116
046286e8
YW
117CONFIG_PARSER_PROTOTYPE(config_parse_udev_property);
118CONFIG_PARSER_PROTOTYPE(config_parse_udev_property_name);
fc27088a 119CONFIG_PARSER_PROTOTYPE(config_parse_ifalias);
face9fcc 120CONFIG_PARSER_PROTOTYPE(config_parse_rx_tx_queues);
ef4a91a7 121CONFIG_PARSER_PROTOTYPE(config_parse_txqueuelen);
d3867133 122CONFIG_PARSER_PROTOTYPE(config_parse_wol_password);
54ed9f88 123CONFIG_PARSER_PROTOTYPE(config_parse_mac_address_policy);
538f15cf 124CONFIG_PARSER_PROTOTYPE(config_parse_name_policy);
ef1d2c07 125CONFIG_PARSER_PROTOTYPE(config_parse_alternative_names_policy);
0f30bf58 126CONFIG_PARSER_PROTOTYPE(config_parse_rps_cpu_mask);