ports.h (1080B)
1 #ifndef __LINKD_CONFIG_PORTS_H__ 2 #define __LINKD_CONFIG_PORTS_H__ 3 4 #include <stdint.h> 5 #include <stdio.h> 6 7 #include "finwo/cnfparse.h" 8 9 #include "dataplane.h" 10 11 // Switch port physical-layer configuration. 12 // 13 // Scope is deliberately narrow. Addresses, MTU, MAC and admin state are all 14 // handled by ifupdown via /etc/network/interfaces{,.d}; re-implementing them 15 // here would mean two sources of truth for the same value. What remains is 16 // what ifupdown cannot reach on a KNET stub netdev. 17 struct linkd_port { 18 char *name; 19 uint32_t speed; // Mbit/s, 0 = unset 20 enum dp_fec fec; 21 int autoneg; // -1 unset, 0 off, 1 on 22 char *breakout; // e.g. "4x25g", NULL = none 23 struct linkd_port *next; 24 }; 25 26 // Registers the `port` directive with the config parser 27 void ports_register(void); 28 29 struct cnf_directive * cfg_parse_port(FILE *fd, struct cnf_directive *dir, void *user); 30 31 struct linkd_port * ports_list(void); 32 struct linkd_port * ports_find(const char *name); 33 void ports_free(void); 34 35 #endif // __LINKD_CONFIG_PORTS_H__