Message ID | cover.1611637639.git.lucien.xin@gmail.com |
---|---|
Headers | show |
Series | net: enable udp v6 sockets receiving v4 packets with UDP GRO | expand |
Hi, Jakub, I saw the state of this patchset is still new, should I repost it? On Tue, Jan 26, 2021 at 1:10 PM Xin Long <lucien.xin@gmail.com> wrote: > > Currently, udp v6 socket can not process v4 packets with UDP GRO, as > udp_encap_needed_key is not increased when udp_tunnel_encap_enable() > is called for v6 socket. > > This patchset is to increase it and remove the unnecessary code in > bareudp in Patch 1/2, and improve rxrpc encap_enable by calling > udp_tunnel_encap_enable(). > > Xin Long (2): > udp: call udp_encap_enable for v6 sockets when enabling encap > rxrpc: call udp_tunnel_encap_enable in rxrpc_open_socket > > drivers/net/bareudp.c | 6 ------ > include/net/udp.h | 1 + > include/net/udp_tunnel.h | 3 +-- > net/ipv4/udp.c | 6 ++++++ > net/ipv6/udp.c | 4 +++- > net/rxrpc/local_object.c | 6 +----- > 6 files changed, 12 insertions(+), 14 deletions(-) > > -- > 2.1.0 >
Xin Long <lucien.xin@gmail.com> wrote:
> I saw the state of this patchset is still new, should I repost it?
It needs a fix in patch 2 (see my response to that patch).
Thanks,
David
On Wed, Feb 3, 2021 at 4:00 PM David Howells <dhowells@redhat.com> wrote: > > Xin Long <lucien.xin@gmail.com> wrote: > > > I saw the state of this patchset is still new, should I repost it? > > It needs a fix in patch 2 (see my response to that patch). > Sorry, my mistake, I forgot to enable rxrpc when building kernel. Will repost, Thank you. BTW, I'm also thinking to use udp_sock_create(), the only problem I can see is it may not do bind() in rxrpc_open_socket(), is that true? or we can actually bind to some address when a local address is not supplied?
Xin Long <lucien.xin@gmail.com> wrote: > BTW, I'm also thinking to use udp_sock_create(), the only problem I can > see is it may not do bind() in rxrpc_open_socket(), is that true? or we > can actually bind to some address when a local address is not supplied? If a local address isn't explicitly bound to the AF_RXRPC socket, binding the UDP socket to a random local port is fine. In fact, sometimes I want to explicitly bind an rxrpc server socket to a random port. See fs/afs/rxrpc.c function afs_open_socket(): /* bind the callback manager's address to make this a server socket */ memset(&srx, 0, sizeof(srx)); srx.srx_family = AF_RXRPC; srx.srx_service = CM_SERVICE; srx.transport_type = SOCK_DGRAM; srx.transport_len = sizeof(srx.transport.sin6); srx.transport.sin6.sin6_family = AF_INET6; srx.transport.sin6.sin6_port = htons(AFS_CM_PORT); ... ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx)); if (ret == -EADDRINUSE) { srx.transport.sin6.sin6_port = 0; ^^^ That's hoping to get a random port bound. ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx)); } if (ret < 0) goto error_2; The client cache manager server socket here is used to receive notifications back from the fileserver. There's a standard port (7001) for the service, but if that's in use, we can use any other port. The fileserver grabs the source port from incoming RPC requests - and then uses that when sending 3rd-party change notifications back. If you could arrange for a random port to be assigned in such a case (and indicated back to the caller), that would be awesome. Possibly I just don't need to actually use bind in this case. David
On Wed, Feb 3, 2021 at 5:14 PM David Howells <dhowells@redhat.com> wrote: > > Xin Long <lucien.xin@gmail.com> wrote: > > > BTW, I'm also thinking to use udp_sock_create(), the only problem I can > > see is it may not do bind() in rxrpc_open_socket(), is that true? or we > > can actually bind to some address when a local address is not supplied? > > If a local address isn't explicitly bound to the AF_RXRPC socket, binding the > UDP socket to a random local port is fine. In fact, sometimes I want to > explicitly bind an rxrpc server socket to a random port. See fs/afs/rxrpc.c > function afs_open_socket(): > > /* bind the callback manager's address to make this a server socket */ > memset(&srx, 0, sizeof(srx)); > srx.srx_family = AF_RXRPC; > srx.srx_service = CM_SERVICE; > srx.transport_type = SOCK_DGRAM; > srx.transport_len = sizeof(srx.transport.sin6); > srx.transport.sin6.sin6_family = AF_INET6; > srx.transport.sin6.sin6_port = htons(AFS_CM_PORT); > ... > ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx)); > if (ret == -EADDRINUSE) { > srx.transport.sin6.sin6_port = 0; > > ^^^ That's hoping to get a random port bound. > > ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx)); > } > if (ret < 0) > goto error_2; > > The client cache manager server socket here is used to receive notifications > back from the fileserver. There's a standard port (7001) for the service, but > if that's in use, we can use any other port. The fileserver grabs the source > port from incoming RPC requests - and then uses that when sending 3rd-party > change notifications back. > > If you could arrange for a random port to be assigned in such a case (and > indicated back to the caller), that would be awesome. Possibly I just don't > need to actually use bind in this case. > The patch is attached (based on this patch): + udp_conf.family = srx->transport.family; + if (udp_conf.family == AF_INET) { + udp_conf.local_ip = srx->transport.sin.sin_addr; + udp_conf.local_udp_port = srx->transport.sin.sin_port; + } else { + udp_conf.local_ip6 = srx->transport.sin6.sin6_addr; + udp_conf.local_udp_port = srx->transport.sin6.sin6_port; + } + ret = udp_sock_create(net, &udp_conf, &local->socket); I think this will work well. When the socket is not bound, srx->transport.sin.sin(6)_addr/sin(6)_port are zero. It'll bind to a random port in udp_sock_create(). BTW: do you have any testing for this? Thanks.
Xin Long <lucien.xin@gmail.com> wrote:
> BTW: do you have any testing for this?
If you're using a distro like a recent-ish Fedora or, I think, Debian, you
should be able to install a kafs-client package. If that works, start the
afs.mount service with systemctl and then look in /afs. You should see
directories corresponding to a bunch of places that you can try accessing. I
recommend you try "ls /afs/openafs.org".
If you don't have that available, if you have the keyutils package installed,
you can try:
mount -t afs %openafs.org:root.cell /mnt
then do "ls /mnt".
David
Xin Long <lucien.xin@gmail.com> wrote: > > If you could arrange for a random port to be assigned in such a case (and > > indicated back to the caller), that would be awesome. Possibly I just don't > > need to actually use bind in this case. > > > The patch is attached (based on this patch): Initial testing seems to show that it works. I'll poke at it some more tomorrow. David
Xin Long <lucien.xin@gmail.com> wrote: > Subject: [PATCH net-next] rxrpc: use udp tunnel APIs instead of open code in > rxrpc_open_socket > > Signed-off-by: Xin Long <lucien.xin@gmail.com> You can add "Acked-by: David Howells <dhowells@redhat.com>" if you want. David
On Fri, Feb 5, 2021 at 5:14 PM David Howells <dhowells@redhat.com> wrote: > > Xin Long <lucien.xin@gmail.com> wrote: > > > Subject: [PATCH net-next] rxrpc: use udp tunnel APIs instead of open code in > > rxrpc_open_socket > > > > Signed-off-by: Xin Long <lucien.xin@gmail.com> > > You can add "Acked-by: David Howells <dhowells@redhat.com>" if you want. > OK, Thank you so much!