diff options
| author | Michael Brown | 2011-03-22 17:56:35 +0100 |
|---|---|---|
| committer | Michael Brown | 2011-03-22 20:54:58 +0100 |
| commit | f5fd4dec3bab362a2ff7844859914e1f191fb905 (patch) | |
| tree | 607eacef2f79c016a0c3c3031de2bb7d8aa7e331 /src/include/ipxe/netdevice.h | |
| parent | [forcedeth] Clear the MII link status register on link status changes (diff) | |
| download | ipxe-f5fd4dec3bab362a2ff7844859914e1f191fb905.tar.gz ipxe-f5fd4dec3bab362a2ff7844859914e1f191fb905.tar.xz ipxe-f5fd4dec3bab362a2ff7844859914e1f191fb905.zip | |
[settings] Formalise notion of setting applicability
Expose a function setting_applies() to allow a caller to determine
whether or not a particular setting is applicable to a particular
settings block.
Restrict DHCP-backed settings blocks to accepting only DHCP-based
settings.
Restrict network device settings blocks to accepting only DHCP-based
settings and network device-specific settings such as "mac".
Inspired-by: Glenn Brown <glenn@myri.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/netdevice.h')
| -rw-r--r-- | src/include/ipxe/netdevice.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/include/ipxe/netdevice.h b/src/include/ipxe/netdevice.h index ac7cec521..e49191f4a 100644 --- a/src/include/ipxe/netdevice.h +++ b/src/include/ipxe/netdevice.h @@ -390,6 +390,38 @@ struct net_driver { /** Declare a network driver */ #define __net_driver __table_entry ( NET_DRIVERS, 01 ) +/** Network device setting tag magic + * + * All DHCP option settings are deemed to be valid as network device + * settings. There are also some extra non-DHCP settings (such as + * "mac"), which are marked as being valid network device settings by + * using a magic tag value. + */ +#define NETDEV_SETTING_TAG_MAGIC 0xeb + +/** + * Construct network device setting tag + * + * @v id Unique identifier + * @ret tag Setting tag + */ +#define NETDEV_SETTING_TAG( id ) ( ( NETDEV_SETTING_TAG_MAGIC << 24 ) | (id) ) + +/** + * Check if tag is a network device setting tag + * + * @v tag Setting tag + * @ret is_ours Tag is a network device setting tag + */ +#define IS_NETDEV_SETTING_TAG( tag ) \ + ( ( (tag) >> 24 ) == NETDEV_SETTING_TAG_MAGIC ) + +/** MAC address setting tag */ +#define NETDEV_SETTING_TAG_MAC NETDEV_SETTING_TAG ( 0x01 ) + +/** Bus ID setting tag */ +#define NETDEV_SETTING_TAG_BUS_ID NETDEV_SETTING_TAG ( 0x02 ) + extern struct list_head net_devices; extern struct net_device_operations null_netdev_operations; extern struct settings_operations netdev_settings_operations; |
