| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
%{ |
| 3 |
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") |
| 4 |
#if __GNUC__ >= 15 |
| 5 |
_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") |
| 6 |
#endif |
| 7 |
#include <stddef.h> |
| 8 |
#include "condition.h" |
| 9 |
#include "conf-parser.h" |
| 10 |
#include "ethtool-util.h" |
| 11 |
#include "link-config.h" |
| 12 |
#include "net-condition.h" |
| 13 |
#include "netif-sriov.h" |
| 14 |
#include "socket-util.h" |
| 15 |
%} |
| 16 |
struct ConfigPerfItem; |
| 17 |
%null_strings |
| 18 |
%language=ANSI-C |
| 19 |
%define slot-name section_and_lvalue |
| 20 |
%define hash-function-name link_config_gperf_hash |
| 21 |
%define lookup-function-name link_config_gperf_lookup |
| 22 |
%readonly-tables |
| 23 |
%omit-struct-type |
| 24 |
%struct-type |
| 25 |
%includes |
| 26 |
%% |
| 27 |
Match.MACAddress, config_parse_hw_addrs, 0, offsetof(LinkConfig, match.hw_addr) |
| 28 |
Match.PermanentMACAddress, config_parse_hw_addrs, 0, offsetof(LinkConfig, match.permanent_hw_addr) |
| 29 |
Match.OriginalName, config_parse_match_ifnames, 0, offsetof(LinkConfig, match.ifname) |
| 30 |
Match.Path, config_parse_match_strv, 0, offsetof(LinkConfig, match.path) |
| 31 |
Match.Driver, config_parse_match_strv, 0, offsetof(LinkConfig, match.driver) |
| 32 |
Match.Type, config_parse_match_strv, 0, offsetof(LinkConfig, match.iftype) |
| 33 |
Match.Kind, config_parse_match_strv, 0, offsetof(LinkConfig, match.kind) |
| 34 |
Match.Property, config_parse_match_property, 0, offsetof(LinkConfig, match.property) |
| 35 |
Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(LinkConfig, conditions) |
| 36 |
Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(LinkConfig, conditions) |
| 37 |
Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(LinkConfig, conditions) |
| 38 |
Match.KernelVersion, config_parse_net_condition, CONDITION_VERSION, offsetof(LinkConfig, conditions) |
| 39 |
Match.Version, config_parse_net_condition, CONDITION_VERSION, offsetof(LinkConfig, conditions) |
| 40 |
Match.Credential, config_parse_net_condition, CONDITION_CREDENTIAL, offsetof(LinkConfig, conditions) |
| 41 |
Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(LinkConfig, conditions) |
| 42 |
Match.Firmware, config_parse_net_condition, CONDITION_FIRMWARE, offsetof(LinkConfig, conditions) |
| 43 |
Link.Description, config_parse_string, 0, offsetof(LinkConfig, description) |
| 44 |
/* udev property */ |
| 45 |
Link.Property, config_parse_udev_property, 0, offsetof(LinkConfig, properties) |
| 46 |
Link.ImportProperty, config_parse_udev_property_name, 0, offsetof(LinkConfig, import_properties) |
| 47 |
Link.UnsetProperty, config_parse_udev_property_name, 0, offsetof(LinkConfig, unset_properties) |
| 48 |
/* rtnl setlink */ |
| 49 |
Link.MACAddressPolicy, config_parse_mac_address_policy, 0, offsetof(LinkConfig, mac_address_policy) |
| 50 |
Link.MACAddress, config_parse_hw_addr, 0, offsetof(LinkConfig, hw_addr) |
| 51 |
Link.NamePolicy, config_parse_name_policy, 0, offsetof(LinkConfig, name_policy) |
| 52 |
Link.Name, config_parse_ifname, 0, offsetof(LinkConfig, name) |
| 53 |
Link.AlternativeName, config_parse_ifnames, IFNAME_VALID_ALTERNATIVE, offsetof(LinkConfig, alternative_names) |
| 54 |
Link.AlternativeNamesPolicy, config_parse_alternative_names_policy, 0, offsetof(LinkConfig, alternative_names_policy) |
| 55 |
Link.Alias, config_parse_ifalias, 0, offsetof(LinkConfig, alias) |
| 56 |
Link.TransmitQueues, config_parse_rx_tx_queues, 0, offsetof(LinkConfig, txqueues) |
| 57 |
Link.ReceiveQueues, config_parse_rx_tx_queues, 0, offsetof(LinkConfig, rxqueues) |
| 58 |
Link.TransmitQueueLength, config_parse_txqueuelen, 0, offsetof(LinkConfig, txqueuelen) |
| 59 |
Link.MTUBytes, config_parse_mtu, AF_UNSPEC, offsetof(LinkConfig, mtu) |
| 60 |
Link.GenericSegmentOffloadMaxBytes, config_parse_iec_size, 0, offsetof(LinkConfig, gso_max_size) |
| 61 |
Link.GenericSegmentOffloadMaxSegments, config_parse_uint32, 0, offsetof(LinkConfig, gso_max_segments) |
| 62 |
/* ethtool link settings */ |
| 63 |
Link.BitsPerSecond, config_parse_si_uint64, 0, offsetof(LinkConfig, speed) |
| 64 |
Link.Duplex, config_parse_duplex, 0, offsetof(LinkConfig, duplex) |
| 65 |
Link.AutoNegotiation, config_parse_tristate, 0, offsetof(LinkConfig, autonegotiation) |
| 66 |
Link.Advertise, config_parse_advertise, 0, offsetof(LinkConfig, advertise) |
| 67 |
Link.Port, config_parse_port, 0, offsetof(LinkConfig, port) |
| 68 |
Link.MDI, config_parse_mdi, 0, offsetof(LinkConfig, mdi) |
| 69 |
/* ethtool WoL settings */ |
| 70 |
Link.WakeOnLan, config_parse_wol, 0, offsetof(LinkConfig, wol) |
| 71 |
Link.WakeOnLanPassword, config_parse_wol_password, 0, 0 |
| 72 |
/* ethtool features */ |
| 73 |
Link.ReceiveChecksumOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_RXCSUM]) |
| 74 |
Link.TransmitChecksumOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_TXCSUM]) |
| 75 |
Link.ScatterGather, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_SG]) |
| 76 |
Link.ScatterGatherFragmentList, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_FRAGLIST]) |
| 77 |
Link.GenericSegmentationOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_GSO]) |
| 78 |
Link.TCPSegmentationOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_TSO]) |
| 79 |
Link.TCPECNSegmentationOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_TSO_ECN]) |
| 80 |
Link.TCPMangleIdSegmentationOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_TSO_MANGLEID]) |
| 81 |
Link.TCP6SegmentationOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_TSO6]) |
| 82 |
Link.PartialGenericSegmentationOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_GSO_PARTIAL]) |
| 83 |
Link.UDPSegmentationOffload, config_parse_warn_compat, DISABLED_LEGACY, 0 |
| 84 |
Link.GenericReceiveOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_GRO]) |
| 85 |
Link.GenericReceiveOffloadHardware, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_GRO_HW]) |
| 86 |
Link.GenericReceiveOffloadList, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_GRO_FRAGLIST]) |
| 87 |
Link.GenericReceiveOffloadUDPForwarding, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_GRO_UDP_FWD]) |
| 88 |
Link.LargeReceiveOffload, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_LRO]) |
| 89 |
Link.ReceiveVLANCTAGHardwareAcceleration, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_HW_VLAN_CTAG_RX]) |
| 90 |
Link.TransmitVLANCTAGHardwareAcceleration, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_HW_VLAN_CTAG_TX]) |
| 91 |
Link.ReceiveVLANCTAGFilter, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_HW_VLAN_CTAG_FILTER]) |
| 92 |
Link.TransmitVLANSTAGHardwareAcceleration, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_HW_VLAN_STAG_TX]) |
| 93 |
Link.NTupleFilter, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_NTUPLE]) |
| 94 |
Link.ReceiveFCS, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_RXFCS]) |
| 95 |
Link.ReceiveAll, config_parse_tristate, 0, offsetof(LinkConfig, features[NET_DEV_FEAT_RXALL]) |
| 96 |
/* ethtool channels */ |
| 97 |
Link.RxChannels, config_parse_ring_buffer_or_channel, 0, offsetof(LinkConfig, channels.rx) |
| 98 |
Link.TxChannels, config_parse_ring_buffer_or_channel, 0, offsetof(LinkConfig, channels.tx) |
| 99 |
Link.OtherChannels, config_parse_ring_buffer_or_channel, 0, offsetof(LinkConfig, channels.other) |
| 100 |
Link.CombinedChannels, config_parse_ring_buffer_or_channel, 0, offsetof(LinkConfig, channels.combined) |
| 101 |
/* ethtool ring parameters */ |
| 102 |
Link.RxBufferSize, config_parse_ring_buffer_or_channel, 0, offsetof(LinkConfig, ring.rx) |
| 103 |
Link.RxMiniBufferSize, config_parse_ring_buffer_or_channel, 0, offsetof(LinkConfig, ring.rx_mini) |
| 104 |
Link.RxJumboBufferSize, config_parse_ring_buffer_or_channel, 0, offsetof(LinkConfig, ring.rx_jumbo) |
| 105 |
Link.TxBufferSize, config_parse_ring_buffer_or_channel, 0, offsetof(LinkConfig, ring.tx) |
| 106 |
/* ethtool pause parameters */ |
| 107 |
Link.RxFlowControl, config_parse_tristate, 0, offsetof(LinkConfig, rx_flow_control) |
| 108 |
Link.TxFlowControl, config_parse_tristate, 0, offsetof(LinkConfig, tx_flow_control) |
| 109 |
Link.AutoNegotiationFlowControl, config_parse_tristate, 0, offsetof(LinkConfig, autoneg_flow_control) |
| 110 |
/* ethtool coalesce settings */ |
| 111 |
Link.RxCoalesceSec, config_parse_coalesce_sec, 0, offsetof(LinkConfig, coalesce.rx_coalesce_usecs) |
| 112 |
Link.RxMaxCoalescedFrames, config_parse_coalesce_u32, 0, offsetof(LinkConfig, coalesce.rx_max_coalesced_frames) |
| 113 |
Link.RxCoalesceIrqSec, config_parse_coalesce_sec, 0, offsetof(LinkConfig, coalesce.rx_coalesce_usecs_irq) |
| 114 |
Link.RxMaxCoalescedIrqFrames, config_parse_coalesce_u32, 0, offsetof(LinkConfig, coalesce.rx_max_coalesced_frames_irq) |
| 115 |
Link.TxCoalesceSec, config_parse_coalesce_sec, 0, offsetof(LinkConfig, coalesce.tx_coalesce_usecs) |
| 116 |
Link.TxMaxCoalescedFrames, config_parse_coalesce_u32, 0, offsetof(LinkConfig, coalesce.tx_max_coalesced_frames) |
| 117 |
Link.TxCoalesceIrqSec, config_parse_coalesce_sec, 0, offsetof(LinkConfig, coalesce.tx_coalesce_usecs_irq) |
| 118 |
Link.TxMaxCoalescedIrqFrames, config_parse_coalesce_u32, 0, offsetof(LinkConfig, coalesce.tx_max_coalesced_frames_irq) |
| 119 |
Link.StatisticsBlockCoalesceSec, config_parse_coalesce_sec, 0, offsetof(LinkConfig, coalesce.stats_block_coalesce_usecs) |
| 120 |
Link.UseAdaptiveRxCoalesce, config_parse_tristate, 0, offsetof(LinkConfig, coalesce.use_adaptive_rx_coalesce) |
| 121 |
Link.UseAdaptiveTxCoalesce, config_parse_tristate, 0, offsetof(LinkConfig, coalesce.use_adaptive_tx_coalesce) |
| 122 |
Link.CoalescePacketRateLow, config_parse_coalesce_u32, 0, offsetof(LinkConfig, coalesce.pkt_rate_low) |
| 123 |
Link.RxCoalesceLowSec, config_parse_coalesce_sec, 0, offsetof(LinkConfig, coalesce.rx_coalesce_usecs_low) |
| 124 |
Link.RxMaxCoalescedLowFrames, config_parse_coalesce_u32, 0, offsetof(LinkConfig, coalesce.rx_max_coalesced_frames_low) |
| 125 |
Link.TxCoalesceLowSec, config_parse_coalesce_sec, 0, offsetof(LinkConfig, coalesce.tx_coalesce_usecs_low) |
| 126 |
Link.TxMaxCoalescedLowFrames, config_parse_coalesce_u32, 0, offsetof(LinkConfig, coalesce.tx_max_coalesced_frames_low) |
| 127 |
Link.CoalescePacketRateHigh, config_parse_coalesce_u32, 0, offsetof(LinkConfig, coalesce.pkt_rate_high) |
| 128 |
Link.RxCoalesceHighSec, config_parse_coalesce_sec, 0, offsetof(LinkConfig, coalesce.rx_coalesce_usecs_high) |
| 129 |
Link.RxMaxCoalescedHighFrames, config_parse_coalesce_u32, 0, offsetof(LinkConfig, coalesce.rx_max_coalesced_frames_high) |
| 130 |
Link.TxCoalesceHighSec, config_parse_coalesce_sec, 0, offsetof(LinkConfig, coalesce.tx_coalesce_usecs_high) |
| 131 |
Link.TxMaxCoalescedHighFrames, config_parse_coalesce_u32, 0, offsetof(LinkConfig, coalesce.tx_max_coalesced_frames_high) |
| 132 |
Link.CoalescePacketRateSampleIntervalSec, config_parse_coalesce_sec, 0, offsetof(LinkConfig, coalesce.rate_sample_interval) |
| 133 |
/* Rx RPS CPU mask */ |
| 134 |
Link.ReceivePacketSteeringCPUMask, config_parse_rps_cpu_mask, 0, offsetof(LinkConfig, rps_cpu_mask) |
| 135 |
/* IRQ affinity settings */ |
| 136 |
Link.IRQAffinityPolicy, config_parse_irq_affinity_policy, 0, offsetof(LinkConfig, irq_affinity_policy) |
| 137 |
Link.IRQAffinity, config_parse_cpu_set, 0, offsetof(LinkConfig, irq_affinity_cpus) |
| 138 |
Link.IRQAffinityNUMA, config_parse_irq_affinity_numa, 0, offsetof(LinkConfig, irq_affinity_numa) |
| 139 |
/* SR-IOV settings */ |
| 140 |
Link.SR-IOVVirtualFunctions, config_parse_sr_iov_num_vfs, 0, offsetof(LinkConfig, sr_iov_num_vfs) |
| 141 |
SR-IOV.VirtualFunction, config_parse_sr_iov_uint32, 0, offsetof(LinkConfig, sr_iov_by_section) |
| 142 |
SR-IOV.VLANId, config_parse_sr_iov_uint32, 0, offsetof(LinkConfig, sr_iov_by_section) |
| 143 |
SR-IOV.QualityOfService, config_parse_sr_iov_uint32, 0, offsetof(LinkConfig, sr_iov_by_section) |
| 144 |
SR-IOV.VLANProtocol, config_parse_sr_iov_vlan_proto, 0, offsetof(LinkConfig, sr_iov_by_section) |
| 145 |
SR-IOV.MACSpoofCheck, config_parse_sr_iov_boolean, 0, offsetof(LinkConfig, sr_iov_by_section) |
| 146 |
SR-IOV.QueryReceiveSideScaling, config_parse_sr_iov_boolean, 0, offsetof(LinkConfig, sr_iov_by_section) |
| 147 |
SR-IOV.Trust, config_parse_sr_iov_boolean, 0, offsetof(LinkConfig, sr_iov_by_section) |
| 148 |
SR-IOV.LinkState, config_parse_sr_iov_link_state, 0, offsetof(LinkConfig, sr_iov_by_section) |
| 149 |
SR-IOV.MACAddress, config_parse_sr_iov_mac, 0, offsetof(LinkConfig, sr_iov_by_section) |
| 150 |
/* ethtool EEE settings */ |
| 151 |
EnergyEfficientEthernet.Enable, config_parse_tristate, 0, offsetof(LinkConfig, eee_enabled) |
| 152 |
EnergyEfficientEthernet.TxLowPowerIdle, config_parse_tristate, 0, offsetof(LinkConfig, eee_tx_lpi_enabled) |
| 153 |
EnergyEfficientEthernet.TxLowPowerIdleSec, config_parse_sec, 0, offsetof(LinkConfig, eee_tx_lpi_timer_usec) |
| 154 |
EnergyEfficientEthernet.LinkMode, config_parse_advertise, 0, offsetof(LinkConfig, eee_advertise) |