On 10/12/2018 10:16 PM, Dave Watson wrote:
> On 10/11/18 02:45 AM, Daniel Borkmann wrote:
>> Convert kTLS over to make use of sk_msg interface for plaintext and
>> encrypted scattergather data, so it reuses all the sk_msg helpers
>> and data structure which later on in a second step enables to glue
>> this to BPF.
> 
> Looks very clean, thanks!

Thanks, it indeed allows for getting rid of quite a bit of open coded
code by converting to sk_msg API. As it was mentioned in the other mail,
we'd also be able to reuse this framework in future for other potential
additions or ULPs aside from that; consolidating sockmap and tls to work
on the same data structure also helped a lot in testing.

>> -static int zerocopy_from_iter(struct sock *sk, struct iov_iter *from,
>> -                          int length, int *pages_used,
>> -                          unsigned int *size_used,
>> -                          struct scatterlist *to, int to_max_pages,
>> -                          bool charge)
>> -{
> 
> ...
> 
>> -                    err = zerocopy_from_iter(sk, out_iov, data_len, &pages,
>> -                                             chunk, &sgout[1],
>> -                                             (n_sgout - 1), false);
>> +                    err = tls_setup_from_iter(sk, out_iov, data_len,
>> +                                              &pages, chunk, &sgout[1],
>> +                                              (n_sgout - 1));
> 
> Any reason not to add the 'bool charge' to sk_msg_zerocopy_from_iter?
> Then tls_setup_from_iter is not necessary.

I left this bit aside for now by leaving the tls_setup_from_iter() as is,
basically as current zerocopy_from_iter() in current tls code minus the
charge since not used here. Given this is only triggered in RX path (which
is not sk_msg based right now) I didn't want to wrap it into a fake/temp
sk_msg object just for calling into sk_msg_zerocopy_from_iter(), felt a bit
unclean and given the complexity we already have probably more appropriate
to pursue in a second step.

Thanks,
Daniel

Reply via email to