summaryrefslogtreecommitdiffstats
path: root/src/net/netdev_settings.c
diff options
context:
space:
mode:
authorSimon Rettberg2024-04-12 14:52:06 +0200
committerSimon Rettberg2024-04-12 14:52:06 +0200
commit2ae76865d3d109712f9ee488cbc19bd107bbc9ab (patch)
tree36e7310eb089cf7fd3496e5c32c70981e447f235 /src/net/netdev_settings.c
parentMerge branch 'aqc1xx' into openslx (diff)
parent[netdevice] Add "linktype" setting (diff)
downloadipxe-2ae76865d3d109712f9ee488cbc19bd107bbc9ab.tar.gz
ipxe-2ae76865d3d109712f9ee488cbc19bd107bbc9ab.tar.xz
ipxe-2ae76865d3d109712f9ee488cbc19bd107bbc9ab.zip
Merge branch 'master' into openslxopenslx
Diffstat (limited to 'src/net/netdev_settings.c')
-rw-r--r--src/net/netdev_settings.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/net/netdev_settings.c b/src/net/netdev_settings.c
index fb98663c..080b6d2a 100644
--- a/src/net/netdev_settings.c
+++ b/src/net/netdev_settings.c
@@ -65,6 +65,11 @@ const struct setting busid_setting __setting ( SETTING_NETDEV, busid ) = {
.description = "Bus ID",
.type = &setting_type_hex,
};
+const struct setting linktype_setting __setting ( SETTING_NETDEV, linktype ) = {
+ .name = "linktype",
+ .description = "Link-layer type",
+ .type = &setting_type_string,
+};
const struct setting chip_setting __setting ( SETTING_NETDEV, chip ) = {
.name = "chip",
.description = "Chip",
@@ -220,6 +225,22 @@ static int netdev_fetch_busid ( struct net_device *netdev, void *data,
}
/**
+ * Fetch link layer type setting
+ *
+ * @v netdev Network device
+ * @v data Buffer to fill with setting data
+ * @v len Length of buffer
+ * @ret len Length of setting data, or negative error
+ */
+static int netdev_fetch_linktype ( struct net_device *netdev, void *data,
+ size_t len ) {
+ const char *linktype = netdev->ll_protocol->name;
+
+ strncpy ( data, linktype, len );
+ return strlen ( linktype );
+}
+
+/**
* Fetch chip setting
*
* @v netdev Network device
@@ -281,6 +302,7 @@ static struct netdev_setting_operation netdev_setting_operations[] = {
{ &bustype_setting, NULL, netdev_fetch_bustype },
{ &busloc_setting, NULL, netdev_fetch_busloc },
{ &busid_setting, NULL, netdev_fetch_busid },
+ { &linktype_setting, NULL, netdev_fetch_linktype },
{ &chip_setting, NULL, netdev_fetch_chip },
{ &ifname_setting, NULL, netdev_fetch_ifname },
};