Willem de Bruijn [Fri, 10 Jul 2020 13:29:02 +0000 (09:29 -0400)]
icmp: support rfc 4884
Add setsockopt SOL_IP/IP_RECVERR_4884 to return the offset to an
extension struct if present.
ICMP messages may include an extension structure after the original
datagram. RFC 4884 standardized this behavior. It stores the offset
in words to the extension header in u8 icmphdr.un.reserved[1].
The field is valid only for ICMP types destination unreachable, time
exceeded and parameter problem, if length is at least 128 bytes and
entire packet does not exceed 576 bytes.
Return the offset to the start of the extension struct when reading an
ICMP error from the error queue, if it matches the above constraints.
Do not return the raw u8 field. Return the offset from the start of
the user buffer, in bytes. The kernel does not return the network and
transport headers, so subtract those.
Also validate the headers. Return the offset regardless of validation,
as an invalid extension must still not be misinterpreted as part of
the original datagram. Note that !invalid does not imply valid. If
the extension version does not match, no validation can take place,
for instance.
For backward compatibility, make this optional, set by setsockopt
SOL_IP/IP_RECVERR_RFC4884. For API example and feature test, see
github.com/wdebruij/kerneltools/blob/master/tests/recv_icmp_v2.c
For forward compatibility, reserve only setsockopt value 1, leaving
other bits for additional icmp extensions.
Changes
v1->v2:
- convert word offset to byte offset from start of user buffer
- return in ee_data as u8 may be insufficient
- define extension struct and object header structs
- return len only if constraints met
- if returning len, also validate
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller [Mon, 20 Jul 2020 01:28:34 +0000 (18:28 -0700)]
Merge branch 'rework-mvneta-napi_poll-loop-for-XDP-multi-buffers'
Lorenzo Bianconi says:
====================
rework mvneta napi_poll loop for XDP multi-buffers
Rework mvneta_rx_swbm routine in order to process all rx descriptors before
building the skb or run the xdp program attached to the interface.
Introduce xdp_get_shared_info_from_{buff,frame} utility routines to get the
skb_shared_info pointer from xdp_buff or xdp_frame.
This is a preliminary series to enable multi-buffers and jumbo frames for XDP
according to [1]
[1] https://github.com/xdp-project/xdp-project/blob/master/areas/core/xdp-multi-buffer01-design.org
Changes since v1:
- rely on skb_frag_* utility routines to access page/offset/len of the xdp multi-buffer
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Lorenzo Bianconi [Thu, 16 Jul 2020 22:16:34 +0000 (00:16 +0200)]
net: mvneta: move rxq->left_size on the stack
Allocate rxq->left_size on mvneta_rx_swbm stack since it is used just
in sw bm napi_poll
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Lorenzo Bianconi [Thu, 16 Jul 2020 22:16:33 +0000 (00:16 +0200)]
net: mvneta: get rid of skb in mvneta_rx_queue
Remove skb pointer in mvneta_rx_queue data structure since it is no
longer used
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Lorenzo Bianconi [Thu, 16 Jul 2020 22:16:32 +0000 (00:16 +0200)]
net: mvneta: drop all fragments in XDP_DROP
Release all consumed pages if the eBPF program returns XDP_DROP for XDP
multi-buffers
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Lorenzo Bianconi [Thu, 16 Jul 2020 22:16:31 +0000 (00:16 +0200)]
net: mvneta: move mvneta_run_xdp after descriptors processing
Move mvneta_run_xdp routine after all descriptor processing. This is a
preliminary patch to enable multi-buffers and JUMBO frames support for
XDP
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Lorenzo Bianconi [Thu, 16 Jul 2020 22:16:30 +0000 (00:16 +0200)]
net: mvneta: move skb build after descriptors processing
Move skb build after all descriptors processing. This is a preliminary
patch to enable multi-buffers and JUMBO frames support for XDP.
Introduce mvneta_xdp_put_buff routine to release all pages used by a
XDP multi-buffer
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Lorenzo Bianconi [Thu, 16 Jul 2020 22:16:29 +0000 (00:16 +0200)]
xdp: introduce xdp_get_shared_info_from_{buff, frame} utility routines
Introduce xdp_get_shared_info_from_{buff,frame} utility routines to get
skb_shared_info from xdp buffer/frame pointer.
xdp_get_shared_info_from_{buff,frame} will be used to implement xdp
multi-buffer support
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller [Mon, 20 Jul 2020 01:26:44 +0000 (18:26 -0700)]
Merge branch 'do-a-single-memdup_user-in-sctp_setsockopt-v2'
Christoph Hellwig says:
====================
do a single memdup_user in sctp_setsockopt v2
here is a resend of my series to lift the copy_from_user out of the
individual sctp sockopt handlers into the main sctp_setsockopt
routine.
Changes since v1:
- fixes a few sizeof calls.
- use memzero_explicit in sctp_setsockopt_auth_key instead of special
casing it for a kzfree in the caller
- remove some minor cleanups from sctp_setsockopt_autoclose to keep
it closer to the existing version
- add another little only vaguely related cleanup patch
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:28 +0000 (09:22 +0200)]
sctp: remove the out_nounlock label in sctp_setsockopt
This is just used once, and a direct return for the redirect to the AF
case is much easier to follow than jumping to the end of a very long
function.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:27 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_pf_expose
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:26 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_ecn_supported
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:25 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_auth_supported
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:24 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_event
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:23 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_event
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:22 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_reuse_port
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:21 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_interleaving_supported
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:20 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_scheduler_value
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:19 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_scheduler
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:18 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_add_streams
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:17 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_reset_assoc
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:16 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_reset_streams
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:15 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_enable_strreset
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:14 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_reconfig_supported
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:13 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_default_prinfo
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:12 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_pr_supported
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:11 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_recvnxtinfo
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:10 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_recvrcvinfo
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:09 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_paddr_thresholds
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:08 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_auto_asconf
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:07 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_deactivate_key
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:06 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_del_key
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:05 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_active_key
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:04 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_auth_key
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer. Adapt sctp_setsockopt to use a
kzfree for this case.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:03 +0000 (09:22 +0200)]
sctp: switch sctp_setsockopt_auth_key to use memzero_explicit
Switch from kzfree to sctp_setsockopt_auth_key + kfree to prepare for
moving the kfree to common code.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:02 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_hmac_ident
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:01 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_auth_chunk
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:22:00 +0000 (09:22 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_maxburst
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:59 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_fragment_interleave
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:58 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_context
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:57 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_adaptation_layer
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:56 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_maxseg
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:55 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_mappedv4
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:54 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_associnfo
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:53 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_rtoinfo
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:52 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_nodelay
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:51 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_peer_primary_addr
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:50 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_primary_addr
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:49 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_default_sndinfo
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:48 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_default_send_param
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:47 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_initmsg
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:46 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_partial_delivery_point
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:45 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_delayed_ack
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:44 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_peer_addr_params
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:43 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_autoclose
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:42 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_events
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:41 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_disable_fragments
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:40 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to __sctp_setsockopt_connectx
Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:39 +0000 (09:21 +0200)]
sctp: pass a kernel pointer to sctp_setsockopt_bindx
Rename sctp_setsockopt_bindx_kernel back to sctp_setsockopt_bindx,
and use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer in the old sctp_setsockopt_bindx.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Sun, 19 Jul 2020 07:21:38 +0000 (09:21 +0200)]
sctp: copy the optval from user space in sctp_setsockopt
Prepare for for moving the copy_from_user from the individual sockopts
to the main setsockopt helper. As of this commit the kopt variable
is not used yet, but the following commits will start using it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller [Mon, 20 Jul 2020 01:16:41 +0000 (18:16 -0700)]
Merge branch 'sockopt-cleanups'
Christoph Hellwig says:
====================
sockopt cleanups
this series cleans up various lose ends in the sockopt code, most
importantly removing the compat_{get,set}sockopt infrastructure in favor
of just using in_compat_syscall() in the few places that care.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:31 +0000 (08:23 +0200)]
net: make ->{get,set}sockopt in proto_ops optional
Just check for a NULL method instead of wiring up
sock_no_{get,set}sockopt.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:30 +0000 (08:23 +0200)]
net/ipv6: remove compat_ipv6_{get,set}sockopt
Handle the few cases that need special treatment in-line using
in_compat_syscall(). This also removes all the now unused
compat_{get,set}sockopt methods.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:29 +0000 (08:23 +0200)]
net/ipv6: factor out mcast join/leave setsockopt helpers
Factor out one helper each for setting the native and compat
version of the MCAST_MSFILTER option.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:28 +0000 (08:23 +0200)]
net/ipv6: factor out MCAST_MSFILTER setsockopt helpers
Factor out one helper each for setting the native and compat
version of the MCAST_MSFILTER option.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:27 +0000 (08:23 +0200)]
net/ipv6: factor out MCAST_MSFILTER getsockopt helpers
Factor out one helper each for getting the native and compat
version of the MCAST_MSFILTER option.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:26 +0000 (08:23 +0200)]
net/ipv4: remove compat_ip_{get,set}sockopt
Handle the few cases that need special treatment in-line using
in_compat_syscall().
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:25 +0000 (08:23 +0200)]
net/ipv4: factor out mcast join/leave setsockopt helpers
Factor out one helper each for setting the native and compat
version of the MCAST_MSFILTER option.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:24 +0000 (08:23 +0200)]
net/ipv4: factor out MCAST_MSFILTER setsockopt helpers
Factor out one helper each for setting the native and compat
version of the MCAST_MSFILTER option.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:23 +0000 (08:23 +0200)]
net/ipv4: factor out MCAST_MSFILTER getsockopt helpers
Factor out one helper each for getting the native and compat
version of the MCAST_MSFILTER option.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:22 +0000 (08:23 +0200)]
netfilter: split nf_sockopt
Split nf_sockopt into a getsockopt and setsockopt side as they share
very little code.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:21 +0000 (08:23 +0200)]
netfilter: remove the compat argument to xt_copy_counters_from_user
Lift the in_compat_syscall() from the callers instead.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:20 +0000 (08:23 +0200)]
netfilter: remove the compat_{get,set} methods
All instances handle compat sockopts via in_compat_syscall() now, so
remove the compat_{get,set} methods as well as the
compat_nf_{get,set}sockopt wrappers.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:19 +0000 (08:23 +0200)]
netfilter/ebtables: clean up compat {get, set}sockopt handling
Merge the native and compat {get,set}sockopt handlers using
in_compat_syscall(). Note that this required moving a fair
amout of code around to be done sanely.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:18 +0000 (08:23 +0200)]
netfilter/ip6_tables: clean up compat {get, set}sockopt handling
Merge the native and compat {get,set}sockopt handlers using
in_compat_syscall().
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:17 +0000 (08:23 +0200)]
netfilter/ip_tables: clean up compat {get,set}sockopt handling
Merge the native and compat {get,set}sockopt handlers using
in_compat_syscall().
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:16 +0000 (08:23 +0200)]
netfilter/arp_tables: clean up compat {get, set}sockopt handling
Merge the native and compat {get,set}sockopt handlers using
in_compat_syscall().
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:15 +0000 (08:23 +0200)]
net: remove compat_sys_{get,set}sockopt
Now that the ->compat_{get,set}sockopt proto_ops methods are gone
there is no good reason left to keep the compat syscalls separate.
This fixes the odd use of unsigned int for the compat_setsockopt
optlen and the missing sock_use_custom_sol_socket.
It would also easily allow running the eBPF hooks for the compat
syscalls, but such a large change in behavior does not belong into
a consolidation patch like this one.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:14 +0000 (08:23 +0200)]
net: remove compat_sock_common_{get,set}sockopt
Add the compat handling to sock_common_{get,set}sockopt instead,
keyed of in_compat_syscall(). This allow to remove the now unused
->compat_{get,set}sockopt methods from struct proto_ops.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:13 +0000 (08:23 +0200)]
net: simplify cBPF setsockopt compat handling
Add a helper that copies either a native or compat bpf_fprog from
userspace after verifying the length, and remove the compat setsockopt
handlers that now aren't required.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:12 +0000 (08:23 +0200)]
net: streamline __sys_getsockopt
Return early when sockfd_lookup_light fails to reduce a level of
indentation for most of the function body.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:11 +0000 (08:23 +0200)]
net: streamline __sys_setsockopt
Return early when sockfd_lookup_light fails to reduce a level of
indentation for most of the function body.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Christoph Hellwig [Fri, 17 Jul 2020 06:23:10 +0000 (08:23 +0200)]
net/atm: remove the atmdev_ops {get, set}sockopt methods
All implementations of these two methods are dummies that always
return -EINVAL.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Randy Dunlap [Sun, 19 Jul 2020 18:08:24 +0000 (11:08 -0700)]
net: rds: rdma_transport.h: delete duplicated word
Delete the doubled word "be" in a comment.
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Cc: netdev@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Randy Dunlap [Sun, 19 Jul 2020 18:08:01 +0000 (11:08 -0700)]
net: atm: lec_arpc.h: delete duplicated word
Delete the doubled word "the" in a comment.
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Oleksij Rempel [Sun, 19 Jul 2020 08:05:30 +0000 (10:05 +0200)]
net: phy: at803x: add mdix configuration support for AR9331 and AR8035
This patch add MDIX configuration ability for AR9331 and AR8035. Theoretically
it should work on other Atheros PHYs, but I was able to test only this
two.
Since I have no certified reference HW able to detect or configure MDIX, this
functionality was confirmed by oscilloscope.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller [Mon, 20 Jul 2020 01:05:49 +0000 (18:05 -0700)]
Merge branch 'net-enetc-remove-bootloader-dependency'
Michael Walle says:
====================
net: enetc: remove bootloader dependency
These patches were picked from the following series:
https://lore.kernel.org/netdev/
1567779344-30965-1-git-send-email-claudiu.manoil@nxp.com/
They have never been resent. I've picked them up, addressed Andrews
comments, fixed some more bugs and asked Claudiu if I can keep their SOB
tags; he agreed. I've tested this on our board which happens to have a
bootloader which doesn't do the enetc setup in all cases. Though, only
SGMII mode was tested.
changes since v6:
- dropped _LPA_ infix for USXGMII constants
changes since v5:
- fixed pcs->autoneg_complete and pcs->link assignment. Thanks Vladimir.
changes since v4:
- moved (and renamed) the USXGMII constants to include/uapi/linux/mdio.h.
Suggested by Russell King.
changes since v3:
- rebased to latest net-next where devm_mdiobus_free() was removed.
replace it by mdiobus_free(). The internal MDIO bus is optional, if
there is any error, we try to run with the bootloader default PCS
settings, thus in the error case, we need to free the mdiobus.
changes since v2:
- removed SOBs from "net: enetc: Initialize SerDes for SGMII and USXGMII
protocols" because almost everything has changed.
- get a phy_device for the internal PCS PHY so we can use the phy_
functions instead of raw mdiobus writes
- reuse macros already defined in fsl_mdio.h, move missing bits from
felix to fsl_mdio.h, because they share the same PCS PHY building
block
- added 2500BaseX mode (based on felix init routine)
- changed xgmii mode to usxgmii mode, because it is actually USXGMII and
felix does the same.
- fixed devad, which is 0x1f (MMD_VEND2)
changes since v1:
- mdiobus id is '"imdio-%s", dev_name(dev)' because the plain dev_name()
is used by the emdio.
- use mdiobus_write() instead of imdio->write(imdio, ..), since this is
already a full featured mdiobus
- set phy_mask to ~0 to avoid scanning the bus
- use phy_interface_mode_is_rgmii(phy_mode) to also include the RGMII
modes with pad delays.
- move enetc_imdio_init() to enetc_pf.c, there shouldn't be any other
users, should it?
- renamed serdes to SerDes
- printing the error code of mdiobus_register() in the error path
- call mdiobus_unregister() on _remove()
- call devm_mdiobus_free() if mdiobus_register() fails, since an
error is not fatal
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Alex Marginean [Sun, 19 Jul 2020 22:03:36 +0000 (00:03 +0200)]
net: enetc: Use DT protocol information to set up the ports
Use DT information rather than in-band information from bootloader to
set up MAC for XGMII. For RGMII use the DT indication in addition to
RGMII defaults in hardware.
However, this implies that PHY connection information needs to be
extracted before netdevice creation, when the ENETC Port MAC is
being configured.
Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Michael Walle <michael@walle.cc>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Michael Walle [Sun, 19 Jul 2020 22:03:35 +0000 (00:03 +0200)]
net: enetc: Initialize SerDes for SGMII and USXGMII protocols
ENETC has ethernet MACs capable of SGMII, 2500BaseX and USXGMII. But in
order to use these protocols some SerDes configurations need to be
performed. The SerDes is configurable via an internal PCS PHY which is
connected to an internal MDIO bus at address 0.
This patch basically removes the dependency on bootloader regarding
SerDes initialization.
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Michael Walle [Sun, 19 Jul 2020 22:03:34 +0000 (00:03 +0200)]
net: dsa: felix: (re)use already existing constants
Now that there are USXGMII constants available, drop the old definitions
and reuse the generic ones.
Signed-off-by: Michael Walle <michael@walle.cc>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Michael Walle [Sun, 19 Jul 2020 22:03:33 +0000 (00:03 +0200)]
net: phy: add USXGMII link partner ability constants
The constants are taken from the USXGMII Singleport Copper Interface
specification. The naming are based on the SGMII ones, but with an MDIO_
prefix.
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Armin Wolf [Fri, 17 Jul 2020 18:21:48 +0000 (20:21 +0200)]
ne2k-pci: Use netif_msg_init to initialize msg_enable bits
Use netif_msg_enable() to process param settings.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller [Sat, 18 Jul 2020 02:00:54 +0000 (19:00 -0700)]
Merge branch 'net-atlantic-add-support-for-FW-4-x'
Mark Starovoytov says:
====================
net: atlantic: add support for FW 4.x
This patch set adds support for FW 4.x, which is about to get into the
production for some products.
4.x is mostly compatible with 3.x, save for soft reset, which requires
the acquisition of 2 additional semaphores.
Other differences (e.g. absence of PTP support) are handled via
capabilities.
Note: 4.x targets specific products only. 3.x is still the main firmware
branch, which should be used by most users (at least for now).
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Dmitry Bogdanov [Fri, 17 Jul 2020 18:01:47 +0000 (21:01 +0300)]
net: atlantic: add support for FW 4.x
This patch adds support for FW 4.x, which is about to get into the
production for some products.
4.x is mostly compatible with 3.x, save for soft reset, which requires
the acquisition of 2 additional semaphores.
Other differences (e.g. absence of PTP support) are handled via
capabilities.
Note: 4.x targets specific products only. 3.x is still the main firmware
branch, which should be used by most users (at least for now).
Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Mark Starovoytov [Fri, 17 Jul 2020 18:01:46 +0000 (21:01 +0300)]
net: atlantic: align return value of ver_match function with function name
This patch aligns the return value of hw_atl_utils_ver_match function with
its name.
Change the return type to bool, because it's better aligned with the actual
usage. Return true when the version matches, false otherwise.
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Mark Einon [Fri, 17 Jul 2020 13:21:35 +0000 (14:21 +0100)]
net: ethernet: et131x: Remove redundant register read
Following the removal of an unused variable assignment (remove
unused variable 'pm_csr') the associated register read can also go,
as the read also occurs in the subsequent et1310_in_phy_coma()
call.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Zhang Changzhong [Fri, 17 Jul 2020 10:33:30 +0000 (18:33 +0800)]
net: ethernet: et131x: Remove unused variable 'pm_csr'
Gcc report warning as follows:
drivers/net/ethernet/agere/et131x.c:953:6: warning:
variable 'pm_csr' set but not used [-Wunused-but-set-variable]
953 | u32 pm_csr;
| ^~~~~~
drivers/net/ethernet/agere/et131x.c:1002:6:warning:
variable 'pm_csr' set but not used [-Wunused-but-set-variable]
1002 | u32 pm_csr;
| ^~~~~~
drivers/net/ethernet/agere/et131x.c:3446:8: warning:
variable 'pm_csr' set but not used [-Wunused-but-set-variable]
3446 | u32 pm_csr;
| ^~~~~~
After commit
38df6492eb51 ("et131x: Add PCIe gigabit ethernet driver
et131x to drivers/net"), 'pm_csr' is never used in these functions,
so removing it to avoid build warning.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Zhang Changzhong [Fri, 17 Jul 2020 10:23:04 +0000 (18:23 +0800)]
net: bna: Remove unused variable 't'
Gcc report warning as follows:
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1538:6: warning:
variable 't' set but not used [-Wunused-but-set-variable]
1538 | u32 t;
| ^
After commit
c107ba171f3d ("bna: Firmware Patch Simplification"),
't' is never used, so removing it to avoid build warning.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Jakub Kicinski [Fri, 17 Jul 2020 20:59:58 +0000 (13:59 -0700)]
net: bnxt: don't complain if TC flower can't be supported
The fact that NETIF_F_HW_TC is not set should be a sufficient
indication to the user that TC offloads are not supported.
No need to bother users of older firmware versions with
pointless warnings on every boot.
Also, since the support is optional, bnxt_init_tc() should not
return an error in case FW is old, similarly to how error
is not returned when CONFIG_BNXT_FLOWER_OFFLOAD is not set.
With that we can add an error message to the caller, to warn
about actual unexpected failures.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller [Fri, 17 Jul 2020 20:04:17 +0000 (13:04 -0700)]
Merge tag 'mlx5-updates-2020-07-16' of git://git./linux/kernel/git/saeed/linux
Saeed Mahameed says:
====================
mlx5-updates-2020-07-16
Fixes:
1) Fix build break when CONFIG_XPS is not set
2) Fix missing switch_id for representors
Updates:
1) IPsec XFRM RX offloads from Raed and Huy.
- Added IPSec RX steering flow tables to NIC RX
- Refactoring of the existing FPGA IPSec, to add support
for ConnectX IPsec.
- RX data path handling for IPSec traffic
- Synchronize offloading device ESN with xfrm received SN
2) Parav allows E-Switch to siwtch to switchdev mode directly without
the need to go through legacy mode first.
3) From Tariq, Misc updates including:
3.1) indirect calls for RX and XDP handlers
3.2) Make MLX5_EN_TLS non-prompt as it should always be enabled when
TLS and MLX5_EN are selected.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>