Skip to contentSkip to conversation

virtio-net: Add flow filter capabilities read commands

PATCH Satananda Burla 2 participants 3 messages Oct 30, 2023 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi Parav

Quoted 112 lines

-----Original Message-----
From: Parav Pandit <[email protected]>
Sent: Friday, October 27, 2023 6:23 AM
To: [email protected]; [email protected]; [email protected]
Cc: Satananda Burla <[email protected]>; [email protected]; si- [email protected]; [email protected]; Parav Pandit <[email protected]>; Heng Qi <[email protected]>
Subject: [EXT] [PATCH v3 2/6] virtio-net: Add flow filter capabilities read commands

External Email

----------------------------------------------------------------------
The device responds flow filter capabilities using two commands. One command indicates generic flow filter device limits such as number of flow filters, number of flow filter groups, support or multiple transports etc.

The second command indicates supported match types, and fields of the packet.

Fixes: https://urldefense.proofpoint.com/v2/url?u=https-
3A__github.com_oasis-2Dtcs_virtio- 2Dspec_issues_179&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=NHDPsfcAYlN2z- NXHHG4WB09qqS0voo_nf6_kGS625A&m=GknvLw2Qpf9nPonjhWw3_Lc5eykfVdDRg1fga_EJ CtMR5FPF3CjtDKJYjCUT1tvU&s=XW811-B24- DCa7KJgZdBUlXx9LYmZMzfByaCAlChmi8&e=

---
changelog:
v1->v2:
- addressed comments from Satananda
- added vlan type match field
- kept space for types between l2, l3, l4 header match types
- renamed mask to mask_supported with shorter width
- made more fields reserved for furture
- addressed comments from Heng
- grammar correction
- added field to indicate supported number of actions per flow filter match entry
- added missing documentation for max_flow_priorities_per_group v0->v1:
- added mask field in the type to indicate supported mask by device and also in later patch to use it to indicate mask on adding flow filter. As a result removed the mask_supported capability field

---
 device-types/net/description.tex | 220 ++++++++++++++++++++++++++++++-
 1 file changed, 218 insertions(+), 2 deletions(-)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex
index fc56af6..2aba5d0 100644

device-types/net/description.tex +0 -0
@@ -1173,7 +1173,11 @@ \subsubsection{Flow Filter}\label{sec:Device

Types / Network Device / Device Ope
The device indicates the flow filter capabilities to the driver. These capabilities include various maximum device limits, supported
transports and
supported packet match fields. The driver enables the transport for
flow

device-types/net/description.tex +1 -1
-filter requests using a control virtqueue command.
+filter requests using a control virtqueue command. These control

virtqueue
+commands are:
+\ref{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Flow Filter / Flow Filter Capabilities Get} +and
+\ref{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Flow Filter / Flow Filter Match Capabilities Get}.

The device supports transporting flow filter requests on either the
control
virtqueue or on the flow filter virtqueues or on both. However, device

device-types/net/description.tex +0 -0
@@ -1181,6 +1185,8 @@ \subsubsection{Flow Filter}\label{sec:Device Types

/ Network Device / Device Ope
at a time, i.e. either control virtqueue or flow filter virtqueues. Once the driver sets the flow filter request transport in the device, the driver can send flow filter request using the enabled transport.
+The driver enables the transport for flow filter requests using a control
+virtqueue command.

The flow filters are grouped using a flow filter group. Each flow
filter
group has a priority. The device first applies the flow filters of the
highest

device-types/net/description.tex +0 -0
@@ -1247,7 +1253,136 @@ \subsubsection{Flow Filter}\label{sec:Device

Types / Network Device / Device Ope
the flow filters in group_C, the flow filters of next level
group_B are applied.
\end{itemize}

-\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Setting Promiscuous Mode}%old label for latexdiff +\paragraph{Match Types and Fields}\label{sec:Device Types / Network Device / Device Operation / Flow Filter / Match Types and Fields}

device-types/net/description.tex +11 -0
+
+\begin{lstlisting}
+struct virtio_net_ff_match_type_cap {
+        le16 type;
+        u8 mask_supported;
+        u8 reserved[5];
+        le64 fields_bmap;
+};
+\end{lstlisting}
+
+The \field{type} corresponds to following table:

device-types/net/description.tex

Quoted 10 lines
device-types/net/description.tex +10 -0
+
+\begin{tabular}{|l|l|l|}
+\hline
+Type & Name & Description \\
+\hline \hline
+0   & VIRTIO_NET_FF_ETH_HDR & Ethernet header of the packet \\
+\hline
+0x1   & VIRTIO_NET_FF_VLAN_TAG_HDR & VLAN tag of the packet \\
+\hline
+0x200   & VIRTIO_NET_FF_IPV4_HDR & IPv4 header of the packet \\

This leaves 256 types for L2 and VLAN, do we really need so many L2 types ?

Quoted 3 lines

+\hline
+0x300 & VIRTIO_NET_FF_IPV6_HDR & IPv6 header of the packet \\
+\hline

Can we leave a few bits (4) for L3 headers and start L4 after? Specifically for IPV6 we may need extension header bits matching in future. (SPI in ESP extension header for instance).

Quoted 3 lines

+0x400 & VIRTIO_NET_FF_TCP_HDR & TCP header of the packet \\
+\hline
+0x500 & VIRTIO_NET_FF_UDP_HDR & UDP header of the packet \\

Regards
Satananda

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#3 lore raw
Quoted 121 lines

From: Satananda Burla <[email protected]>
Sent: Monday, October 30, 2023 7:06 AM

Hi Parav

Quoted 19 lines

-----Original Message-----
From: Parav Pandit <[email protected]>
Sent: Friday, October 27, 2023 6:23 AM
To: [email protected]; [email protected]; [email protected]
Cc: Satananda Burla <[email protected]>; [email protected]; si- [email protected]; [email protected]; Parav Pandit <[email protected]>; Heng Qi <[email protected]>
Subject: [EXT] [PATCH v3 2/6] virtio-net: Add flow filter capabilities read commands

External Email

----------------------------------------------------------------------
The device responds flow filter capabilities using two commands. One command indicates generic flow filter device limits such as number of flow filters, number of flow filter groups, support or multiple transports etc.

Quoted 6 lines

The second command indicates supported match types, and fields of the packet.

Fixes: https://urldefense.proofpoint.com/v2/url?u=https-
3A__github.com_oasis-2Dtcs_virtio-

2Dspec_issues_179&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=NHDPsfcAYl N2z-

Quoted 1 line

NXHHG4WB09qqS0voo_nf6_kGS625A&m=GknvLw2Qpf9nPonjhWw3_Lc5eykfV dDRg1fga_

Quoted 85 lines

EJ
CtMR5FPF3CjtDKJYjCUT1tvU&s=XW811-B24-
DCa7KJgZdBUlXx9LYmZMzfByaCAlChmi8&e=

---
changelog:
v1->v2:
- addressed comments from Satananda
- added vlan type match field
- kept space for types between l2, l3, l4 header match types
- renamed mask to mask_supported with shorter width
- made more fields reserved for furture
- addressed comments from Heng
- grammar correction
- added field to indicate supported number of actions per flow filter match entry
- added missing documentation for max_flow_priorities_per_group v0->v1:
- added mask field in the type to indicate supported mask by device and also in later patch to use it to indicate mask on adding flow filter. As a result removed the mask_supported capability field

---
 device-types/net/description.tex | 220
++++++++++++++++++++++++++++++-
 1 file changed, 218 insertions(+), 2 deletions(-)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex index fc56af6..2aba5d0 100644

device-types/net/description.tex +0 -0
@@ -1173,7 +1173,11 @@ \subsubsection{Flow Filter}\label{sec:Device

Types / Network Device / Device Ope The device indicates the flow filter capabilities to the driver. These capabilities include various maximum device limits, supported transports and supported packet match fields. The driver enables the transport for flow -filter requests using a control virtqueue command.
+filter requests using a control virtqueue command. These control virtqueue
+commands are:
+\ref{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Flow Filter / Flow Filter Capabilities Get} +and
+\ref{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Flow Filter / Flow Filter Match Capabilities Get}.

The device supports transporting flow filter requests on either the
control virtqueue or on the flow filter virtqueues or on both. However, device @@ -1181,6 +1185,8 @@ \subsubsection{Flow Filter}\label{sec:Device Types / Network Device / Device Ope at a time, i.e. either control virtqueue or flow filter virtqueues.
Once the driver sets the flow filter request transport in the device,
the driver can send flow filter request using the enabled transport. +The driver enables the transport for flow filter requests using a control
+virtqueue command.

The flow filters are grouped using a flow filter group. Each flow
filter group has a priority. The device first applies the flow filters of the highest @@ -1247,7 +1253,136 @@ \subsubsection{Flow Filter}\label{sec:Device Types / Network Device / Device Ope
the flow filters in group_C, the flow filters of next level
group_B are applied.
\end{itemize}

-\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Setting Promiscuous Mode}%old label for latexdiff +\paragraph{Match Types and Fields}\label{sec:Device Types / Network Device / Device Operation / Flow Filter / Match Types and Fields}

device-types/net/description.tex +14 -0
+
+\begin{lstlisting}
+struct virtio_net_ff_match_type_cap {
+        le16 type;
+        u8 mask_supported;
+        u8 reserved[5];
+        le64 fields_bmap;
+};
+\end{lstlisting}
+
+The \field{type} corresponds to following table:
+
+\begin{tabular}{|l|l|l|}
+\hline
Quoted 8 lines
Quoted 7 lines

+Type & Name & Description \\
+\hline \hline
+0 & VIRTIO_NET_FF_ETH_HDR & Ethernet header of the packet \\
+\hline
+0x1 & VIRTIO_NET_FF_VLAN_TAG_HDR & VLAN tag of the packet \\
+\hline
+0x200 & VIRTIO_NET_FF_IPV4_HDR & IPv4 header of the packet \\

This leaves 256 types for L2 and VLAN, do we really need so many L2 types ?

In practice, mostly not so many. But kept the space in case. Currently around 200+ ether types are defined at [1].
[1] https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml

Quoted 4 lines
Quoted 3 lines

+\hline
+0x300 & VIRTIO_NET_FF_IPV6_HDR & IPv6 header of the packet \\
+\hline

Can we leave a few bits (4) for L3 headers and start L4 after?

IPv4 is at 0x200
IPV6 is at 0x300
L4 is at 0x400.

So there is space reserved for 256 for each L3 type.

Do you mean to leave less bits than worth of 256?

Quoted 2 lines

Specifically for IPV6 we may need extension header bits matching in future. (SPI in ESP extension header for instance).

Yes, above reserved space can fit IPv6 extension starting 0x301 to 0x3ff.

Quoted 6 lines
Quoted 3 lines

+0x400 & VIRTIO_NET_FF_TCP_HDR & TCP header of the packet \\
+\hline
+0x500 & VIRTIO_NET_FF_UDP_HDR & UDP header of the packet \\

Regards
Satananda

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

[virtio-comment] RE: [EXT] [PATCH v3 5/6] virtio-net: Add flow filter match entry, action and requests

Hi Parav

Quoted 96 lines

-----Original Message-----
From: Parav Pandit <[email protected]>
Sent: Friday, October 27, 2023 6:23 AM
To: [email protected]; [email protected]; [email protected]
Cc: Satananda Burla <[email protected]>; [email protected]; si- [email protected]; [email protected]; Parav Pandit <[email protected]>; Heng Qi <[email protected]>
Subject: [EXT] [PATCH v3 5/6] virtio-net: Add flow filter match entry, action and requests

External Email

----------------------------------------------------------------------
Define flow filter match key for the defined types.

Currently it covers the most common filter types and value of Ethernet header, IP addresses, TCP and UDP ports.

Define generic flow filter add and delete requests and its transport using a control virtqueue command and flow filter virtqueue(s).

Fixes: https://urldefense.proofpoint.com/v2/url?u=https-
3A__github.com_oasis-2Dtcs_virtio- 2Dspec_issues_179&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=NHDPsfcAYlN2z- NXHHG4WB09qqS0voo_nf6_kGS625A&m=pDD152kDeYQpenIq0s9wtl9jKhGXu8vH8UADzvj3 0H0vYSHapi4Dg_VGMbM6Q11k&s=JVXwjbepSf9bUQv4ij0cZm6juQ5i1eh61To_7gykte8&e =

---
changelog:
v1->v2:
- squashed with match fields definition patch of v1
- added length to the flexible array defintion struct to benefit from future runtime length bound checkers listed in
https://urldefense.proofpoint.com/v2/url?u=https-
3A__people.kernel.org_kees_bounded-2Dflexible-2Darrays-2Din- 2Dc&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=NHDPsfcAYlN2z- NXHHG4WB09qqS0voo_nf6_kGS625A&m=pDD152kDeYQpenIq0s9wtl9jKhGXu8vH8UADzvj3 0H0vYSHapi4Dg_VGMbM6Q11k&s=d23DLZc9XwFc79vSSZqnKj8FcXXZZOeQbK73LIlxNgY&e =
- renamed value to key
- addressed comments from Satananda
- merged destination and action to one struct
v0->v1:
- reworded add flow request text to consider optional mask
- replaced respond with set
- added mask flag to the type

---
 device-types/net/description.tex | 209 +++++++++++++++++++++++++++++++
 1 file changed, 209 insertions(+)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex
index c52ed41..486f661 100644

device-types/net/description.tex +0 -0
@@ -1270,6 +1270,50 @@ \subsubsection{Flow Filter}\label{sec:Device

Types / Network Device / Device Ope
};
\end{lstlisting}

+\begin{lstlisting}

device-types/net/description.tex +7 -0
+struct virtio_ff_match_entry {
+        le16 type;
+        u8 mask_present;
+        u8 key_mask_len; /* sum of length of fields key and mask */
+        le64 fields_bmap;
+        u8 key[];
+        u8 mask[]; /* optional, only present when mask_present is set

to 1 */

device-types/net/description.tex +23 -0
+};
+
+struct virtio_ff_match {
+       u8 num_entries; /* indicates number of valid entries */
+       u8 reserved[7];
+       struct virtio_ff_match_entry entries[];
+};
+
+#define VIRTIO_NET_FF_DEST_TYPE_RQ 0
+
+struct virtio_ff_action_forward {
+        u8 dest_type;
+        u8 reserved[3];
+        union {
+                le16 vq_index;
+                le32 reserved1;
+        };
+};
+
+#define VIRTIO_NET_FF_ACTION_DROP 0
+#define VIRTIO_NET_FF_ACTION_FORWARD 1
+
+struct virtio_ff_action_entry {

device-types/net/description.tex

Quoted 10 lines
device-types/net/description.tex +10 -0
+        u8 action;
+        u8 len; /* indicates the length of value in bytes */
+        u8 value[];
+};
+
+struct virtio_ff_action {
+        u8 num_entries; /* indicates number of valid entries */
+        u8 reserved[7];
+        struct virtio_ff_action_entry entries[];
+};

Thanks. Looks good now.

Regards
Satananda

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/