On 02/02/2021 07:56, Pravin Shelar wrote:
On Mon, Feb 1, 2021 at 9:24 PM Jonas Bonn <jo...@norrbonn.se> wrote:

Hi Jakub,

On 01/02/2021 21:44, Jakub Kicinski wrote:
On Sat, 30 Jan 2021 12:05:40 -0800 Pravin Shelar wrote:
On Sat, Jan 30, 2021 at 10:44 AM Jakub Kicinski <k...@kernel.org> wrote:
On Fri, 29 Jan 2021 22:59:06 -0800 Pravin Shelar wrote:
On Fri, Jan 29, 2021 at 6:08 AM Jonas Bonn <jo...@norrbonn.se> wrote:
Following are the reasons for extracting the header and populating metadata.
1. That is the design used by other tunneling protocols
implementations for handling optional headers. We need to have a
consistent model across all tunnel devices for upper layers.

Could you clarify with some examples? This does not match intuition,
I must be missing something.

You can look at geneve_rx() or vxlan_rcv() that extracts optional
headers in ip_tunnel_info opts.

Okay, I got confused what Jonas was inquiring about. I thought that the
extension headers were not pulled, rather than not parsed. Copying them
as-is to info->opts is right, thanks!


No, you're not confused.  The extension headers are not being pulled in
the current patchset.

Incoming packet:

---------------------------------------------------------------------
| flags | type | len | TEID | N-PDU | SEQ | Ext | EXT.Hdr | IP | ...
---------------------------------------------------------------------
<--------- GTP header ------<<Optional GTP elements>>-----><- Pkt --->

The "collect metadata" path of the patchset copies 'flags' and 'type' to
info->opts, but leaves the following:

-----------------------------------------
| N-PDU | SEQ | Ext | EXT.Hdr | IP | ...
-----------------------------------------
<--------- GTP header -------><- Pkt --->

So it's leaving _half_ the header and making it a requirement that there
be further intelligence down the line that can handle this.  This is far
from intuitive.


The patch supports Echo, Echo response and End marker packet.
Issue with pulling the entire extension header is that it would result
in zero length skb, such packets can not be passed on to the upper
layer. That is the reason I kept the extension header in skb and added
indication in tunnel metadata that it is not a IP packet. so that
upper layer can process the packet.
IP packet without an extension header would be handled in a fast path
without any special handling.

Obviously In case of PDU session container extension header GTP driver
would need to process the entire extension header in the module. This
way we can handle these user data packets in fastpath.
I can make changes to use the same method for all extension headers if needed.


The most disturbing bit is the fact that the upper layer needs to understand that part of the header info is in info->opts whereas the remainder is on the SKB itself. If it is going to access the SKB anyway, why not just leave the entire GTP header in place and let the upper layer just get all the information from there? What's the advantage of info->opts in this case?

Normally, the gtp module extracts T-PDU's from the GTP packet and passes them on (after validating their IP address) to the network stack. For _everything else_, it just passes them along the socket for handling elsewhere.

It sounds like you are trying to do exactly the same thing: extract T-PDU and inject into network stack for T-PDU's, and pass everything
else to another handler.

So what is different in your case from the normal case?
- there's metadata on the packet... can't we detect this and set the tunnel ID from the TEID in that case? Or can't we just always have metadata on the packet? - the upper layer handler is in kernel space instead of userspace; but they are doing pretty much the same thing, right? why does the kernel space variant need something (info->opts) that userspace can get by without?

It would be seriously good to see a _real_ example of how you intend to use this. Isn't the PDP context mechanism already sufficient to do all of the above? What's missing?

ip route 192.168.99.0/24 encap gtp id 100 dst 172.99.0.2 dev gtp1

is roughly equivalent to:

gtp-tunnel add gtp1 v1 [LOCAL_TEID] 100 172.99.0.2 [UE_IP]

/Jonas


Reply via email to