]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: Allow to configure VLan egress qos maps 18157/head
authorSusant Sahani <ssahani@vmware.com>
Tue, 12 Jan 2021 10:02:12 +0000 (11:02 +0100)
committerSusant Sahani <ssahani@vmware.com>
Tue, 12 Jan 2021 13:31:03 +0000 (14:31 +0100)
man/systemd.netdev.xml
src/network/netdev/netdev-gperf.gperf
src/network/netdev/vlan.c
src/network/netdev/vlan.h
test/fuzz/fuzz-netdev-parser/directives.netdev

index 7add69ca8dac3676fdaabc6f509560a51233a26b..9bb7491a6ea7e270ccb80bc95dd25c68bbb0c96d 100644 (file)
           </para>
         </listitem>
       </varlistentry>
+      <varlistentry>
+        <term><varname>IngressQOSMaps=</varname></term>
+        <listitem>
+          <para>Defines a mapping of Linux internal packet priority (<constant>SO_PRIORITY</constant>) to VLAN header
+          PCP field for incoming frames. Takes a whitespace-separated list of unsigned integer pairs in the format
+          <literal>from</literal>-<literal>to</literal>, e.g., <literal>21-7 45-5</literal> ranges 1–4294967294.
+          Note that <literal>from</literal> must be greater than or equal to <literal>to</literal>. When unset,
+          the kernel's default will be used.
+          </para>
+        </listitem>
+      </varlistentry>
     </variablelist>
   </refsect1>
 
index 2c94065bf55faa2a843a7e6ff751a0ce8de0d2e1..720bacc7f5502ee360bd9ab9b88cce94a45ca12d 100644 (file)
@@ -54,6 +54,7 @@ VLAN.MVRP,                                config_parse_tristate,
 VLAN.LooseBinding,                        config_parse_tristate,                     0,                             offsetof(VLan, loose_binding)
 VLAN.ReorderHeader,                       config_parse_tristate,                     0,                             offsetof(VLan, reorder_hdr)
 VLAN.EgressQOSMaps,                       config_parse_vlan_qos_maps,                0,                             offsetof(VLan, egress_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)
 MACVTAP.Mode,                             config_parse_macvlan_mode,                 0,                             offsetof(MacVlan, mode)
index f9fcea8898ab9d8fb9098ae679f85123ef89de4e..de3eb721e9b854552391d50f9cb1a07adc166f01 100644 (file)
@@ -73,6 +73,24 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlin
                         return log_netdev_error_errno(netdev, r, "Could not close container IFLA_VLAN_EGRESS_QOS: %m");
         }
 
+        if (!set_isempty(v->ingress_qos_maps)) {
+                struct ifla_vlan_qos_mapping *m;
+
+                r = sd_netlink_message_open_container(req, IFLA_VLAN_INGRESS_QOS);
+                if (r < 0)
+                        return log_netdev_error_errno(netdev, r, "Could not open container IFLA_VLAN_INGRESS_QOS: %m");
+
+                SET_FOREACH(m, v->ingress_qos_maps) {
+                        r = sd_netlink_message_append_data(req, IFLA_VLAN_QOS_MAPPING, m, sizeof(struct ifla_vlan_qos_mapping));
+                        if (r < 0)
+                                return log_netdev_error_errno(netdev, r, "Could not append IFLA_VLAN_QOS_MAPPING attribute: %m");
+                }
+
+                r = sd_netlink_message_close_container(req);
+                if (r < 0)
+                        return log_netdev_error_errno(netdev, r, "Could not close container IFLA_VLAN_INGRESS_QOS: %m");
+        }
+
         return 0;
 }
 
@@ -186,6 +204,7 @@ static void vlan_done(NetDev *n) {
         assert(v);
 
         set_free(v->egress_qos_maps);
+        set_free(v->ingress_qos_maps);
 }
 
 static void vlan_init(NetDev *netdev) {
index 376024d4fd3501bb5a0f6c00f6047cf1528466d2..1e5e5904fcdc788a8da060ce70c412c16e9b4ece 100644 (file)
@@ -18,6 +18,7 @@ struct VLan {
         int reorder_hdr;
 
         Set *egress_qos_maps;
+        Set *ingress_qos_maps;
 };
 
 DEFINE_NETDEV_CAST(VLAN, VLan);
index d038b21a63404f703e8a682ad56e5d4b584d9b8d..8c36e31a0e7554a767ea1ca1037f7f6c1d7e9c0b 100644 (file)
@@ -6,6 +6,7 @@ Id=
 GVRP=
 Protocol=
 EgressQOSMaps=
+IngressQOSMaps=
 [MACVLAN]
 Mode=
 SourceMACAddress=