Re: Advertise maximum number of sg supported by driver in single request

9 messages, 4 authors, 2020-01-21 · open the first message on its own page

Re: Advertise maximum number of sg supported by driver in single request

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2020-01-17 06:23:05

On Thu, Jan 16, 2020 at 01:27:24PM +0530, Ayush Sawal wrote:
The max data limit is 15 sgs where each sg contains data of mtu size .
we are running a netperf udp stream test over ipsec tunnel .The ipsec tunnel
is established between two hosts which are directly connected
Are you actually getting 15-element SG lists from IPsec? What is
generating an skb with 15-element SG lists?

Cheers,
-- 
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Re: Advertise maximum number of sg supported by driver in single request

From: Ayush Sawal <hidden>
Date: 2020-01-17 06:43:32

Hi Herbert,

On 1/17/2020 11:53 AM, Herbert Xu wrote:
On Thu, Jan 16, 2020 at 01:27:24PM +0530, Ayush Sawal wrote:
quoted
The max data limit is 15 sgs where each sg contains data of mtu size .
we are running a netperf udp stream test over ipsec tunnel .The ipsec tunnel
is established between two hosts which are directly connected
Are you actually getting 15-element SG lists from IPsec? What is
generating an skb with 15-element SG lists?
we have established the ipsec tunnel in transport mode using ip xfrm.
and running traffic using netserver and netperf.

In server side we are running
netserver -4
In client side we are running
"netperf -H <serverip> -p <port> -t UDP_STREAM  -Cc -- -m 21k"
where the packet size is 21k ,which is then fragmented into 15 ip 
fragments each of mtu size.
The mtu size currently is 1500bytes.

Re: Advertise maximum number of sg supported by driver in single request

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: 2020-01-17 07:04:36

On Fri, Jan 17, 2020 at 12:13:07PM +0530, Ayush Sawal wrote:
Hi Herbert,

On 1/17/2020 11:53 AM, Herbert Xu wrote:
quoted
On Thu, Jan 16, 2020 at 01:27:24PM +0530, Ayush Sawal wrote:
quoted
The max data limit is 15 sgs where each sg contains data of mtu size .
we are running a netperf udp stream test over ipsec tunnel .The ipsec tunnel
is established between two hosts which are directly connected
Are you actually getting 15-element SG lists from IPsec? What is
generating an skb with 15-element SG lists?
we have established the ipsec tunnel in transport mode using ip xfrm.
and running traffic using netserver and netperf.

In server side we are running
netserver -4
In client side we are running
"netperf -H <serverip> -p <port> -t UDP_STREAM  -Cc -- -m 21k"
where the packet size is 21k ,which is then fragmented into 15 ip fragments
each of mtu size.
I'm lacking a bit of context here, but this should generate 15 IP
packets that are encrypted one by one.

Re: Advertise maximum number of sg supported by driver in single request

From: Ayush Sawal <hidden>
Date: 2020-01-17 10:59:10

Hi steffen,

On 1/17/2020 12:34 PM, Steffen Klassert wrote:
On Fri, Jan 17, 2020 at 12:13:07PM +0530, Ayush Sawal wrote:
quoted
Hi Herbert,

On 1/17/2020 11:53 AM, Herbert Xu wrote:
quoted
On Thu, Jan 16, 2020 at 01:27:24PM +0530, Ayush Sawal wrote:
quoted
The max data limit is 15 sgs where each sg contains data of mtu size .
we are running a netperf udp stream test over ipsec tunnel .The ipsec tunnel
is established between two hosts which are directly connected
Are you actually getting 15-element SG lists from IPsec? What is
generating an skb with 15-element SG lists?
we have established the ipsec tunnel in transport mode using ip xfrm.
and running traffic using netserver and netperf.

In server side we are running
netserver -4
In client side we are running
"netperf -H <serverip> -p <port> -t UDP_STREAM  -Cc -- -m 21k"
where the packet size is 21k ,which is then fragmented into 15 ip fragments
each of mtu size.
I'm lacking a bit of context here, but this should generate 15 IP
packets that are encrypted one by one.
This is what i observed ,please correct me if i am wrong.
The packet when reaches esp_output(),is in socket buffer and based on 
the number of frags ,sg is initialized  using
sg_init_table(sg,frags),where frags are 15 in our case.

The socket buffer data is then copied to this sg and then struct 
aead_request members are filled.
After this crypto aead request which contains all data in its sg list 
goes to hw crypto driver for encryption in a single request.

In the crypto driver we are receiving a single aead-request with all 15 
sgs in that request.

Thanks,

Ayush

Re: Advertise maximum number of sg supported by driver in single request

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: 2020-01-17 12:17:28

On Fri, Jan 17, 2020 at 04:28:54PM +0530, Ayush Sawal wrote:
Hi steffen,

On 1/17/2020 12:34 PM, Steffen Klassert wrote:
quoted
On Fri, Jan 17, 2020 at 12:13:07PM +0530, Ayush Sawal wrote:
quoted
Hi Herbert,

On 1/17/2020 11:53 AM, Herbert Xu wrote:
quoted
On Thu, Jan 16, 2020 at 01:27:24PM +0530, Ayush Sawal wrote:
quoted
The max data limit is 15 sgs where each sg contains data of mtu size .
we are running a netperf udp stream test over ipsec tunnel .The ipsec tunnel
is established between two hosts which are directly connected
Are you actually getting 15-element SG lists from IPsec? What is
generating an skb with 15-element SG lists?
we have established the ipsec tunnel in transport mode using ip xfrm.
and running traffic using netserver and netperf.

In server side we are running
netserver -4
In client side we are running
"netperf -H <serverip> -p <port> -t UDP_STREAM  -Cc -- -m 21k"
where the packet size is 21k ,which is then fragmented into 15 ip fragments
each of mtu size.
I'm lacking a bit of context here, but this should generate 15 IP
packets that are encrypted one by one.
This is what i observed ,please correct me if i am wrong.
The packet when reaches esp_output(),is in socket buffer and based on the
number of frags ,sg is initialized  using
sg_init_table(sg,frags),where frags are 15 in our case.
The packet should be IP fragmented before it enters esp_output()
unless this is a UDP GSO packet. What kind of device do you use
here? Is it a crypto accelerator or a NIC that can do ESP offloads?

Re: Advertise maximum number of sg supported by driver in single request

From: Ayush Sawal <hidden>
Date: 2020-01-17 13:38:30

Hi steffen,

On 1/17/2020 5:47 PM, Steffen Klassert wrote:
On Fri, Jan 17, 2020 at 04:28:54PM +0530, Ayush Sawal wrote:
quoted
Hi steffen,

On 1/17/2020 12:34 PM, Steffen Klassert wrote:
quoted
On Fri, Jan 17, 2020 at 12:13:07PM +0530, Ayush Sawal wrote:
quoted
Hi Herbert,

On 1/17/2020 11:53 AM, Herbert Xu wrote:
quoted
On Thu, Jan 16, 2020 at 01:27:24PM +0530, Ayush Sawal wrote:
quoted
The max data limit is 15 sgs where each sg contains data of mtu size .
we are running a netperf udp stream test over ipsec tunnel .The ipsec tunnel
is established between two hosts which are directly connected
Are you actually getting 15-element SG lists from IPsec? What is
generating an skb with 15-element SG lists?
we have established the ipsec tunnel in transport mode using ip xfrm.
and running traffic using netserver and netperf.

In server side we are running
netserver -4
In client side we are running
"netperf -H <serverip> -p <port> -t UDP_STREAM  -Cc -- -m 21k"
where the packet size is 21k ,which is then fragmented into 15 ip fragments
each of mtu size.
I'm lacking a bit of context here, but this should generate 15 IP
packets that are encrypted one by one.
This is what i observed ,please correct me if i am wrong.
The packet when reaches esp_output(),is in socket buffer and based on the
number of frags ,sg is initialized  using
sg_init_table(sg,frags),where frags are 15 in our case.
The packet should be IP fragmented before it enters esp_output()
unless this is a UDP GSO packet. What kind of device do you use
here? Is it a crypto accelerator or a NIC that can do ESP offloads?
We have device which works as a crypto accelerator . It just encrypts 
the packets and send it back to kernel.

Re: Advertise maximum number of sg supported by driver in single request

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: 2020-01-20 09:37:16

On Fri, Jan 17, 2020 at 07:08:05PM +0530, Ayush Sawal wrote:
Hi steffen,

On 1/17/2020 5:47 PM, Steffen Klassert wrote:
quoted
On Fri, Jan 17, 2020 at 04:28:54PM +0530, Ayush Sawal wrote:
quoted
Hi steffen,

On 1/17/2020 12:34 PM, Steffen Klassert wrote:
quoted
On Fri, Jan 17, 2020 at 12:13:07PM +0530, Ayush Sawal wrote:
quoted
Hi Herbert,

On 1/17/2020 11:53 AM, Herbert Xu wrote:
quoted
On Thu, Jan 16, 2020 at 01:27:24PM +0530, Ayush Sawal wrote:
quoted
The max data limit is 15 sgs where each sg contains data of mtu size .
we are running a netperf udp stream test over ipsec tunnel .The ipsec tunnel
is established between two hosts which are directly connected
Are you actually getting 15-element SG lists from IPsec? What is
generating an skb with 15-element SG lists?
we have established the ipsec tunnel in transport mode using ip xfrm.
and running traffic using netserver and netperf.

In server side we are running
netserver -4
In client side we are running
"netperf -H <serverip> -p <port> -t UDP_STREAM  -Cc -- -m 21k"
where the packet size is 21k ,which is then fragmented into 15 ip fragments
each of mtu size.
I'm lacking a bit of context here, but this should generate 15 IP
packets that are encrypted one by one.
This is what i observed ,please correct me if i am wrong.
The packet when reaches esp_output(),is in socket buffer and based on the
number of frags ,sg is initialized  using
sg_init_table(sg,frags),where frags are 15 in our case.
The packet should be IP fragmented before it enters esp_output()
unless this is a UDP GSO packet. What kind of device do you use
here? Is it a crypto accelerator or a NIC that can do ESP offloads?
We have device which works as a crypto accelerator . It just encrypts the
packets and send it back to kernel.
I just did a test and I see the same behaviour. Seems like I was
mistaken, we actually fragment the ESP packets. The only case
where we do pre-encap fragmentation is IPv6 tunnel mode. But I
wonder if it would make sense to avoid to have ESP fragments on
the wire.

Re: Advertise maximum number of sg supported by driver in single request

From: Ayush Sawal <hidden>
Date: 2020-01-20 12:35:36

Hi Steffen,

On 1/20/2020 3:07 PM, Steffen Klassert wrote:
On Fri, Jan 17, 2020 at 07:08:05PM +0530, Ayush Sawal wrote:
quoted
Hi steffen,

On 1/17/2020 5:47 PM, Steffen Klassert wrote:
quoted
On Fri, Jan 17, 2020 at 04:28:54PM +0530, Ayush Sawal wrote:
quoted
Hi steffen,

On 1/17/2020 12:34 PM, Steffen Klassert wrote:
quoted
On Fri, Jan 17, 2020 at 12:13:07PM +0530, Ayush Sawal wrote:
quoted
Hi Herbert,

On 1/17/2020 11:53 AM, Herbert Xu wrote:
quoted
On Thu, Jan 16, 2020 at 01:27:24PM +0530, Ayush Sawal wrote:
quoted
The max data limit is 15 sgs where each sg contains data of mtu size .
we are running a netperf udp stream test over ipsec tunnel .The ipsec tunnel
is established between two hosts which are directly connected
Are you actually getting 15-element SG lists from IPsec? What is
generating an skb with 15-element SG lists?
we have established the ipsec tunnel in transport mode using ip xfrm.
and running traffic using netserver and netperf.

In server side we are running
netserver -4
In client side we are running
"netperf -H <serverip> -p <port> -t UDP_STREAM  -Cc -- -m 21k"
where the packet size is 21k ,which is then fragmented into 15 ip fragments
each of mtu size.
I'm lacking a bit of context here, but this should generate 15 IP
packets that are encrypted one by one.
This is what i observed ,please correct me if i am wrong.
The packet when reaches esp_output(),is in socket buffer and based on the
number of frags ,sg is initialized  using
sg_init_table(sg,frags),where frags are 15 in our case.
The packet should be IP fragmented before it enters esp_output()
unless this is a UDP GSO packet. What kind of device do you use
here? Is it a crypto accelerator or a NIC that can do ESP offloads?
We have device which works as a crypto accelerator . It just encrypts the
packets and send it back to kernel.
I just did a test and I see the same behaviour. Seems like I was
mistaken, we actually fragment the ESP packets. The only case
where we do pre-encap fragmentation is IPv6 tunnel mode. But I
wonder if it would make sense to avoid to have ESP fragments on
the wire.

As we have a crypto accelarator as device when the request is send to 
the crypto driver from esp_output ,
the aead_request has all the fragments in its src sg and the problem 
which we are facing is when this
src sg nents becomes greater than 15 ,15 is our crypto driver's max sg 
limit to handle the request in one shot.

Does it make sense for a crypto driver to advertise the maximum amount 
of sg it can handle for a single
request and then handling this in crypto framework while forming the 
crypto request?

Thanks,
Ayush


Re: Advertise maximum number of sg supported by driver in single request

From: Gilad Ben-Yossef <gilad@benyossef.com>
Date: 2020-01-21 12:03:32

On Mon, Jan 20, 2020 at 2:35 PM Ayush Sawal
[off-list ref] wrote:
As we have a crypto accelarator as device when the request is send to
the crypto driver from esp_output ,
the aead_request has all the fragments in its src sg and the problem
which we are facing is when this
src sg nents becomes greater than 15 ,15 is our crypto driver's max sg
limit to handle the request in one shot.

Does it make sense for a crypto driver to advertise the maximum amount
of sg it can handle for a single
request and then handling this in crypto framework while forming the
crypto request?
As I maintain the driver of another crypto accelerator I sympathize
with the need but I question the proposed solution.
Consider: your specific driver is limited by the number of
scattergather entries. Another implementation might be limited
by something else such as the total overall size of the request buffer
and probably half a dozen other considerations.
Should we now be passing all this capability information to the crypto
API core? and what happens if a new driver
has a limitation in a different quality?

So no, the solution to advertise the specific capability limitation of
each implementation does not seem to be a good one.
We already have a solution to the problem - initiate a fallback TFM
request and use it if you cannot fulfill the request on your own.

I do agree however that having each implementation registering and
keeping their own fallback tfm request just for these cases has some
overhead and a redundancy.

Maybe a better solution would be to allow implementation to return to
the Crypto API core a special return value (maybe -EAGAIN?) that tells
it that although the request is a valid one, this specific
implementation cannot fulfil it and let the crypto API core do the
fallback?

It sounds like it can be simpler to the implementation providers AND
save some redundant code...

-- 
Gilad Ben-Yossef
Chief Coffee Drinker

values of β will give rise to dom!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help