]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: macvlan - add support to configure rx queue for broadcast/multicast 18230/head
authorSusant Sahani <ssahani@vmware.com>
Sun, 17 Jan 2021 07:39:28 +0000 (08:39 +0100)
committerSusant Sahani <ssahani@vmware.com>
Sun, 17 Jan 2021 07:39:28 +0000 (08:39 +0100)
man/systemd.netdev.xml
src/network/netdev/macvlan.c
src/network/netdev/macvlan.h
src/network/netdev/netdev-gperf.gperf
test/fuzz/fuzz-netdev-parser/directives.netdev

index 9bb7491a6ea7e270ccb80bc95dd25c68bbb0c96d..baa734bcb24c8248059435bf9a85e570c86fef1b 100644 (file)
           to this is reset. Defaults to unset.</para>
         </listitem>
       </varlistentry>
+      <varlistentry>
+        <term><varname>BroadcastMulticastQueueLength=</varname></term>
+        <listitem>
+          <para>Specifies the length of the receive queue for broadcast/multicast packets. An unsigned
+          integer in the range 0—4294967294. Defaults to unset.</para>
+        </listitem>
+      </varlistentry>
     </variablelist>
   </refsect1>
 
index 9bdcf627b40fa5ed38809e496e9e7a13f04b2436..46b08261482831ae2bfda6d65cdef2d613d8f20e 100644 (file)
@@ -5,6 +5,7 @@
 #include "conf-parser.h"
 #include "macvlan.h"
 #include "macvlan-util.h"
+#include "parse-util.h"
 
 DEFINE_CONFIG_PARSE_ENUM(config_parse_macvlan_mode, macvlan_mode, MacVlanMode, "Failed to parse macvlan mode");
 
@@ -51,6 +52,57 @@ static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_net
                         return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACVLAN_MODE attribute: %m");
         }
 
+        if (m->bc_queue_length != UINT32_MAX) {
+                r = sd_netlink_message_append_u32(req, IFLA_MACVLAN_BC_QUEUE_LEN, m->bc_queue_length);
+                if (r < 0)
+                        return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACVLAN_BC_QUEUE_LEN attribute: %m");
+        }
+
+        return 0;
+}
+
+int config_parse_macvlan_broadcast_queue_size(
+                const char *unit,
+                const char *filename,
+                unsigned line,
+                const char *section,
+                unsigned section_line,
+                const char *lvalue,
+                int ltype,
+                const char *rvalue,
+                void *data,
+                void *userdata) {
+
+        MacVlan *m = userdata;
+        uint32_t v;
+        int r;
+
+        assert(filename);
+        assert(section);
+        assert(lvalue);
+        assert(rvalue);
+        assert(data);
+        assert(userdata);
+
+        if (isempty(rvalue)) {
+                m->bc_queue_length = UINT32_MAX;
+                return 0;
+        }
+
+        r = safe_atou32(rvalue, &v);
+        if (r < 0) {
+                log_syntax(unit, LOG_WARNING, filename, line, r,
+                           "Failed to parse BroadcastMulticastQueueLength=%s, ignoring assignment: %m", rvalue);
+                return 0;
+        }
+
+        if (v == UINT32_MAX) {
+                log_syntax(unit, LOG_WARNING, filename, line, 0,
+                           "Invalid BroadcastMulticastQueueLength=%s, ignoring assignment: %m", rvalue);
+                return 0;
+        }
+
+        m->bc_queue_length = v;
         return 0;
 }
 
@@ -82,6 +134,7 @@ static void macvlan_init(NetDev *n) {
         assert(m);
 
         m->mode = _NETDEV_MACVLAN_MODE_INVALID;
+        m->bc_queue_length = UINT32_MAX;
 }
 
 const NetDevVTable macvtap_vtable = {
index cb7eece67f5bd74a2fe60a44789f19904a26e7fa..c45fc4fd33925bafe06c031ee7dc6cae557862e6 100644 (file)
@@ -12,6 +12,8 @@ struct MacVlan {
 
         MacVlanMode mode;
         Set *match_source_mac;
+
+        uint32_t bc_queue_length;
 };
 
 DEFINE_NETDEV_CAST(MACVLAN, MacVlan);
@@ -20,3 +22,4 @@ extern const NetDevVTable macvlan_vtable;
 extern const NetDevVTable macvtap_vtable;
 
 CONFIG_PARSER_PROTOTYPE(config_parse_macvlan_mode);
+CONFIG_PARSER_PROTOTYPE(config_parse_macvlan_broadcast_queue_size);
index 720bacc7f5502ee360bd9ab9b88cce94a45ca12d..680063eb3b61e1721654b0f045e8064c8ab0876d 100644 (file)
@@ -57,6 +57,7 @@ VLAN.EgressQOSMaps,                       config_parse_vlan_qos_maps,
 VLAN.IngressQOSMaps,                      config_parse_vlan_qos_maps,                0,                             offsetof(VLan, ingress_qos_maps)
 MACVLAN.Mode,                             config_parse_macvlan_mode,                 0,                             offsetof(MacVlan, mode)
 MACVLAN.SourceMACAddress,                 config_parse_hwaddrs,                      0,                             offsetof(MacVlan, match_source_mac)
+MACVLAN.BroadcastMulticastQueueLength,    config_parse_macvlan_broadcast_queue_size, 0,                             offsetof(MacVlan, bc_queue_length)
 MACVTAP.Mode,                             config_parse_macvlan_mode,                 0,                             offsetof(MacVlan, mode)
 MACVTAP.SourceMACAddress,                 config_parse_hwaddrs,                      0,                             offsetof(MacVlan, match_source_mac)
 IPVLAN.Mode,                              config_parse_ipvlan_mode,                  0,                             offsetof(IPVlan, mode)
index 8c36e31a0e7554a767ea1ca1037f7f6c1d7e9c0b..050078520723438f6477877dc56eaa54be4dcdb8 100644 (file)
@@ -10,6 +10,7 @@ IngressQOSMaps=
 [MACVLAN]
 Mode=
 SourceMACAddress=
+BroadcastMulticastQueueLength=
 [WireGuard]
 ListenPort=
 PrivateKey=