Skip to contentSkip to conversation

introduce IPsec Operation in virtio-net

RFC PATCH Superseded Srujana Challa 2 participants 14 messages Dec 16, 2024 – Jan 10, 2025

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

cover introduce IPsec Operation in virtio-net

This series enhances virtio-net by adding support for IPsec Operation. These patches aim to extend the capabilities of virtio-net, enabling it to handle IPsec operations efficiently. This enables the offloading of IPsec processing, both before transmission and after reception, thereby providing inline offload capabilities.

It is using new virtio basic facilities of capability and resource objects. Below is a summary of the changes introduced:

Patch1:
This patch introduces the foundational support for IPsec within the virtio-net framework, outlining the necessary capabilities and resource objects for IPsec operations.

Patch2:
This patch introduces a new selector and action necessary for IPsec processing, leveraging flow filter actions.

Patch3:
This patch introduces new fields in "struct virtio_net_hdr" to to support IPsec functionality.

Patch4:
This patch specifies the requirements for both the device and the driver to support IPsec operations.

These enhancements are for providing support for IPsec within the virtio-net device/driver, improving security and performance for virtualized environments. We believe these additions will significantly benefit users who rely on virtio-net for secure data transmission.

This series references the Virtio-crypto IPsec service operation capabilities and resource objects data structures, and cryptographic algorithm definitions to avoid duplication, however the admin command type vaule differs between Virtio-crypto and Virtio-net.

depends-on: https://lore.kernel.org/virtio-comment/[email protected]/

Srujana Challa (4):
virtio-net: Add IPsec operation, capabilities and resource objects
virtio-net: Add new flow filter selector and action for IPsec
virtio-net: updates to virtio_net_hdr for IPsec support
virtio-net: Add IPsec operation device and driver requirements

 device-types/net/description.tex        | 191 +++++++++++++++++++++++-
 device-types/net/device-conformance.tex |   1 +
 device-types/net/driver-conformance.tex |   1 +
 introduction.tex                        |   3 +
 4 files changed, 190 insertions(+), 6 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

RFC PATCH 1/4 virtio-net: Add IPsec operation, capabilities and resource objects

This commit introduces the IPsec Operation to the Net device along with the capabilities and resource objects. This enables the offloading of IPsec processing, both before transmission and after reception, thereby providing inline offload capabilities.

Capbilities:

1. IPsec Resource Capability (VIRTIO_CRYPTO_IPSEC_RESOURCE_CAP):
Indicates the device's IPsec resource limits, such as the number of encryption and decryption Security Associations (SAs).
2. IPsec SA Capability (VIRTIO_CRYPTO_IPSEC_SA_CAP): Specifies the supported IPsec modes, along with the supported cryptographic algorithms, authentication algorithms, IPsec options and anti-replay window size.

Resource objects:
1. VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA
2. VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA

These IPsec SA resource objects encompass parameters necessary for packet encryption and decryption. These include the SPI, tunnel headers, IPsec mode, IPsec options, and data specific to cipher and authentication.

This patch refers the Virtio-crypto IPsec service operation capabilities and resource objects data structures and crypto algorithm definitions to avoid duplication, however the admin command type vaule differs between Virtio-crypto and Virtio-net.

---
 device-types/net/description.tex | 47 ++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
device-types/net/description.tex +47 -0
index b2a0d39..2a5f635 100644
@@ -415,6 +415,10 @@ \subsection{Device and driver capabilities}\label{sec:Device Types / Network Dev
 \hline
 0x0802 & \hyperref[par:Device Types / Network Device / Device Operation / Flow filter / Device and driver capabilities / VIRTIO-NET-FF-ACTION-CAP]{VIRTIO_NET_FF_ACTION_CAP} & Flow filter action capability \\
 \hline
+0x0803 & \hyperref[par:Device Types / Crypto Device / Device Operation / IPsec Service Operation / Device and driver capabilities / VIRTIO-CRYPTO-IPSEC-RESOURCE-CAP]{VIRTIO_NET_IPSEC_RESOURCE_CAP} & IPsec resource capability \\
+\hline
+0x0804 & \hyperref[par:Device Types / Crypto Device / Device Operation / IPsec Service Operation / Device and driver capabilities / VIRTIO-CRYPTO-IPSEC-SA-CAP]{VIRTIO_NET_IPSEC_SA_CAP} & IPsec Security Association(SA) capability \\
+\hline
 \end{tabularx}
 
 \subsection{Device resource objects}\label{sec:Device Types / Network Device / Device resource objects}
@@ -431,6 +435,10 @@ \subsection{Device resource objects}\label{sec:Device Types / Network Device / D
 \hline
 0x0202 & \hyperref[par:Device Types / Network Device / Device Operation / Flow filter / Resource objects / VIRTIO-NET-RESOURCE-OBJ-FF-RULE]{VIRTIO_NET_RESOURCE_OBJ_FF_RULE} & Flow filter rule object \\
 \hline
+0x0203 & \hyperref[par:Device Types / Crypto Device / Device Operation / IPsec Service Operation / Resource objects / VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-OUTBOUND-SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA} & IPsec outbound SA resource object \\
+\hline
+0x0204 & \hyperref[par:Device Types / Crypto Device / Device Operation / IPsec Service Operation / Resource objects / VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-INBOUND-SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA} & IPsec inbound SA resource object \\
+\hline
 \end{tabularx}
 
 \subsection{Device Operation}\label{sec:Device Types / Network Device / Device Operation}
@@ -3020,6 +3028,45 @@ \subsubsection{Flow filter}\label{sec:Device Types / Network Device / Device Ope
 capability and the classifier object, unless the VIRTIO_NET_FF_MASK_F_PARTIAL_MASK
 is enabled.
 
+\subsubsection{IPsec Operation}\label{sec:Device Types / Network Device / Device Operation / IPsec Operation}
+
+A network device can support the programming of IPsec Security Associations (SAs).
+In addition to standard packet processing, the IPsec protocol processing is also
+offloaded to the network device. This offloading occurs both pre-transmit and
+post-receive, providing inline offload capabilities.
+
+IPsec Inbound processing: In receive path the device will perform decryption,
+authentication, integrity checking and remove additional headers, including
+tunnel headers if in tunnel mode, as well as the ESP/AH header from the packet.
+The resulting packet contains only the plain data.
+
+IPsec Outbound processing: In transmit path the device will perform encryption,
+attach ICV, update/add IP headers and add ESP/AH headers/trailers to the packet
+and transmit.
+
+\paragraph{Device and driver capabilities}
+\label{par:Device Types / Network Device / Device Operation / IPsec Operation / Device and driver capabilities}
+
+The device and the driver indicate IPsec SA resource limits using the capability
+\hyperref[par:Device Types / Crypto Device / Device Operation / IPsec Service Operation / Device and driver capabilities / VIRTIO-CRYPTO-IPSEC-RESOURCE-CAP]{VIRTIO_NET_IPSEC_RESOURCE_CAP}
+The \hyperref[par:Device Types / Crypto Device / Device Operation / IPsec Service Operation / Device and driver capabilities / VIRTIO-CRYPTO-IPSEC-SA-CAP]{VIRTIO_NET_IPSEC_SA_CAP}
+capability specifies which IPsec protocol capabilities the device supports. The driver indicates
+the IPsec parameters by setting the IPsec SA capability prior to adding any resource objects.
+
+\paragraph{Resource objects}
+\label{par:Device Types / Network Device / Device Operation / IPsec Operation / Resource objects}
+
+The driver controls the IPsec SA resource objects using administration commands described in
+\ref{sec:Basic Facilities of a Virtio Device / Device groups / Group administration commands / Device resource objects}.
+
+The IPsec SA resource objects encompass crucial parameters necessary for packet
+encryption and decryption. These include the SPI, tunnel headers, IPsec mode,
+IPsec options, and data specific to cipher and authentication.
+
+See \hyperref[par:Device Types / Crypto Device / Device Operation / IPsec Service Operation / Resource objects / VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-OUTBOUND-SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA}.
+
+See \hyperref[par:Device Types / Crypto Device / Device Operation / IPsec Service Operation / Resource objects / VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-INBOUND-SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA}.
+
 \subsubsection{Legacy Interface: Framing Requirements}\label{sec:Device
 Types / Network Device / Legacy Interface: Framing Requirements}
 
Signature · 1 line
2.25.1
#2 lore raw

RE: [PATCH RFC 1/4] virtio-net: Add IPsec operation, capabilities and resource objects

Quoted 20 lines

From: Srujana Challa <[email protected]>
Sent: Monday, December 16, 2024 4:19 PM

This commit introduces the IPsec Operation to the Net device along with the capabilities and resource objects. This enables the offloading of IPsec processing, both before transmission and after reception, thereby providing inline offload capabilities.

Capbilities:

1. IPsec Resource Capability (VIRTIO_CRYPTO_IPSEC_RESOURCE_CAP):
Indicates the device's IPsec resource limits, such as the number of encryption and decryption Security Associations (SAs).
2. IPsec SA Capability (VIRTIO_CRYPTO_IPSEC_SA_CAP): Specifies the supported IPsec modes, along with the supported cryptographic algorithms, authentication algorithms, IPsec options and anti-replay window size.

Quoted 8 lines

Resource objects:
1. VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA
2. VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA

These IPsec SA resource objects encompass parameters necessary for packet encryption and decryption. These include the SPI, tunnel headers, IPsec mode, IPsec options, and data specific to cipher and authentication.

How about,
s/data specific to/metadata specific to/ ?

Quoted 5 lines

This patch refers the Virtio-crypto IPsec service operation capabilities and resource objects data structures and crypto algorithm definitions to avoid duplication, however the admin command type vaule differs between Virtio- crypto and Virtio-net.

I read the crypto rfc series, but don't yet fully understand, on how the lookaside crypto device does encrypt/decrypt it. Probably we should relook if ipsec object should be in vnet only or dual.
Will read again the crypto part to learn more.

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

types/net/description.tex
index b2a0d39..2a5f635 100644

device-types/net/description.tex +0 -0
@@ -415,6 +415,10 @@ \subsection{Device and driver

capabilities}\label{sec:Device Types / Network Dev \hline
0x0802 & \hyperref[par:Device Types / Network Device / Device Operation /
Flow filter / Device and driver capabilities / VIRTIO-NET-FF-ACTION- CAP]{VIRTIO_NET_FF_ACTION_CAP} & Flow filter action capability \\ \hline +0x0803 & \hyperref[par:Device Types / Crypto Device / Device Operation

device-types/net/description.tex +2 -0
+/ IPsec Service Operation / Device and driver capabilities /
+VIRTIO-CRYPTO-IPSEC-RESOURCE-CAP]{VIRTIO_NET_IPSEC_RESOURCE_CAP}

&

device-types/net/description.tex +5 -0
+IPsec resource capability \\ \hline
+0x0804 & \hyperref[par:Device Types / Crypto Device / Device Operation
+/ IPsec Service Operation / Device and driver capabilities /
+VIRTIO-CRYPTO-IPSEC-SA-CAP]{VIRTIO_NET_IPSEC_SA_CAP} & IPsec Security
+Association(SA) capability \\ \hline
 \end{tabularx}
 
 \subsection{Device resource objects}\label{sec:Device Types / Network

Device / Device resource objects} @@ -431,6 +435,10 @@ \subsection{Device resource objects}\label{sec:Device Types / Network Device / D \hline
0x0202 & \hyperref[par:Device Types / Network Device / Device Operation /
Flow filter / Resource objects / VIRTIO-NET-RESOURCE-OBJ-FF- RULE]{VIRTIO_NET_RESOURCE_OBJ_FF_RULE} & Flow filter rule object \\
\hline
+0x0203 & \hyperref[par:Device Types / Crypto Device / Device Operation

device-types/net/description.tex +2 -0
+/ IPsec Service Operation / Resource objects /
+VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-OUTBOUND-

SA]{VIRTIO_NET_RESOURCE_OBJ_I

device-types/net/description.tex +4 -0
+PSEC_OUTB_SA} & IPsec outbound SA resource object \\ \hline
+0x0204 & \hyperref[par:Device Types / Crypto Device / Device Operation
+/ IPsec Service Operation / Resource objects /
+VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-INBOUND-

SA]{VIRTIO_NET_RESOURCE_OBJ_IP
+SEC_INB_SA} & IPsec inbound SA resource object \\ \hline
\end{tabularx}

\subsection{Device Operation}\label{sec:Device Types / Network Device /
Device Operation} @@ -3020,6 +3028,45 @@ \subsubsection{Flow filter}\label{sec:Device Types / Network Device / Device Ope capability and the classifier object, unless the VIRTIO_NET_FF_MASK_F_PARTIAL_MASK is enabled.

+\subsubsection{IPsec Operation}\label{sec:Device Types / Network Device

device-types/net/description.tex +3 -0
+/ Device Operation / IPsec Operation}
+
+A network device can support the programming of IPsec Security

Associations (SAs).

device-types/net/description.tex +3 -0
+In addition to standard packet processing, the IPsec protocol
+processing is also offloaded to the network device. This offloading
+occurs both pre-transmit and post-receive, providing inline offload

capabilities.

device-types/net/description.tex +4 -0
+
+IPsec Inbound processing: In receive path the device will perform
+decryption, authentication, integrity checking and remove additional
+headers, including tunnel headers if in tunnel mode, as well as the ESP/AH

header from the packet.

device-types/net/description.tex +19 -0
+The resulting packet contains only the plain data.
+
+IPsec Outbound processing: In transmit path the device will perform
+encryption, attach ICV, update/add IP headers and add ESP/AH
+headers/trailers to the packet and transmit.
+
+\paragraph{Device and driver capabilities} \label{par:Device Types /
+Network Device / Device Operation / IPsec Operation / Device and driver
+capabilities}
+
+The device and the driver indicate IPsec SA resource limits using the
+capability \hyperref[par:Device Types / Crypto Device / Device
+Operation / IPsec Service Operation / Device and driver capabilities /
+VIRTIO-CRYPTO-IPSEC-RESOURCE-CAP]{VIRTIO_NET_IPSEC_RESOURCE_CAP}
+The \hyperref[par:Device Types / Crypto Device / Device Operation /
+IPsec Service Operation / Device and driver capabilities /
+VIRTIO-CRYPTO-IPSEC-SA-CAP]{VIRTIO_NET_IPSEC_SA_CAP}
+capability specifies which IPsec protocol capabilities the device
+supports. The driver indicates the IPsec parameters by setting the IPsec SA

capability prior to adding any resource objects.

device-types/net/description.tex +7 -0
+
+\paragraph{Resource objects}
+\label{par:Device Types / Network Device / Device Operation / IPsec
+Operation / Resource objects}
+
+The driver controls the IPsec SA resource objects using administration
+commands described in \ref{sec:Basic Facilities of a Virtio Device / Device

groups / Group administration commands / Device resource objects}.

device-types/net/description.tex +4 -0
+
+The IPsec SA resource objects encompass crucial parameters necessary
+for packet encryption and decryption. These include the SPI, tunnel
+headers, IPsec mode, IPsec options, and data specific to cipher and
Quoted 2 lines

authentication.
+

IPSec resource object (singular) is enough to explain what it is. Please check other places as well to explain it in singular terms.

Remove the word 'crucial'.
SA resource Object contains necessary parameters ... is enough.

Quoted 13 lines

+See \hyperref[par:Device Types / Crypto Device / Device Operation / IPsec Service Operation / Resource objects / VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC- OUTBOUND-SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA}.

device-types/net/description.tex +2 -0
+
+See \hyperref[par:Device Types / Crypto Device / Device Operation / IPsec

Service Operation / Resource objects / VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC- INBOUND-SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA}.
+
\subsubsection{Legacy Interface: Framing Requirements}\label{sec:Device
Types / Network Device / Legacy Interface: Framing Requirements}

--
2.25.1

#3 lore raw

RE: [PATCH RFC 1/4] virtio-net: Add IPsec operation, capabilities and resource objects

Quoted 142 lines
Quoted 18 lines

From: Srujana Challa <[email protected]>
Sent: Monday, December 16, 2024 4:19 PM

This commit introduces the IPsec Operation to the Net device along with the capabilities and resource objects. This enables the offloading of IPsec processing, both before transmission and after reception, thereby providing inline offload capabilities.

Capbilities:

1. IPsec Resource Capability (VIRTIO_CRYPTO_IPSEC_RESOURCE_CAP):
Indicates the device's IPsec resource limits, such as the number of encryption and decryption Security Associations (SAs).
2. IPsec SA Capability (VIRTIO_CRYPTO_IPSEC_SA_CAP): Specifies the supported IPsec modes, along with the supported cryptographic algorithms, authentication algorithms, IPsec options and anti-replay window size.

Quoted 7 lines

Resource objects:
1. VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA
2. VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA

These IPsec SA resource objects encompass parameters necessary for packet encryption and decryption. These include the SPI, tunnel headers, IPsec mode, IPsec options, and data specific to cipher and

authentication.

Quoted 1 line

How about,
s/data specific to/metadata specific to/ ?

Quoted 5 lines

This patch refers the Virtio-crypto IPsec service operation capabilities and resource objects data structures and crypto algorithm definitions to avoid duplication, however the admin command type vaule differs between Virtio- crypto and Virtio-net.

I read the crypto rfc series, but don't yet fully understand, on how the lookaside crypto device does encrypt/decrypt it.
Probably we should relook if ipsec object should be in vnet only or dual. Will read again the crypto part to learn more.

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

types/net/description.tex index b2a0d39..2a5f635 100644

device-types/net/description.tex +0 -0
@@ -415,6 +415,10 @@ \subsection{Device and driver

capabilities}\label{sec:Device Types / Network Dev \hline
0x0802 & \hyperref[par:Device Types / Network Device / Device
Operation / Flow filter / Device and driver capabilities / VIRTIO-NET-FF-ACTION- CAP]{VIRTIO_NET_FF_ACTION_CAP} & Flow filter action capability \\ \hline
+0x0803 & \hyperref[par:Device Types / Crypto Device / Device

device-types/net/description.tex

Quoted 2 lines
device-types/net/description.tex +2 -0
+Operation / IPsec Service Operation / Device and driver capabilities
+/ VIRTIO-CRYPTO-IPSEC-RESOURCE-

CAP]{VIRTIO_NET_IPSEC_RESOURCE_CAP}

Quoted 10 lines

&

device-types/net/description.tex +6 -0
+IPsec resource capability \\ \hline
+0x0804 & \hyperref[par:Device Types / Crypto Device / Device
+Operation / IPsec Service Operation / Device and driver capabilities
+/ VIRTIO-CRYPTO-IPSEC-SA-CAP]{VIRTIO_NET_IPSEC_SA_CAP} & IPsec
+Security
+Association(SA) capability \\ \hline
 \end{tabularx}
 
 \subsection{Device resource objects}\label{sec:Device Types / Network
Quoted 6 lines

Device / Device resource objects} @@ -431,6 +435,10 @@ \subsection{Device resource objects}\label{sec:Device Types / Network Device / D \hline
0x0202 & \hyperref[par:Device Types / Network Device / Device
Operation / Flow filter / Resource objects / VIRTIO-NET-RESOURCE-OBJ-FF-

RULE]{VIRTIO_NET_RESOURCE_OBJ_FF_RULE} &

Quoted 38 lines

Flow filter rule object \\ \hline
+0x0203 & \hyperref[par:Device Types / Crypto Device / Device

device-types/net/description.tex +2 -0
+Operation / IPsec Service Operation / Resource objects /
+VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-OUTBOUND-

SA]{VIRTIO_NET_RESOURCE_OBJ_I

device-types/net/description.tex +4 -0
+PSEC_OUTB_SA} & IPsec outbound SA resource object \\ \hline
+0x0204 & \hyperref[par:Device Types / Crypto Device / Device
+Operation / IPsec Service Operation / Resource objects /
+VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-INBOUND-

SA]{VIRTIO_NET_RESOURCE_OBJ_IP
+SEC_INB_SA} & IPsec inbound SA resource object \\ \hline
\end{tabularx}

\subsection{Device Operation}\label{sec:Device Types / Network Device
/ Device Operation} @@ -3020,6 +3028,45 @@ \subsubsection{Flow filter}\label{sec:Device Types / Network Device / Device Ope capability and the classifier object, unless the VIRTIO_NET_FF_MASK_F_PARTIAL_MASK is enabled.

+\subsubsection{IPsec Operation}\label{sec:Device Types / Network

device-types/net/description.tex +3 -0
+Device / Device Operation / IPsec Operation}
+
+A network device can support the programming of IPsec Security

Associations (SAs).

device-types/net/description.tex +3 -0
+In addition to standard packet processing, the IPsec protocol
+processing is also offloaded to the network device. This offloading
+occurs both pre-transmit and post-receive, providing inline offload

capabilities.

device-types/net/description.tex +5 -0
+
+IPsec Inbound processing: In receive path the device will perform
+decryption, authentication, integrity checking and remove additional
+headers, including tunnel headers if in tunnel mode, as well as the
+ESP/AH

header from the packet.

device-types/net/description.tex +4 -0
+The resulting packet contains only the plain data.
+
+IPsec Outbound processing: In transmit path the device will perform
+encryption, attach ICV, update/add IP headers and add ESP/AH

device-types/net/description.tex

Quoted 10 lines
device-types/net/description.tex +10 -0
+headers/trailers to the packet and transmit.
+
+\paragraph{Device and driver capabilities} \label{par:Device Types /
+Network Device / Device Operation / IPsec Operation / Device and
+driver capabilities}
+
+The device and the driver indicate IPsec SA resource limits using the
+capability \hyperref[par:Device Types / Crypto Device / Device
+Operation / IPsec Service Operation / Device and driver capabilities
+/ VIRTIO-CRYPTO-IPSEC-RESOURCE-

CAP]{VIRTIO_NET_IPSEC_RESOURCE_CAP}

Quoted 16 lines
device-types/net/description.tex +6 -0
+The \hyperref[par:Device Types / Crypto Device / Device Operation /
+IPsec Service Operation / Device and driver capabilities /
+VIRTIO-CRYPTO-IPSEC-SA-CAP]{VIRTIO_NET_IPSEC_SA_CAP}
+capability specifies which IPsec protocol capabilities the device
+supports. The driver indicates the IPsec parameters by setting the
+IPsec SA

capability prior to adding any resource objects.

device-types/net/description.tex +8 -0
+
+\paragraph{Resource objects}
+\label{par:Device Types / Network Device / Device Operation / IPsec
+Operation / Resource objects}
+
+The driver controls the IPsec SA resource objects using
+administration commands described in \ref{sec:Basic Facilities of a
+Virtio Device / Device

groups / Group administration commands / Device resource objects}.

Quoted 8 lines
Quoted 6 lines
device-types/net/description.tex +4 -0
+
+The IPsec SA resource objects encompass crucial parameters necessary
+for packet encryption and decryption. These include the SPI, tunnel
+headers, IPsec mode, IPsec options, and data specific to cipher and

authentication.
+

IPSec resource object (singular) is enough to explain what it is. Please check other places as well to explain it in singular terms.

Will do.

Quoted 3 lines

Remove the word 'crucial'.
SA resource Object contains necessary parameters ... is enough.

Will do.

Quoted 6 lines
Quoted 5 lines
device-types/net/description.tex +2 -0
+See \hyperref[par:Device Types / Crypto Device / Device Operation /
+IPsec

Service Operation / Resource objects /
VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC- OUTBOUND-

SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA}.

Quoted 13 lines
Quoted 5 lines
device-types/net/description.tex +3 -0
+
+See \hyperref[par:Device Types / Crypto Device / Device Operation /
+IPsec

Service Operation / Resource objects /
VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC- INBOUND-

SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA}.

Quoted 7 lines

+
\subsubsection{Legacy Interface: Framing
Requirements}\label{sec:Device Types / Network Device / Legacy
Interface: Framing Requirements}

--
2.25.1

Thanks.

#4 lore raw

RFC PATCH 2/4 virtio-net: Add new flow filter selector and action for IPsec

In reply to Srujana Challa

This update introduces a new flow filter selector to match the ESP header and adds a new flow filter action for IPsec processing.

---
 device-types/net/description.tex | 23 ++++++++++++++++++++---
 introduction.tex                 |  3 +++
 2 files changed, 23 insertions(+), 3 deletions(-)
device-types/net/description.tex +20 -3
index 2a5f635..ace2538 100644
@@ -2632,7 +2632,9 @@ \subsubsection{Flow filter}\label{sec:Device Types / Network Device / Device Ope
 \hline
 0x5 & VIRTIO_NET_FF_MASK_TYPE_UDP & 8 bytes of UDP header described in \hyperref[intro:UDP]{UDP} \\
 \hline
-0x6 - 0xFF & & Reserved for future \\
+0x6 & VIRTIO_NET_FF_MASK_TYPE_ESP & 8 bytes of ESP header described in \hyperref[intro:ESP]{ESP} \\
+\hline
+0x7 - 0xFF & & Reserved for future \\
 \hline
 \end{tabularx}
 \end{table}
@@ -2692,7 +2694,11 @@ \subsubsection{Flow filter}\label{sec:Device Types / Network Device / Device Ope
 \hline
 0x2 & VIRTIO_NET_FF_ACTION_DIRECT_RX_VQ & Matching packet will be directed to a receive queue \\
 \hline
-0x3 - 0xFF & & Reserved for future \\
+0x3 & VIRTIO_NET_FF_ACTION_SECURITY & Matching packet will undergo IPsec processing \\
+\hline
+0x4 & VIRTIO_NET_FF_ACTION_SECURITY_RECIRCULATE & Matching packet will first undergo IPsec processing, followed by the flow filter rules again \\
+\hline
+0x5 - 0xFF & & Reserved for future \\
 \hline
 \end{tabularx}
 \end{table}
@@ -2746,7 +2752,8 @@ \subsubsection{Flow filter}\label{sec:Device Types / Network Device / Device Ope
 The first selector is always VIRTIO_NET_FF_MASK_TYPE_ETH. When there are multiple
 selectors, a second selector can be either VIRTIO_NET_FF_MASK_TYPE_IPV4
 or VIRTIO_NET_FF_MASK_TYPE_IPV6. If the third selector exists, the third
-selector can be either VIRTIO_NET_FF_MASK_TYPE_UDP or VIRTIO_NET_FF_MASK_TYPE_TCP.
+selector can be one of VIRTIO_NET_FF_MASK_TYPE_UDP, VIRTIO_NET_FF_MASK_TYPE_TCP
+and VIRTIO_NET_FF_MASK_TYPE_ESP.
 For example, to match a Ethernet IPv6 UDP packet,
 \field{selectors[0].type} is set to VIRTIO_NET_FF_MASK_TYPE_ETH, \field{selectors[1].type}
 is set to VIRTIO_NET_FF_MASK_TYPE_IPV6 and \field{selectors[2].type} is
@@ -3044,6 +3051,16 @@ \subsubsection{IPsec Operation}\label{sec:Device Types / Network Device / Device
 attach ICV, update/add IP headers and add ESP/AH headers/trailers to the packet
 and transmit.
 
+\paragraph{Packet processing order}
+\label{par:Device Types / Network Device / Device Operation / IPsec Operation / Packet processing order}
+
+When the flow filter is enabled, the flow filter rules are applied
+before IPsec processing and the packet will undergo IPsec processing
+only when it matches with one of the flow filter rules and the rule
+specifies the action VIRTIO_NET_FF_ACTION_SECURITY.
+See \ref{sec:Device Types / Network Device / Device Operation / Flow filter}
+for details about flow filter.
+
 \paragraph{Device and driver capabilities}
 \label{par:Device Types / Network Device / Device Operation / IPsec Operation / Device and driver capabilities}
 
introduction.tex +3 -0
index e60298a..a7db418 100644
@@ -162,6 +162,9 @@ \section{Normative References}\label{sec:Normative References}
 	\phantomsection\label{intro:TCP-Header-Format}\textbf{[TCP Header Format]} &
     TCP Header Format
 	\newline\url{https://www.rfc-editor.org/rfc/rfc9293#name-header-format}\\
+	\phantomsection\label{intro:ESP}\textbf{[ESP]} &
+    IPsec Protocol
+	\newline\url{https://www.rfc-editor.org/rfc/rfc4303}\\
 	\phantomsection\label{intro:CAN}\textbf{[CAN]} &
     ISO 11898-1:2015 Road vehicles -- Controller area network (CAN) -- Part 1: Data link layer and physical signalling\\
 	\phantomsection\label{intro:rfc8174}\textbf{[RFC8174]} &
Signature · 1 line
2.25.1
#5 lore raw

RE: [PATCH RFC 2/4] virtio-net: Add new flow filter selector and action for IPsec

Quoted 20 lines

From: Srujana Challa <[email protected]>
Sent: Monday, December 16, 2024 4:19 PM

This update introduces a new flow filter selector to match the ESP header and adds a new flow filter action for IPsec processing.

---
 device-types/net/description.tex | 23 ++++++++++++++++++++---
 introduction.tex                 |  3 +++
 2 files changed, 23 insertions(+), 3 deletions(-)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex
index 2a5f635..ace2538 100644

device-types/net/description.tex +0 -0
@@ -2632,7 +2632,9 @@ \subsubsection{Flow filter}\label{sec:Device Types
Quoted 7 lines

/ Network Device / Device Ope \hline
0x5 & VIRTIO_NET_FF_MASK_TYPE_UDP & 8 bytes of UDP header described
in \hyperref[intro:UDP]{UDP} \\ \hline
-0x6 - 0xFF & & Reserved for future \\
+0x6 & VIRTIO_NET_FF_MASK_TYPE_ESP & 8 bytes of ESP header described in
+\hyperref[intro:ESP]{ESP} \\ \hline

ESP is introduced in the previous patches, the 1st patch of this as well as previous crypto extension series. Please move the ESP reference to the first patch where ESP is referred.

Quoted 11 lines

+0x7 - 0xFF & & Reserved for future \\
\hline
\end{tabularx}
\end{table}

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

Types / Network Device / Device Ope \hline
0x2 & VIRTIO_NET_FF_ACTION_DIRECT_RX_VQ & Matching packet will be
directed to a receive queue \\ \hline
-0x3 - 0xFF & & Reserved for future \\
+0x3 & VIRTIO_NET_FF_ACTION_SECURITY & Matching packet will undergo +IPsec processing \\ \hline

Can we name as ACTION_IPSEC here and ACTION_IPSEC_RECIRCULATE

Quoted 4 lines

+0x4 & VIRTIO_NET_FF_ACTION_SECURITY_RECIRCULATE & Matching packet will
+first undergo IPsec processing, followed by the flow filter rules again +\\ \hline

I didn't give enough thought yet, but can we refer to next flow filter group to refer to?
One advantage of recirculating it, one does not need to link the two features, however as same times its slightly more complex for the device.

Will also think more about it later.

Quoted 22 lines

+0x5 - 0xFF & & Reserved for future \\
\hline
\end{tabularx}
\end{table}

device-types/net/description.tex +0 -0
@@ -2746,7 +2752,8 @@ \subsubsection{Flow filter}\label{sec:Device Types

/ Network Device / Device Ope The first selector is always VIRTIO_NET_FF_MASK_TYPE_ETH. When there are multiple selectors, a second selector can be either VIRTIO_NET_FF_MASK_TYPE_IPV4 or VIRTIO_NET_FF_MASK_TYPE_IPV6. If the third selector exists, the third - selector can be either VIRTIO_NET_FF_MASK_TYPE_UDP or VIRTIO_NET_FF_MASK_TYPE_TCP.

device-types/net/description.tex +2 -0
+selector can be one of VIRTIO_NET_FF_MASK_TYPE_UDP,
+VIRTIO_NET_FF_MASK_TYPE_TCP and VIRTIO_NET_FF_MASK_TYPE_ESP.
 For example, to match a Ethernet IPv6 UDP packet,  \field{selectors[0].type}

is set to VIRTIO_NET_FF_MASK_TYPE_ETH, \field{selectors[1].type} is set to VIRTIO_NET_FF_MASK_TYPE_IPV6 and \field{selectors[2].type} is @@ - 3044,6 +3051,16 @@ \subsubsection{IPsec Operation}\label{sec:Device Types / Network Device / Device attach ICV, update/add IP headers and add ESP/AH headers/trailers to the packet and transmit.

+\paragraph{Packet processing order}
+\label{par:Device Types / Network Device / Device Operation / IPsec

device-types/net/description.tex \subsubsection{IPsec Operation}\label{sec:Device Types / Network Device / Device · line 3063

Quoted 9 lines
device-types/net/description.tex +9 -0
+Operation / Packet processing order}
+
+When the flow filter is enabled, the flow filter rules are applied
+before IPsec processing and the packet will undergo IPsec processing
+only when it matches with one of the flow filter rules and the rule
+specifies the action VIRTIO_NET_FF_ACTION_SECURITY.
+See \ref{sec:Device Types / Network Device / Device Operation / Flow
+filter} for details about flow filter.
+

We need to rewrite it better.
IPsec rules are also added using flow filter.
So writing it as " flow filter rules are applied before IPsec processing", is confusing. I believe this is not implicit in the words.
Depending on the group and rule priority, the packet processing order should be decided, right? For example,
Rule_1 says decrypt as priority_A.
Rule_2 says forward packet to RQ_B as priority_A+1, than rule_2 is processed first.

When both the actions are needed, either we extend it as multi_action new rule object or do re-circulate. Need some more thoughts.

Quoted 42 lines

\paragraph{Device and driver capabilities} \label{par:Device Types / Network
Device / Device Operation / IPsec Operation / Device and driver capabilities}

introduction.tex index e60298a..a7db418 renamed from introduction.tex +0 -0

100644

introduction.tex +0 -0
@@ -162,6 +162,9 @@ \section{Normative References}\label{sec:Normative
 References}
 	\phantomsection\label{intro:TCP-Header-Format}\textbf{[TCP Header

Format]} &
TCP Header Format

\newline\url{https://nam11.safelinks.protection.outlook.com/?url=h
ttps%3A%2F%2Fwww.rfc-editor.org%2Frfc%2Frfc9293%23name-header- format&data=05%7C02%7Cparav%40nvidia.com%7C14a0069994c14f63d12b 08dd1dbf4825%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C6386 99429584698491%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRyd WUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3 D%3D%7C0%7C%7C%7C&sdata=h49XO2KUHOP2SyNY470U1p%2B8tE3JLPRyB lRRFTN1x8E%3D&reserved=0}\\

introduction.tex +5 -0
+	\phantomsection\label{intro:ESP}\textbf{[ESP]} &
+    IPsec Protocol
+
+\newline\url{https://nam11.safelinks.protection.outlook.com/?url=https%
+3A%2F%2Fwww.rfc-

editor.org%2Frfc%2Frfc4303&data=05%7C02%7Cparav%40nvidi +a.com%7C14a0069994c14f63d12b08dd1dbf4825%7C43083d15727340c1b7 db39efd9cc +c17a%7C0%7C0%7C638699429584725967%7CUnknown%7CTWFpbGZsb3d 8eyJFbXB0eU1hc +GkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIld UIjoy +fQ%3D%3D%7C0%7C%7C%7C&sdata=R418F4%2F6uWIbeCupZrhhQXGhsHn YLlfw7rDf%2BAd

introduction.tex +1 -0
+wptU%3D&reserved=0}\\
 	\phantomsection\label{intro:CAN}\textbf{[CAN]} &
     ISO 11898-1:2015 Road vehicles -- Controller area network (CAN) -- Part 1:

Data link layer and physical signalling\\
\phantomsection\label{intro:rfc8174}\textbf{[RFC8174]} &
--
2.25.1

#6 lore raw

RE: [PATCH RFC 2/4] virtio-net: Add new flow filter selector and action for IPsec

Quoted 20 lines
Quoted 17 lines

From: Srujana Challa <[email protected]>
Sent: Monday, December 16, 2024 4:19 PM

This update introduces a new flow filter selector to match the ESP header and adds a new flow filter action for IPsec processing.

---
 device-types/net/description.tex | 23 ++++++++++++++++++++---
 introduction.tex                 |  3 +++
 2 files changed, 23 insertions(+), 3 deletions(-)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex index 2a5f635..ace2538 100644

device-types/net/description.tex +0 -0
@@ -2632,7 +2632,9 @@ \subsubsection{Flow filter}\label{sec:Device
Quoted 2 lines

Types / Network Device / Device Ope \hline
0x5 & VIRTIO_NET_FF_MASK_TYPE_UDP & 8 bytes of UDP header

described

Quoted 8 lines
Quoted 5 lines

in \hyperref[intro:UDP]{UDP} \\ \hline
-0x6 - 0xFF & & Reserved for future \\
+0x6 & VIRTIO_NET_FF_MASK_TYPE_ESP & 8 bytes of ESP header described in
+\hyperref[intro:ESP]{ESP} \\ \hline

ESP is introduced in the previous patches, the 1st patch of this as well as previous crypto extension series.
Please move the ESP reference to the first patch where ESP is referred.

Will do.

Quoted 13 lines
Quoted 6 lines

+0x7 - 0xFF & & Reserved for future \\
\hline
\end{tabularx}
\end{table}

device-types/net/description.tex +0 -0
@@ -2692,7 +2694,11 @@ \subsubsection{Flow filter}\label{sec:Device
Quoted 6 lines

Types / Network Device / Device Ope \hline
0x2 & VIRTIO_NET_FF_ACTION_DIRECT_RX_VQ & Matching packet will be
directed to a receive queue \\ \hline
-0x3 - 0xFF & & Reserved for future \\
+0x3 & VIRTIO_NET_FF_ACTION_SECURITY & Matching packet will undergo +IPsec processing \\ \hline

Can we name as ACTION_IPSEC here and ACTION_IPSEC_RECIRCULATE

Will do.

Quoted 48 lines
Quoted 2 lines

+0x4 & VIRTIO_NET_FF_ACTION_SECURITY_RECIRCULATE & Matching

packet

device-types/net/description.tex

Quoted 3 lines

will

device-types/net/description.tex +2 -0
+first undergo IPsec processing, followed by the flow filter rules
+again \\ \hline

I didn't give enough thought yet, but can we refer to next flow filter group to refer to?
One advantage of recirculating it, one does not need to link the two features, however as same times its slightly more complex for the device.

Will also think more about it later.

Quoted 23 lines

+0x5 - 0xFF & & Reserved for future \\
\hline
\end{tabularx}
\end{table}

device-types/net/description.tex +0 -0
@@ -2746,7 +2752,8 @@ \subsubsection{Flow filter}\label{sec:Device

Types / Network Device / Device Ope The first selector is always VIRTIO_NET_FF_MASK_TYPE_ETH. When there are multiple selectors, a second selector can be either VIRTIO_NET_FF_MASK_TYPE_IPV4 or VIRTIO_NET_FF_MASK_TYPE_IPV6. If the third selector exists, the third
- selector can be either VIRTIO_NET_FF_MASK_TYPE_UDP or VIRTIO_NET_FF_MASK_TYPE_TCP.

device-types/net/description.tex +2 -0
+selector can be one of VIRTIO_NET_FF_MASK_TYPE_UDP,
+VIRTIO_NET_FF_MASK_TYPE_TCP and VIRTIO_NET_FF_MASK_TYPE_ESP.
 For example, to match a Ethernet IPv6 UDP packet,

\field{selectors[0].type} is set to VIRTIO_NET_FF_MASK_TYPE_ETH, \field{selectors[1].type} is set to VIRTIO_NET_FF_MASK_TYPE_IPV6 and \field{selectors[2].type} is @@ - 3044,6 +3051,16 @@ \subsubsection{IPsec Operation}\label{sec:Device Types / Network Device / Device attach ICV, update/add IP headers and add ESP/AH headers/trailers to the packet and transmit.

+\paragraph{Packet processing order}
+\label{par:Device Types / Network Device / Device Operation / IPsec

device-types/net/description.tex \subsubsection{IPsec Operation}\label{sec:Device Types / Network Device / Device · line 3063

Quoted 9 lines
device-types/net/description.tex +9 -0
+Operation / Packet processing order}
+
+When the flow filter is enabled, the flow filter rules are applied
+before IPsec processing and the packet will undergo IPsec processing
+only when it matches with one of the flow filter rules and the rule
+specifies the action VIRTIO_NET_FF_ACTION_SECURITY.
+See \ref{sec:Device Types / Network Device / Device Operation / Flow
+filter} for details about flow filter.
+

We need to rewrite it better.
IPsec rules are also added using flow filter.
So writing it as " flow filter rules are applied before IPsec processing", is

Quoted 8 lines

confusing.
I believe this is not implicit in the words.
Depending on the group and rule priority, the packet processing order should be decided, right?
For example,
Rule_1 says decrypt as priority_A.
Rule_2 says forward packet to RQ_B as priority_A+1, than rule_2 is processed first.

I believe setting priorities is the user's responsibility. The user must ensure that IPsec is installed with a higher priority than other rules.

Quoted 4 lines

When both the actions are needed, either we extend it as multi_action new rule object or do re-circulate.
Need some more thoughts.

We prefer to use re-circulate instead of a multi-action rule because the software stack responsible for installing the inner flow rule may differ from the one installing the outer IPSec tunnel rule. Consequently, it is difficult for the software to implement a multi-action rule that encompasses both the outer IPSec tunnel and the inner flow rule.

Quoted 70 lines

introduction.tex \section{Normative

Quoted 11 lines

\paragraph{Device and driver capabilities} \label{par:Device Types /
Network Device / Device Operation / IPsec Operation / Device and driver capabilities}

introduction.tex index renamed from introduction.tex +0 -0

e60298a..a7db418
100644

introduction.tex +0 -0
@@ -162,6 +162,9 @@ \section{Normative

References}\label{sec:Normative

introduction.tex \section{Normative · line 163

Quoted 2 lines
introduction.tex +0 -0
 References}
 	\phantomsection\label{intro:TCP-Header-Format}\textbf{[TCP

Header

Quoted 6 lines

Format]} &
TCP Header Format

\newline\url{https://urldefense.proofpoint.com/v2/url?u=https-3A__nam1 1.safelinks.protection.outlook.com_-3Furl-

3Dh&d=DwIFAg&c=nKjWec2b6R0mO

Quoted 1 line

yPaz7xtfQ&r=Fj4OoD5hcKFpANhTWdwQzjT1Jpf7veC5263T47JVpnc&m=KTP edceyE0qi

Quoted 1 line

qGVp8RtGRbDvgQrp5-1vPQPSR78pNUESuXawGp-kactOzNci0ovN&s=--

h8cPW3wp7xD5h

Quoted 3 lines

EYIf2L5vk_It78vIa0IAzwcY2cn0&e= ttps%3A%2F%2Fwww.rfc-editor.org%2Frfc%2Frfc9293%23name-header-

format&data=05%7C02%7Cparav%40nvidia.com%7C14a0069994c14f63d1 2b

Quoted 1 line

08dd1dbf4825%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C6 386

Quoted 1 line

99429584698491%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnR yd

Quoted 1 line

WUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3

Quoted 1 line

D%3D%7C0%7C%7C%7C&sdata=h49XO2KUHOP2SyNY470U1p%2B8tE3JLPR yB

introduction.tex

Quoted 6 lines

lRRFTN1x8E%3D&reserved=0}\\

introduction.tex +5 -0
+	\phantomsection\label{intro:ESP}\textbf{[ESP]} &
+    IPsec Protocol
+
+\newline\url{https://urldefense.proofpoint.com/v2/url?u=https-3A__nam
+11.safelinks.protection.outlook.com_-3Furl-3Dhttps-

25&d=DwIFAg&c=nKjW

Quoted 1 line

+ec2b6R0mOyPaz7xtfQ&r=Fj4OoD5hcKFpANhTWdwQzjT1Jpf7veC5263T47J Vpnc&m=KT

Quoted 1 line

+PedceyE0qiqGVp8RtGRbDvgQrp5-1vPQPSR78pNUESuXawGp-

kactOzNci0ovN&s=RFAW

Quoted 4 lines

+k9YsEHdE6tkRTLG11l9Ei-DQKm9cYO2vf7RE7u0&e= +3A%2F%2Fwww.rfc- editor.org%2Frfc%2Frfc4303&data=05%7C02%7Cparav%40nvidi

+a.com%7C14a0069994c14f63d12b08dd1dbf4825%7C43083d15727340c 1b7

Quoted 2 lines

db39efd9cc

+c17a%7C0%7C0%7C638699429584725967%7CUnknown%7CTWFpbGZsb 3d

Quoted 2 lines

8eyJFbXB0eU1hc

+GkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIld

Quoted 2 lines

UIjoy

Quoted 11 lines

+fQ%3D%3D%7C0%7C%7C%7C&sdata=R418F4%2F6uWIbeCupZrhhQXGhsH n

introduction.tex

Quoted 4 lines

YLlfw7rDf%2BAd

introduction.tex +1 -0
+wptU%3D&reserved=0}\\
 	\phantomsection\label{intro:CAN}\textbf{[CAN]} &
     ISO 11898-1:2015 Road vehicles -- Controller area network (CAN) -- Part

1:

Quoted 4 lines

Data link layer and physical signalling\\
\phantomsection\label{intro:rfc8174}\textbf{[RFC8174]} &
--
2.25.1

Thanks.

#7 lore raw

RFC PATCH 3/4 virtio-net: updates to virtio_net_hdr for IPsec support

In reply to Srujana Challa

Introduces new fields(8 bytes) to the the virtio_net_hdr structure, enabling IPsec processing.

---
 device-types/net/description.tex | 38 +++++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 3 deletions(-)
device-types/net/description.tex +35 -3
index ace2538..5ebb28a 100644
@@ -453,6 +453,7 @@ \subsection{Device Operation}\label{sec:Device Types / Network Device / Device O
 #define VIRTIO_NET_HDR_F_NEEDS_CSUM    1
 #define VIRTIO_NET_HDR_F_DATA_VALID    2
 #define VIRTIO_NET_HDR_F_RSC_INFO      4
+#define VIRTIO_NET_HDR_F_SECURITY      8
         u8 flags;
 #define VIRTIO_NET_HDR_GSO_NONE        0
 #define VIRTIO_NET_HDR_GSO_TCPV4       1
@@ -469,6 +470,10 @@ \subsection{Device Operation}\label{sec:Device Types / Network Device / Device O
         le32 hash_value;        (Only if VIRTIO_NET_F_HASH_REPORT negotiated)
         le16 hash_report;       (Only if VIRTIO_NET_F_HASH_REPORT negotiated)
         le16 padding_reserved;  (Only if VIRTIO_NET_F_HASH_REPORT negotiated)
+        struct security_hdr {
+                le32 resource_id;
+                le16 resource_type;
+        };
 };
 \end{lstlisting}
 
@@ -492,6 +497,8 @@ \subsubsection{Legacy Interface: Device Operation}\label{sec:Device Types / Netw
 Historically, some devices put
 the total descriptor length there, even though no data was
 actually written.
+
+\field{resource_id} and \field{resource_type} are valid only when IPsec is enabled.
 \end{note}
 
 \subsubsection{Packet Transmission}\label{sec:Device Types / Network Device / Device Operation / Packet Transmission}
@@ -653,6 +660,15 @@ \subsubsection{Packet Transmission}\label{sec:Device Types / Network Device / De
 The driver MUST NOT set the VIRTIO_NET_HDR_F_DATA_VALID and
 VIRTIO_NET_HDR_F_RSC_INFO bits in \field{flags}.
 
+If the device supports \hyperref[par:Device Types / Network Device / Device Operation / IPsec Operation]{IPsec Operation},
+the driver may set VIRTIO_NET_HDR_F_SECURITY bit in \field{flags}, if so:
+\begin{enumerate}
+\item the driver MUST create IPsec Outbound resource object
+\hyperref[par:Device Types / Crypto Device / Device Operation / IPsec Service Operation / Resource objects / VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-ENC-SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA}
+\item the driver MUST set \field{resource_id} to a valid IPsec outbound
+      resource object ID.
+\end{enumerate}
+
 \devicenormative{\paragraph}{Packet Transmission}{Device Types / Network Device / Device Operation / Packet Transmission}
 The device MUST ignore \field{flag} bits that it does not recognize.
 
@@ -684,6 +700,10 @@ \subsubsection{Packet Transmission}\label{sec:Device Types / Network Device / De
 
 If VIRTIO_NET_HDR_F_NEEDS_CSUM is not set, the device MUST NOT
 rely on the packet checksum being correct.
+
+If VIRTIO_NET_HDR_F_SECURITY bit in \field{flags} is not set, the
+device MUST NOT use the \field{resource_id} and \field{resource_type}.
+
 \paragraph{Packet Transmission Interrupt}\label{sec:Device Types / Network Device / Device Operation / Packet Transmission / Packet Transmission Interrupt}
 
 Often a driver will suppress transmission virtqueue interrupts
@@ -728,7 +748,7 @@ \subsubsection{Setting Up Receive Buffers}\label{sec:Device Types / Network Devi
   \end{itemize}
 \item If VIRTIO_NET_F_MRG_RXBUF is negotiated, each buffer MUST be at
 least size of \field{struct virtio_net_hdr},
-i.e. 20 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and 12 bytes if not.
+i.e. 28 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and 20 bytes if not.
 \end{itemize}
 
 \begin{note}
@@ -736,8 +756,8 @@ \subsubsection{Setting Up Receive Buffers}\label{sec:Device Types / Network Devi
 \end{note}
 
 When calculating the size of \field{struct virtio_net_hdr}, the driver
-MUST consider all the fields inclusive up to \field{padding_reserved},
-i.e. 20 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and 12 bytes if not.
+MUST consider all the fields inclusive up to \field{security_hdr},
+i.e. 28 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and 20 bytes if not.
 
 If VIRTIO_NET_F_MQ is negotiated, each of receiveq1\ldots receiveqN
 that will be used SHOULD be populated with receive buffers.
@@ -906,6 +926,14 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
 checksum (in case of multiple encapsulated protocols, one level
 of checksums is validated).
 
+The device SHOULD set the VIRTIO_NET_HDR_F_SECURITY bit in the \field{flags}
+if the packet is gone through the IPsec processing. Otherwise, it should
+be cleared.
+
+The device SHOULD set the VIRTIO_NET_HDR_F_DATA_VALID bit in the \field{flags}
+for IPsec packets only upon successful completion of IPsec processing.
+Otherwise, it should be cleared.
+
 \drivernormative{\paragraph}{Processing of Incoming
 Packets}{Device Types / Network Device / Device Operation /
 Processing of Incoming Packets}
@@ -928,6 +956,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
 VIRTIO_NET_HDR_F_DATA_VALID is set, the driver MUST NOT
 rely on the packet checksum being correct.
 
+If VIRTIO_NET_HDR_F_SECURITY bit is set in the \field{flags},
+the driver SHOULD treat the packet as an error packet if the
+VIRTIO_NET_HDR_F_DATA_VALID bit is not set in the \field{flags}.
+
 \paragraph{Hash calculation for incoming packets}
 \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets}
 
Signature · 1 line
2.25.1
#8 lore raw

RE: [PATCH RFC 3/4] virtio-net: updates to virtio_net_hdr for IPsec support

Quoted 6 lines

From: Srujana Challa <[email protected]>
Sent: Monday, December 16, 2024 4:19 PM
Subject: [PATCH RFC 3/4] virtio-net: updates to virtio_net_hdr for IPsec support

"updates to virtio_net_hdr" .. does not read correct. Please fix subject to "extend virtio_net_hdr for IPsec support".

Quoted 2 lines

Introduces new fields(8 bytes) to the the virtio_net_hdr structure, enabling IPsec processing.

Remove the extra 'the'.

May be just write it as,
Add IPsec resource object identifiers to the virtio_net_hdr for identifying encryption/decryption operations on tx and rx side respectively, along with flags.

Quoted 22 lines
---
 device-types/net/description.tex | 38 +++++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 3 deletions(-)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex
index ace2538..5ebb28a 100644

device-types/net/description.tex +0 -0
@@ -453,6 +453,7 @@ \subsection{Device Operation}\label{sec:Device

Types / Network Device / Device O

 #define VIRTIO_NET_HDR_F_NEEDS_CSUM    1
 #define VIRTIO_NET_HDR_F_DATA_VALID    2
 #define VIRTIO_NET_HDR_F_RSC_INFO      4
device-types/net/description.tex +1 -0
+#define VIRTIO_NET_HDR_F_SECURITY      8
         u8 flags;
 #define VIRTIO_NET_HDR_GSO_NONE        0
 #define VIRTIO_NET_HDR_GSO_TCPV4       1
@@ -469,6 +470,10 @@ \subsection{Device Operation}\label{sec:Device

Types / Network Device / Device O

Quoted 5 lines
         le32 hash_value;        (Only if VIRTIO_NET_F_HASH_REPORT negotiated)
         le16 hash_report;       (Only if VIRTIO_NET_F_HASH_REPORT negotiated)
         le16 padding_reserved;  (Only if VIRTIO_NET_F_HASH_REPORT

negotiated)
+ struct security_hdr {

Lets name it as ipsec_resource_hdr.
Please add comment slightly better than hash report, for example as,

/* Present only if VIRTIO_NET_F_IPSEC_XX negotiated */

device-types/net/description.tex \subsection{Device Operation}\label{sec:Device Types / Network Device / Device O · line 478

Quoted 6 lines
device-types/net/description.tex +3 -0
+                le32 resource_id;
+                le16 resource_type;
+        };
 };
 \end{lstlisting}

The sad part of this feature is, driver will negotiate this feature very early, and increase the vnet hdr size by 8B, and may never use ipsec at all. I feel its worth to negotiate AQ early before DRIVER_OK.
Need to revise that patch, though functionally it is not must. It just non elegant limitation we tend to live with, and we can improve.

Quoted 23 lines
device-types/net/description.tex +0 -0
@@ -492,6 +497,8 @@ \subsubsection{Legacy Interface: Device

Operation}\label{sec:Device Types / Netw Historically, some devices put the total descriptor length there, even though no data was actually written. +
+\field{resource_id} and \field{resource_type} are valid only when IPsec is enabled.
\end{note}

\subsubsection{Packet Transmission}\label{sec:Device Types / Network
Device / Device Operation / Packet Transmission} @@ -653,6 +660,15 @@ \subsubsection{Packet Transmission}\label{sec:Device Types / Network Device / De The driver MUST NOT set the VIRTIO_NET_HDR_F_DATA_VALID and VIRTIO_NET_HDR_F_RSC_INFO bits in \field{flags}.

device-types/net/description.tex +2 -0
+If the device supports \hyperref[par:Device Types / Network Device /
+Device Operation / IPsec Operation]{IPsec Operation}, the driver may set

VIRTIO_NET_HDR_F_SECURITY bit in \field{flags}, if so:
+\begin{enumerate}
+\item the driver MUST create IPsec Outbound resource object +\hyperref[par:Device Types / Crypto Device / Device Operation / IPsec

device-types/net/description.tex +2 -0
+Service Operation / Resource objects /
+VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-ENC-

SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_

device-types/net/description.tex \subsubsection{Packet Transmission}\label{sec:Device Types / Network Device / De · line 671

Quoted 5 lines
device-types/net/description.tex +5 -0
+OUTB_SA} \item the driver MUST set \field{resource_id} to a valid IPsec
+outbound
+      resource object ID.
+\end{enumerate}
+

We also need to add some text, around a small race condition that a SA object may be destroyed, while a receive packet may still have the resource inflight. And driver should handle it. This text description to go in the introduction/theory of operation section somewhere.

Quoted 17 lines

\devicenormative{\paragraph}{Packet Transmission}{Device Types / Network
Device / Device Operation / Packet Transmission} The device MUST ignore \field{flag} bits that it does not recognize.

device-types/net/description.tex +0 -0
@@ -684,6 +700,10 @@ \subsubsection{Packet

Transmission}\label{sec:Device Types / Network Device / De

If VIRTIO_NET_HDR_F_NEEDS_CSUM is not set, the device MUST NOT rely
on the packet checksum being correct.

device-types/net/description.tex +4 -0
+
+If VIRTIO_NET_HDR_F_SECURITY bit in \field{flags} is not set, the
+device MUST NOT use the \field{resource_id} and \field{resource_type}.
+
 \paragraph{Packet Transmission Interrupt}\label{sec:Device Types / Network

Device / Device Operation / Packet Transmission / Packet Transmission Interrupt}

Quoted 11 lines

Often a driver will suppress transmission virtqueue interrupts @@ -728,7
+748,7 @@ \subsubsection{Setting Up Receive Buffers}\label{sec:Device Types / Network Devi
\end{itemize}
\item If VIRTIO_NET_F_MRG_RXBUF is negotiated, each buffer MUST be at
least size of \field{struct virtio_net_hdr}, -i.e. 20 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and 12 bytes if not. +i.e. 28 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and 20 bytes if not.
\end{itemize}

I requested in other rx timestamp patch to have this fix independent of this patch. Lets have the fix there as pre-patch.

Quoted 16 lines

\begin{note}

device-types/net/description.tex +0 -0
@@ -736,8 +756,8 @@ \subsubsection{Setting Up Receive
 Buffers}\label{sec:Device Types / Network Devi  \end{note}
 
 When calculating the size of \field{struct virtio_net_hdr}, the driver -MUST

consider all the fields inclusive up to \field{padding_reserved}, -i.e. 20 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and 12 bytes if not.
+MUST consider all the fields inclusive up to \field{security_hdr}, i.e. +28 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and 20 bytes if not.

If VIRTIO_NET_F_MQ is negotiated, each of receiveq1\ldots receiveqN that
will be used SHOULD be populated with receive buffers.

device-types/net/description.tex +0 -0
@@ -906,6 +926,14 @@ \subsubsection{Processing of Incoming

Packets}\label{sec:Device Types / Network checksum (in case of multiple encapsulated protocols, one level of checksums is validated).

device-types/net/description.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 936

Quoted 4 lines
device-types/net/description.tex +4 -0
+The device SHOULD set the VIRTIO_NET_HDR_F_SECURITY bit in the
+\field{flags} if the packet is gone through the IPsec processing.
+Otherwise, it should be cleared.
+

I think, it should be MUST. Otherwise, the device may do the decryption, and yet not tell to driver if its "SHOULD", and driver may have to detect it by parsing.

device-types/net/description.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 936

Quoted 5 lines

+The device SHOULD set the VIRTIO_NET_HDR_F_DATA_VALID bit in the +\field{flags} for IPsec packets only upon successful completion of IPsec processing.

device-types/net/description.tex +2 -0
+Otherwise, it should be cleared.
+

I am not comfortable to overload the DATA_VALID bit to indicate ipsec decryption error. It already had some past fixes in area of checksum validation. Overloading may lead to more confusion/error.
Can we keep the ipsec_error as some other flag bit?

Quoted 16 lines

\drivernormative{\paragraph}{Processing of Incoming Packets}{Device Types
/ Network Device / Device Operation / Processing of Incoming Packets} @@ - 928,6 +956,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network VIRTIO_NET_HDR_F_DATA_VALID is set, the driver MUST NOT rely on the packet checksum being correct.

device-types/net/description.tex +4 -0
+If VIRTIO_NET_HDR_F_SECURITY bit is set in the \field{flags}, the
+driver SHOULD treat the packet as an error packet if the
+VIRTIO_NET_HDR_F_DATA_VALID bit is not set in the \field{flags}.
+
 \paragraph{Hash calculation for incoming packets}  \label{sec:Device Types /

Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets}

--
2.25.1

#9 lore raw

RE: [PATCH RFC 3/4] virtio-net: updates to virtio_net_hdr for IPsec support

Quoted 5 lines
Quoted 3 lines

Subject: [PATCH RFC 3/4] virtio-net: updates to virtio_net_hdr for IPsec support

"updates to virtio_net_hdr" .. does not read correct. Please fix subject to "extend virtio_net_hdr for IPsec support".

Will do.

Quoted 4 lines
Quoted 3 lines

Introduces new fields(8 bytes) to the the virtio_net_hdr structure, enabling IPsec processing.

Remove the extra 'the'.

Will do.

Quoted 5 lines

May be just write it as,
Add IPsec resource object identifiers to the virtio_net_hdr for identifying encryption/decryption operations on tx and rx side respectively, along with flags.

Will do.

Quoted 26 lines
Quoted 22 lines
---
 device-types/net/description.tex | 38
+++++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 3 deletions(-)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex index ace2538..5ebb28a 100644

device-types/net/description.tex +0 -0
@@ -453,6 +453,7 @@ \subsection{Device Operation}\label{sec:Device

Types / Network Device / Device O

 #define VIRTIO_NET_HDR_F_NEEDS_CSUM    1
 #define VIRTIO_NET_HDR_F_DATA_VALID    2
 #define VIRTIO_NET_HDR_F_RSC_INFO      4
device-types/net/description.tex +1 -0
+#define VIRTIO_NET_HDR_F_SECURITY      8
         u8 flags;
 #define VIRTIO_NET_HDR_GSO_NONE        0
 #define VIRTIO_NET_HDR_GSO_TCPV4       1
@@ -469,6 +470,10 @@ \subsection{Device Operation}\label{sec:Device
Quoted 2 lines

Types / Network Device / Device O
le32 hash_value; (Only if VIRTIO_NET_F_HASH_REPORT

negotiated)

Quoted 1 line

le16 hash_report; (Only if VIRTIO_NET_F_HASH_REPORT

Quoted 15 lines

negotiated)

Quoted 3 lines

le16 padding_reserved; (Only if VIRTIO_NET_F_HASH_REPORT
negotiated)
+ struct security_hdr {

Lets name it as ipsec_resource_hdr.
Please add comment slightly better than hash report, for example as,

/* Present only if VIRTIO_NET_F_IPSEC_XX negotiated */

Quoted 6 lines
device-types/net/description.tex +3 -0
+                le32 resource_id;
+                le16 resource_type;
+        };
 };
 \end{lstlisting}

Will do.

Quoted 34 lines

The sad part of this feature is, driver will negotiate this feature very early, and increase the vnet hdr size by 8B, and may never use ipsec at all.
I feel its worth to negotiate AQ early before DRIVER_OK.
Need to revise that patch, though functionally it is not must. It just non elegant limitation we tend to live with, and we can improve.

Quoted 3 lines
device-types/net/description.tex +0 -0
@@ -492,6 +497,8 @@ \subsubsection{Legacy Interface: Device

Operation}\label{sec:Device Types / Netw Historically, some devices put the total descriptor length there, even though no data was actually

written.

Quoted 24 lines
device-types/net/description.tex +3 -0
+
+\field{resource_id} and \field{resource_type} are valid only when
+IPsec is

enabled.
\end{note}

\subsubsection{Packet Transmission}\label{sec:Device Types / Network
Device / Device Operation / Packet Transmission} @@ -653,6 +660,15 @@ \subsubsection{Packet Transmission}\label{sec:Device Types / Network Device / De The driver MUST NOT set the VIRTIO_NET_HDR_F_DATA_VALID and VIRTIO_NET_HDR_F_RSC_INFO bits in \field{flags}.

device-types/net/description.tex +3 -0
+If the device supports \hyperref[par:Device Types / Network Device /
+Device Operation / IPsec Operation]{IPsec Operation}, the driver may
+set

VIRTIO_NET_HDR_F_SECURITY bit in \field{flags}, if so:
+\begin{enumerate}
+\item the driver MUST create IPsec Outbound resource object +\hyperref[par:Device Types / Crypto Device / Device Operation / IPsec

device-types/net/description.tex +2 -0
+Service Operation / Resource objects /
+VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-ENC-

SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_

device-types/net/description.tex +2 -0
+OUTB_SA} \item the driver MUST set \field{resource_id} to a valid
+IPsec outbound
Quoted 8 lines

device-types/net/description.tex \subsubsection{Packet Transmission}\label{sec:Device Types / Network Device / De · line 671

Quoted 3 lines
device-types/net/description.tex +3 -0
+      resource object ID.
+\end{enumerate}
+

We also need to add some text, around a small race condition that a SA object may be destroyed, while a receive packet may still have the resource inflight.
And driver should handle it. This text description to go in the introduction/theory of operation section somewhere.

Will do. Can we add to the driver requirements section?

Quoted 18 lines
Quoted 18 lines

\devicenormative{\paragraph}{Packet Transmission}{Device Types /
Network Device / Device Operation / Packet Transmission} The device MUST ignore \field{flag} bits that it does not recognize.

device-types/net/description.tex +0 -0
@@ -684,6 +700,10 @@ \subsubsection{Packet

Transmission}\label{sec:Device Types / Network Device / De

If VIRTIO_NET_HDR_F_NEEDS_CSUM is not set, the device MUST NOT rely
on the packet checksum being correct.

device-types/net/description.tex +4 -0
+
+If VIRTIO_NET_HDR_F_SECURITY bit in \field{flags} is not set, the
+device MUST NOT use the \field{resource_id} and \field{resource_type}.
+
 \paragraph{Packet Transmission Interrupt}\label{sec:Device Types /

Network Device / Device Operation / Packet Transmission / Packet Transmission Interrupt}

Quoted 16 lines
Quoted 10 lines

Often a driver will suppress transmission virtqueue interrupts @@
-728,7
+748,7 @@ \subsubsection{Setting Up Receive Buffers}\label{sec:Device Types / Network Devi
\end{itemize}
\item If VIRTIO_NET_F_MRG_RXBUF is negotiated, each buffer MUST be at
least size of \field{struct virtio_net_hdr}, -i.e. 20 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and 12 bytes if not.

device-types/net/description.tex +2 -0
+i.e. 28 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and 20 bytes
+if
Quoted 3 lines

not.
\end{itemize}

I requested in other rx timestamp patch to have this fix independent of this patch.
Lets have the fix there as pre-patch.

Ack.

Quoted 18 lines
Quoted 8 lines

\begin{note}

device-types/net/description.tex +0 -0
@@ -736,8 +756,8 @@ \subsubsection{Setting Up Receive
 Buffers}\label{sec:Device Types / Network Devi  \end{note}
 
 When calculating the size of \field{struct virtio_net_hdr}, the

driver -MUST consider all the fields inclusive up to \field{padding_reserved}, -i.e. 20 bytes if VIRTIO_NET_F_HASH_REPORT is

negotiated, and 12 bytes if not.

Quoted 9 lines

+MUST consider all the fields inclusive up to \field{security_hdr}, i.e. +28 bytes if VIRTIO_NET_F_HASH_REPORT is negotiated, and 20 bytes if not.

If VIRTIO_NET_F_MQ is negotiated, each of receiveq1\ldots receiveqN
that will be used SHOULD be populated with receive buffers.

device-types/net/description.tex +0 -0
@@ -906,6 +926,14 @@ \subsubsection{Processing of Incoming

Packets}\label{sec:Device Types / Network checksum (in case of multiple encapsulated protocols, one level of checksums is validated).

Quoted 7 lines

device-types/net/description.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 936

Quoted 4 lines
device-types/net/description.tex +4 -0
+The device SHOULD set the VIRTIO_NET_HDR_F_SECURITY bit in the
+\field{flags} if the packet is gone through the IPsec processing.
+Otherwise, it should be cleared.
+

I think, it should be MUST. Otherwise, the device may do the decryption, and yet not tell to driver if its "SHOULD", and driver may have to detect it by parsing.

Will do.

Quoted 12 lines

device-types/net/description.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 936

Quoted 7 lines
device-types/net/description.tex +3 -0
+The device SHOULD set the VIRTIO_NET_HDR_F_DATA_VALID bit in the
+\field{flags} for IPsec packets only upon successful completion of
+IPsec

processing.

device-types/net/description.tex +2 -0
+Otherwise, it should be cleared.
+

I am not comfortable to overload the DATA_VALID bit to indicate ipsec decryption error.
It already had some past fixes in area of checksum validation. Overloading may lead to more confusion/error.
Can we keep the ipsec_error as some other flag bit?

Yes, since \field{flags} is limited to 8 bits, we considered overloading the DATA_VALID bit.

Quoted 17 lines
Quoted 6 lines

\drivernormative{\paragraph}{Processing of Incoming Packets}{Device
Types / Network Device / Device Operation / Processing of Incoming Packets} @@ -
928,6 +956,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network

VIRTIO_NET_HDR_F_DATA_VALID

Quoted 10 lines

is set, the driver MUST NOT rely on the packet checksum being correct.

device-types/net/description.tex +4 -0
+If VIRTIO_NET_HDR_F_SECURITY bit is set in the \field{flags}, the
+driver SHOULD treat the packet as an error packet if the
+VIRTIO_NET_HDR_F_DATA_VALID bit is not set in the \field{flags}.
+
 \paragraph{Hash calculation for incoming packets}  \label{sec:Device

Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets}

Quoted 2 lines
Quoted 2 lines

--
2.25.1

Thanks.

#10 lore raw

RE: [PATCH RFC 3/4] virtio-net: updates to virtio_net_hdr for IPsec support

Quoted 24 lines

From: Srujana Challa <[email protected]>
Sent: Wednesday, January 8, 2025 3:57 PM

Quoted 12 lines
Quoted 12 lines
(quoted diff) +3 -0
+If the device supports \hyperref[par:Device Types / Network Device
+/ Device Operation / IPsec Operation]{IPsec Operation}, the driver
+may set

VIRTIO_NET_HDR_F_SECURITY bit in \field{flags}, if so:
+\begin{enumerate}
+\item the driver MUST create IPsec Outbound resource object +\hyperref[par:Device Types / Crypto Device / Device Operation /

(quoted diff) +2 -0
+IPsec Service Operation / Resource objects /
+VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-ENC-

SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_

(quoted diff) +2 -0
+OUTB_SA} \item the driver MUST set \field{resource_id} to a valid
+IPsec outbound
Quoted 8 lines

device-types/net/description.tex \subsubsection{Packet Transmission}\label{sec:Device Types / Network Device / De · line 671

Quoted 3 lines
device-types/net/description.tex +3 -0
+      resource object ID.
+\end{enumerate}
+

We also need to add some text, around a small race condition that a SA object may be destroyed, while a receive packet may still have the resource inflight.
And driver should handle it. This text description to go in the introduction/theory of operation section somewhere.

Quoted 1 line

Will do. Can we add to the driver requirements section?

Adding to driver requirements section is mostly the addition.
As long as enough description is present in introduction its good.
And normative (which has some duplication to introduction) in requirement section is fine.

#11 lore raw

RFC PATCH 4/4 virtio-net: Add IPsec operation device and driver requirements

In reply to Srujana Challa

Add device and driver requirements for IPsec Operation.

---
 device-types/net/description.tex        | 83 +++++++++++++++++++++++++
 device-types/net/device-conformance.tex |  1 +
 device-types/net/driver-conformance.tex |  1 +
 3 files changed, 85 insertions(+)
device-types/net/description.tex +83 -0
index 5ebb28a..a686c69 100644
@@ -3116,6 +3116,89 @@ \subsubsection{IPsec Operation}\label{sec:Device Types / Network Device / Device
 
 See \hyperref[par:Device Types / Crypto Device / Device Operation / IPsec Service Operation / Resource objects / VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC-INBOUND-SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA}.
 
+\devicenormative{\paragraph}{IPsec Operation}{Device Types / Net Device / Device Operation / IPsec Operation}
+
+When the device supports IPsec operations,
+\begin{itemize}
+\item the device MUST set VIRTIO_NET_IPSEC_RESOURCE_CAP, VIRTIO_NET_IPSEC_SA_CAP
+capability in the \field{supported_caps} in the command VIRTIO_ADMIN_CMD_CAP_SUPPORT_QUERY.
+\item the device MUST support the administration commands
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_MODIFY, VIRTIO_ADMIN_CMD_RESOURCE_OBJ_QUERY,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_DESTROY for the resource types
+VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA and VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA.
+\end{itemize}
+
+When any of the VIRTIO_NET_IPSEC_RESOURCE_CAP or VIRTIO_NET_IPSEC_SA_CAP
+capability is disabled, the device MUST set \field{status} to
+VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE for the commands
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_MODIFY, VIRTIO_ADMIN_CMD_RESOURCE_OBJ_QUERY,
+and VIRTIO_ADMIN_CMD_RESOURCE_OBJ_DESTROY.
+
+The device MUST set \field{status} to VIRTIO_ADMIN_STATUS_EEXIT for the
+command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE when the resource \field{type}
+is VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA or VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA,
+if the object already exists with the supplied \field{id}.
+
+The device MUST set \field{status} to VIRTIO_ADMIN_STATUS_EBUSY for the
+command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_DESTROY when the resource \field{type}
+is VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA or VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA,
+if the object is in use.
+
+The device MUST fail the command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE for the
+VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA object if,
+\begin{itemize}
+\item \field{id} is greater than or equal to \field{outb_sa_limit}.
+\item the supplied SA parameters, such as mode, options, cipher and authentication
+      algorithms are not supported in the capabitlity VIRTIO_NET_IPSEC_SA_CAP.
+\end{itemize}
+
+The device MUST fail the command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE for the
+VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA object if,
+\begin{itemize}
+\item \field{id} is greater than or equal to \field{inb_sa_limit}.
+\item the supplied SA parameters, such as mode, options, cipher and authentication
+      algorithms are not supported in the capabitlity VIRTIO_NET_IPSEC_SA_CAP.
+\end{itemize}
+
+The device SHOULD maintain a table for subsequent lookups to inbound/outbound data
+with the corresponding SA based on the supplied \field{id}.
+
+The device MUST allow recreating the resource objects using the command
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE which was previously destroyed using
+the command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_DESTROY respectively without
+undergoing a device reset.
+
+The device MAY fail the command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE with
+the \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL for the
+VIRTIO_CRYPTO_RESOURCE_OBJ_IPSEC_OUTB_SA or VIRTIO_CRYPTO_RESOURCE_OBJ_IPSEC_INB_SA
+commands if the resource object with the same \field{spi} already exists.
+
+On device reset, the device MUST destroy all the resource objects which have been created.
+
+\drivernormative{\paragraph}{IPsec Operation}{Device Types / Net Device / Device Operation / IPsec Operation}
+
+The driver MUST query the capabilities using VIRTIO_ADMIN_CMD_CAP_ID_LIST_QUERY
+to discover the capability types the device offers.
+
+The driver MUST get VIRTIO_NET_IPSEC_RESOURCE_CAP and VIRTIO_NET_IPSEC_SA_CAP
+if listed in VIRTIO_ADMIN_CMD_CAP_ID_LIST_QUERY command result, using
+VIRTION_ADMIN_CMD_DEVICE_CAP_GET to discover the capabilities the device is
+able to offer.
+The driver MUST set VIRTIO_NET_IPSEC_RESOURCE_CAP and VIRTIO_NET_IPSEC_SA_CAP
+using VIRTIO_ADMIN_CMD_DEVICE_CAP_SET to indicate the device which capability
+the driver uses.
+
+For the command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE, when creating a resource
+VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA, the driver MUST set all the parameters
+in \field struct virtio_crypto_resource_obj_ipsec_sa with relevant values.
+And when create a resource object VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA,
+the driver MUST set all the parameters except
+\field struct virtio_crypto_ipsec_tunnel_param.
+
+The driver SHOULD NOT add multiple inbound SA objects with the same \field{spi}.
+
 \subsubsection{Legacy Interface: Framing Requirements}\label{sec:Device
 Types / Network Device / Legacy Interface: Framing Requirements}
 
device-types/net/device-conformance.tex +1 -0
index d88484c..7fe8505 100644
@@ -18,4 +18,5 @@
 \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / Device Statistics}
 \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
 \item \ref{devicenormative:Device Types / Network Device / Device Operation / Flow filter}
+\item \ref{devicenormative:Device Types / Network Device / Device Operation / IPsec Operation}
 \end{itemize}
device-types/net/driver-conformance.tex +1 -0
index d346b88..0d20190 100644
@@ -18,4 +18,5 @@
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Device Statistics}
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Flow filter}
+\item \ref{drivernormative:Device Types / Network Device / Device Operation / IPsec Operation}
 \end{itemize}
Signature · 1 line
2.25.1
#12 lore raw

RE: [PATCH RFC 4/4] virtio-net: Add IPsec operation device and driver requirements

Quoted 47 lines

-----Original Message-----
From: Srujana Challa <[email protected]>
Sent: Monday, December 16, 2024 4:19 PM

Add device and driver requirements for IPsec Operation.

---
 device-types/net/description.tex        | 83 +++++++++++++++++++++++++
 device-types/net/device-conformance.tex |  1 +  device-types/net/driver-
conformance.tex |  1 +
 3 files changed, 85 insertions(+)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex
index 5ebb28a..a686c69 100644

device-types/net/description.tex +0 -0
@@ -3116,6 +3116,89 @@ \subsubsection{IPsec Operation}\label{sec:Device

Types / Network Device / Device

See \hyperref[par:Device Types / Crypto Device / Device Operation / IPsec
Service Operation / Resource objects / VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC- INBOUND-SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA}.

+\devicenormative{\paragraph}{IPsec Operation}{Device Types / Net Device

device-types/net/description.tex +4 -0
+/ Device Operation / IPsec Operation}
+
+When the device supports IPsec operations, \begin{itemize} \item the
+device MUST set VIRTIO_NET_IPSEC_RESOURCE_CAP,

VIRTIO_NET_IPSEC_SA_CAP
+capability in the \field{supported_caps} in the command VIRTIO_ADMIN_CMD_CAP_SUPPORT_QUERY.
+\item the device MUST support the administration commands

device-types/net/description.tex +5 -0
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_MODIFY,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_QUERY,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_DESTROY for the resource types
+VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA and

VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA.
+\end{itemize}

device-types/net/description.tex +4 -0
+
+When any of the VIRTIO_NET_IPSEC_RESOURCE_CAP or
+VIRTIO_NET_IPSEC_SA_CAP capability is disabled, the device MUST set
+\field{status} to VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE for the

commands

device-types/net/description.tex \subsubsection{IPsec Operation}\label{sec:Device Types / Network Device / Device · line 3138

Quoted 5 lines
device-types/net/description.tex +5 -0
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_MODIFY,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_QUERY,
+and VIRTIO_ADMIN_CMD_RESOURCE_OBJ_DESTROY.
+

Extend above normative - for the object types X_SA ..

Quoted 77 lines
device-types/net/description.tex +2 -0
+The device MUST set \field{status} to VIRTIO_ADMIN_STATUS_EEXIT for the
+command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE when the

resource
+\field{type} is VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA or

device-types/net/description.tex +4 -0
+VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA,
+if the object already exists with the supplied \field{id}.
+
+The device MUST set \field{status} to VIRTIO_ADMIN_STATUS_EBUSY for

the
+command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_DESTROY when the resource
+\field{type} is VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA or

device-types/net/description.tex +4 -0
+VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA,
+if the object is in use.
+
+The device MUST fail the command

VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE
+for the VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA object if, +\begin{itemize} \item \field{id} is greater than or equal to +\field{outb_sa_limit}.
+\item the supplied SA parameters, such as mode, options, cipher and authentication
+ algorithms are not supported in the capabitlity
VIRTIO_NET_IPSEC_SA_CAP.
+\end{itemize}

device-types/net/description.tex +2 -0
+
+The device MUST fail the command

VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE
+for the VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA object if, \begin{itemize}
+\item \field{id} is greater than or equal to \field{inb_sa_limit}. +\item the supplied SA parameters, such as mode, options, cipher and authentication
+ algorithms are not supported in the capabitlity
VIRTIO_NET_IPSEC_SA_CAP.
+\end{itemize}

device-types/net/description.tex +3 -0
+
+The device SHOULD maintain a table for subsequent lookups to
+inbound/outbound data with the corresponding SA based on the supplied

\field{id}.

device-types/net/description.tex +3 -0
+
+The device MUST allow recreating the resource objects using the command
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE which was previously

destroyed
+using the command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_DESTROY respectively

device-types/net/description.tex +3 -0
+without undergoing a device reset.
+
+The device MAY fail the command

VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE

device-types/net/description.tex +6 -0
+with the \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL for the
+VIRTIO_CRYPTO_RESOURCE_OBJ_IPSEC_OUTB_SA or
+VIRTIO_CRYPTO_RESOURCE_OBJ_IPSEC_INB_SA
+commands if the resource object with the same \field{spi} already exists.
+
+On device reset, the device MUST destroy all the resource objects which

have been created.

device-types/net/description.tex +10 -0
+
+\drivernormative{\paragraph}{IPsec Operation}{Device Types / Net Device
+/ Device Operation / IPsec Operation}
+
+The driver MUST query the capabilities using
+VIRTIO_ADMIN_CMD_CAP_ID_LIST_QUERY
+to discover the capability types the device offers.
+
+The driver MUST get VIRTIO_NET_IPSEC_RESOURCE_CAP and
+VIRTIO_NET_IPSEC_SA_CAP if listed in

VIRTIO_ADMIN_CMD_CAP_ID_LIST_QUERY
+command result, using VIRTION_ADMIN_CMD_DEVICE_CAP_GET to discover the

device-types/net/description.tex +3 -0
+capabilities the device is able to offer.
+The driver MUST set VIRTIO_NET_IPSEC_RESOURCE_CAP and
+VIRTIO_NET_IPSEC_SA_CAP using VIRTIO_ADMIN_CMD_DEVICE_CAP_SET

to

device-types/net/description.tex +3 -0
+indicate the device which capability the driver uses.
+
+For the command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE, when
Quoted 5 lines

creating a
+resource VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA, the driver MUST set all
+the parameters in \field struct virtio_crypto_resource_obj_ipsec_sa with relevant values.

\field {struct ..}.
Please check other places in the series.

device-types/net/description.tex

Quoted 4 lines

+And when create a resource object
VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA,

device-types/net/description.tex +2 -0
+the driver MUST set all the parameters except \field struct
+virtio_crypto_ipsec_tunnel_param.

\field {struct ..} .

Quoted 37 lines
device-types/net/description.tex +2 -0
+
+The driver SHOULD NOT add multiple inbound SA objects with the same

\field{spi}.
+
\subsubsection{Legacy Interface: Framing Requirements}\label{sec:Device
Types / Network Device / Legacy Interface: Framing Requirements}

device- renamed from device-types/net/device-conformance.tex +0 -0

types/net/device-conformance.tex
index d88484c..7fe8505 100644

device-types/net/device-conformance.tex +0 -0
@@ -18,4 +18,5 @@
 \item \ref{devicenormative:Device Types / Network Device / Device

Operation / Control Virtqueue / Device Statistics} \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context} \item \ref{devicenormative:Device Types / Network Device / Device Operation / Flow filter}
+\item \ref{devicenormative:Device Types / Network Device / Device

device-types/net/device-conformance.tex +1 -0
+Operation / IPsec Operation}
 \end{itemize}
device- renamed from device-types/net/driver-conformance.tex +0 -0

types/net/driver-conformance.tex
index d346b88..0d20190 100644

device-types/net/driver-conformance.tex +0 -0
@@ -18,4 +18,5 @@
 \item \ref{drivernormative:Device Types / Network Device / Device

Operation / Control Virtqueue / Device Statistics} \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context} \item \ref{drivernormative:Device Types / Network Device / Device Operation / Flow filter}
+\item \ref{drivernormative:Device Types / Network Device / Device +Operation / IPsec Operation}
\end{itemize}
--
2.25.1

#13 lore raw

RE: [PATCH RFC 4/4] virtio-net: Add IPsec operation device and driver requirements

Quoted 44 lines
Quoted 20 lines

-----Original Message-----
From: Srujana Challa <[email protected]>
Sent: Monday, December 16, 2024 4:19 PM

Add device and driver requirements for IPsec Operation.

---
 device-types/net/description.tex        | 83 +++++++++++++++++++++++++
 device-types/net/device-conformance.tex |  1 +
device-types/net/driver- conformance.tex |  1 +
 3 files changed, 85 insertions(+)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex index 5ebb28a..a686c69 100644

device-types/net/description.tex +0 -0
@@ -3116,6 +3116,89 @@ \subsubsection{IPsec

Operation}\label{sec:Device Types / Network Device / Device

Quoted 3 lines

See \hyperref[par:Device Types / Crypto Device / Device Operation /
IPsec Service Operation / Resource objects / VIRTIO-CRYPTO-RESOURCE-OBJ-IPSEC- INBOUND-

SA]{VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA}.

Quoted 20 lines

+\devicenormative{\paragraph}{IPsec Operation}{Device Types / Net

device-types/net/description.tex +4 -0
+Device / Device Operation / IPsec Operation}
+
+When the device supports IPsec operations, \begin{itemize} \item the
+device MUST set VIRTIO_NET_IPSEC_RESOURCE_CAP,

VIRTIO_NET_IPSEC_SA_CAP
+capability in the \field{supported_caps} in the command VIRTIO_ADMIN_CMD_CAP_SUPPORT_QUERY.
+\item the device MUST support the administration commands

device-types/net/description.tex +5 -0
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_MODIFY,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_QUERY,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_DESTROY for the resource types
+VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA and

VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA.
+\end{itemize}

device-types/net/description.tex +3 -0
+
+When any of the VIRTIO_NET_IPSEC_RESOURCE_CAP or
+VIRTIO_NET_IPSEC_SA_CAP capability is disabled, the device MUST set
Quoted 8 lines

device-types/net/description.tex \subsubsection{IPsec Operation}\label{sec:Device Types / Network Device / Device · line 3138

Quoted 7 lines

+\field{status} to VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE for the commands

device-types/net/description.tex +5 -0
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_MODIFY,
+VIRTIO_ADMIN_CMD_RESOURCE_OBJ_QUERY,
+and VIRTIO_ADMIN_CMD_RESOURCE_OBJ_DESTROY.
+

Extend above normative - for the object types X_SA ..

Will do.

Quoted 80 lines
Quoted 41 lines
device-types/net/description.tex +2 -0
+The device MUST set \field{status} to VIRTIO_ADMIN_STATUS_EEXIT for
+the command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE when the

resource
+\field{type} is VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA or

device-types/net/description.tex +4 -0
+VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA,
+if the object already exists with the supplied \field{id}.
+
+The device MUST set \field{status} to VIRTIO_ADMIN_STATUS_EBUSY for

the
+command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_DESTROY when the resource
+\field{type} is VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA or

device-types/net/description.tex +4 -0
+VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA,
+if the object is in use.
+
+The device MUST fail the command

VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE
+for the VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA object if, +\begin{itemize} \item \field{id} is greater than or equal to +\field{outb_sa_limit}.
+\item the supplied SA parameters, such as mode, options, cipher and authentication
+ algorithms are not supported in the capabitlity
VIRTIO_NET_IPSEC_SA_CAP.
+\end{itemize}

device-types/net/description.tex +2 -0
+
+The device MUST fail the command

VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE
+for the VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA object if, \begin{itemize}
+\item \field{id} is greater than or equal to \field{inb_sa_limit}. +\item the supplied SA parameters, such as mode, options, cipher and authentication
+ algorithms are not supported in the capabitlity
VIRTIO_NET_IPSEC_SA_CAP.
+\end{itemize}

device-types/net/description.tex +3 -0
+
+The device SHOULD maintain a table for subsequent lookups to
+inbound/outbound data with the corresponding SA based on the supplied

\field{id}.

device-types/net/description.tex

Quoted 3 lines
device-types/net/description.tex +3 -0
+
+The device MUST allow recreating the resource objects using the
+command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE which was

previously

Quoted 35 lines

destroyed
+using the command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_DESTROY respectively

device-types/net/description.tex +3 -0
+without undergoing a device reset.
+
+The device MAY fail the command

VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE

device-types/net/description.tex +7 -0
+with the \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL for the
+VIRTIO_CRYPTO_RESOURCE_OBJ_IPSEC_OUTB_SA or
+VIRTIO_CRYPTO_RESOURCE_OBJ_IPSEC_INB_SA
+commands if the resource object with the same \field{spi} already exists.
+
+On device reset, the device MUST destroy all the resource objects
+which

have been created.

device-types/net/description.tex +10 -0
+
+\drivernormative{\paragraph}{IPsec Operation}{Device Types / Net
+Device / Device Operation / IPsec Operation}
+
+The driver MUST query the capabilities using
+VIRTIO_ADMIN_CMD_CAP_ID_LIST_QUERY
+to discover the capability types the device offers.
+
+The driver MUST get VIRTIO_NET_IPSEC_RESOURCE_CAP and
+VIRTIO_NET_IPSEC_SA_CAP if listed in

VIRTIO_ADMIN_CMD_CAP_ID_LIST_QUERY
+command result, using VIRTION_ADMIN_CMD_DEVICE_CAP_GET to discover the

device-types/net/description.tex +3 -0
+capabilities the device is able to offer.
+The driver MUST set VIRTIO_NET_IPSEC_RESOURCE_CAP and
+VIRTIO_NET_IPSEC_SA_CAP using VIRTIO_ADMIN_CMD_DEVICE_CAP_SET

to

device-types/net/description.tex +3 -0
+indicate the device which capability the driver uses.
+
+For the command VIRTIO_ADMIN_CMD_RESOURCE_OBJ_CREATE, when
Quoted 8 lines
Quoted 6 lines

creating a
+resource VIRTIO_NET_RESOURCE_OBJ_IPSEC_OUTB_SA, the driver MUST set all

device-types/net/description.tex +2 -0
+the parameters in \field struct virtio_crypto_resource_obj_ipsec_sa
+with

relevant values.

\field {struct ..}.
Please check other places in the series.

Will do.

Quoted 35 lines

device-types/net/description.tex

Quoted 5 lines

+And when create a resource object
VIRTIO_NET_RESOURCE_OBJ_IPSEC_INB_SA,

device-types/net/description.tex +2 -0
+the driver MUST set all the parameters except \field struct
+virtio_crypto_ipsec_tunnel_param.

\field {struct ..} .

Quoted 28 lines
device-types/net/description.tex +2 -0
+
+The driver SHOULD NOT add multiple inbound SA objects with the same

\field{spi}.
+
\subsubsection{Legacy Interface: Framing
Requirements}\label{sec:Device Types / Network Device / Legacy
Interface: Framing Requirements}

device- renamed from device-types/net/device-conformance.tex +0 -0

types/net/device-conformance.tex index d88484c..7fe8505 100644

device-types/net/device-conformance.tex +0 -0
@@ -18,4 +18,5 @@
 \item \ref{devicenormative:Device Types / Network Device / Device

Operation / Control Virtqueue / Device Statistics} \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context} \item \ref{devicenormative:Device Types / Network Device / Device Operation / Flow filter} +\item \ref{devicenormative:Device Types / Network Device / Device

device-types/net/device-conformance.tex +1 -0
+Operation / IPsec Operation}
 \end{itemize}
device- renamed from device-types/net/driver-conformance.tex +0 -0

types/net/driver-conformance.tex index d346b88..0d20190 100644

device-types/net/driver-conformance.tex +0 -0
@@ -18,4 +18,5 @@
 \item \ref{drivernormative:Device Types / Network Device / Device

Operation / Control Virtqueue / Device Statistics} \item

Quoted 8 lines
Quoted 8 lines

\ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context} \item \ref{drivernormative:Device Types / Network Device / Device Operation / Flow filter} +\item \ref{drivernormative:Device Types / Network Device / Device +Operation / IPsec Operation}
\end{itemize}
--
2.25.1

Thanks.