* Re: [PATCH v5 net-next] net/tcp: trace all TCP/IP state transition with tcp_set_state tracepoint
From: Yafang Shao @ 2017-12-08 3:40 UTC (permalink / raw)
To: Marcelo Ricardo Leitner
Cc: David Miller, Song Liu, Alexey Kuznetsov, yoshfuji,
Steven Rostedt, Brendan Gregg, netdev, LKML
In-Reply-To: <CALOAHbAixEmBFTuTD42GtC6sbqdguGVSEX8w6+GTw6rLRwRuUQ@mail.gmail.com>
2017-12-08 9:41 GMT+08:00 Yafang Shao <laoar.shao@gmail.com>:
> 2017-12-08 4:02 GMT+08:00 Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>:
>> On Thu, Dec 07, 2017 at 02:10:42PM +0000, Yafang Shao wrote:
>>> The TCP/IP transition from TCP_LISTEN to TCP_SYN_RECV and some other
>>> transitions are not traced with tcp_set_state tracepoint.
>>>
>>> In order to trace the whole tcp lifespans, two helpers are introduced,
>>> void sk_set_state(struct sock *sk, int state);
>>> void sk_state_store(struct sock *sk, int newstate);
>>>
>>> When do TCP/IP state transition, we should use these two helpers or use
>>> tcp_set_state() other than assigning a value to sk_state directly.
>>>
>>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
>>> Acked-by: Song Liu <songliubraving@fb.com>
>>> Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
>>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
>>> ---
>>> v4->v5: Trace only TCP sockets, whatever it is stream socket or raw socket.
>>> v3->v4: Do not trace DCCP socket
>>> v2->v3: Per suggestion from Marcelo Ricardo Leitner, inverting __
>>> to sk_state_store.
>>> ---
>>> include/net/sock.h | 8 ++++++--
>>> net/core/sock.c | 15 +++++++++++++++
>>> net/ipv4/inet_connection_sock.c | 5 +++--
>>> net/ipv4/inet_hashtables.c | 2 +-
>>> net/ipv4/tcp.c | 2 +-
>>> 5 files changed, 26 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/include/net/sock.h b/include/net/sock.h
>>> index 79e1a2c..1cf7685 100644
>>> --- a/include/net/sock.h
>>> +++ b/include/net/sock.h
>>> @@ -2349,18 +2349,22 @@ static inline int sk_state_load(const struct sock *sk)
>>> }
>>>
>>> /**
>>> - * sk_state_store - update sk->sk_state
>>> + * __sk_state_store - update sk->sk_state
>>> * @sk: socket pointer
>>> * @newstate: new state
>>> *
>>> * Paired with sk_state_load(). Should be used in contexts where
>>> * state change might impact lockless readers.
>>> */
>>> -static inline void sk_state_store(struct sock *sk, int newstate)
>>> +static inline void __sk_state_store(struct sock *sk, int newstate)
>>> {
>>> smp_store_release(&sk->sk_state, newstate);
>>> }
>>>
>>> +/* For tcp_set_state tracepoint */
>>> +void sk_state_store(struct sock *sk, int newstate);
>>> +void sk_set_state(struct sock *sk, int state);
>>> +
>>> void sock_enable_timestamp(struct sock *sk, int flag);
>>> int sock_get_timestamp(struct sock *, struct timeval __user *);
>>> int sock_get_timestampns(struct sock *, struct timespec __user *);
>>> diff --git a/net/core/sock.c b/net/core/sock.c
>>> index c0b5b2f..61841a2 100644
>>> --- a/net/core/sock.c
>>> +++ b/net/core/sock.c
>>> @@ -138,6 +138,7 @@
>>> #include <net/sock_reuseport.h>
>>>
>>> #include <trace/events/sock.h>
>>> +#include <trace/events/tcp.h>
>>>
>>> #include <net/tcp.h>
>>> #include <net/busy_poll.h>
>>> @@ -2859,6 +2860,20 @@ int sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp)
>>> }
>>> EXPORT_SYMBOL(sock_get_timestampns);
>>>
>>> +void sk_state_store(struct sock *sk, int newstate)
>>> +{
>>> + if (sk->sk_protocol == IPPROTO_TCP)
>>> + trace_tcp_set_state(sk, sk->sk_state, newstate);
>>
>> I think this is going in the wrong way. When Dave said to not define a
>> sock generic function in tcp code on v3, you moved it all from tcp.h
>> to sock.h. But now sock.h gets to deal with more tcp code, which also
>> isn't nice.
>>
>> Instead, if you move it back to tcp.h but rename the function to
>> tcp_state_store (instead of the original sk_state_store), it won't be
>> a generic sock code and will fit nicely into tcp.h.
>>
>> You may then even keep sk_state_store() as it is now, and just define
>> tcp_state_store():
>>
>> tcp_state_store()
>> {
>> trace_tcp_...();
>> sk_state_store();
>> }
>>
>> Making it very clear that this code is only to be used by tcp stack.
>>
>
> Then we have to do bellow 'if' test in inet_connection_sock.c and
> /inet_hashtables.
>
> if (sk->sk_protocol == IPPROTO_TCP)
> tcp_state_store(sk, TCP_CLOSE)
> else
> sk->sk_state = TCP_CLOSE;
>
> And same code about other changes.
>
> Is that proper ?
>
>
It will looks like these,
if (sk->sk_protocol == IPPROTO_TCP)
__tcp_set_state(newsk, TCP_SYN_RECV);
else
newsk->sk_state = TCP_SYN_RECV;
if (sk->sk_protocol == IPPROTO_TCP)
__tcp_set_state(sk, TCP_CLOSE);
else
sk->sk_state = TCP_CLOSE;
if (sk->sk_protocol == IPPROTO_TCP)
tcp_state_store(sk, state);
else
sk_state_store(sk, state);
Some redundant code.
IMO, put these similar code into a wrapper is more nice.
Thanks
Yafang
^ permalink raw reply
* Re: [PATCH net-next 09/12] sctp: implement renege_events for sctp_stream_interleave
From: kbuild test robot @ 2017-12-08 3:45 UTC (permalink / raw)
To: Xin Long
Cc: kbuild-all, network dev, linux-sctp, Marcelo Ricardo Leitner,
Neil Horman, davem
In-Reply-To: <167166ed3ee953dbcee3aef43496d8c7b44c6b95.1512486606.git.lucien.xin@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5949 bytes --]
Hi Xin,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Xin-Long/sctp-Implement-Stream-Interleave-The-I-DATA-Chunk-Supporting-User-Message-Interleaving/20171208-031625
config: x86_64-randconfig-g0-12080821 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
Cyclomatic Complexity 1 include/linux/spinlock.h:spinlock_check
Cyclomatic Complexity 1 include/linux/skbuff.h:skb_queue_empty
Cyclomatic Complexity 2 include/linux/skbuff.h:skb_peek_tail
Cyclomatic Complexity 1 include/linux/skbuff.h:__skb_queue_head_init
Cyclomatic Complexity 1 include/linux/skbuff.h:__skb_insert
Cyclomatic Complexity 1 include/linux/skbuff.h:__skb_queue_splice
Cyclomatic Complexity 2 include/linux/skbuff.h:skb_queue_splice_tail_init
Cyclomatic Complexity 1 include/linux/skbuff.h:__skb_queue_before
Cyclomatic Complexity 1 include/linux/skbuff.h:__skb_queue_tail
Cyclomatic Complexity 1 include/linux/skbuff.h:__skb_unlink
Cyclomatic Complexity 1 include/net/net_namespace.h:read_pnet
Cyclomatic Complexity 1 include/net/sock.h:sk_has_account
Cyclomatic Complexity 1 include/net/sock.h:sock_net
Cyclomatic Complexity 1 include/net/busy_poll.h:sk_mark_napi_id
Cyclomatic Complexity 1 include/net/sctp/ulpevent.h:sctp_skb2event
Cyclomatic Complexity 2 include/net/sctp/ulpevent.h:sctp_ulpevent_type_enabled
Cyclomatic Complexity 1 include/net/sctp/structs.h:sctp_sk
Cyclomatic Complexity 1 include/net/sctp/structs.h:sctp_chunk_stream_no
Cyclomatic Complexity 6 net//sctp/stream_interleave.c:sctp_validate_data
Cyclomatic Complexity 15 net//sctp/stream_interleave.c:sctp_intl_retrieve_first
Cyclomatic Complexity 16 net//sctp/stream_interleave.c:sctp_intl_retrieve_partial
Cyclomatic Complexity 25 net//sctp/stream_interleave.c:sctp_intl_retrieve_reassembled
Cyclomatic Complexity 3 include/net/sock.h:sk_mem_reclaim
Cyclomatic Complexity 2 include/net/sctp/ulpevent.h:sctp_event2skb
Cyclomatic Complexity 23 net//sctp/stream_interleave.c:sctp_intl_store_reasm
Cyclomatic Complexity 6 net//sctp/stream_interleave.c:sctp_intl_reasm
Cyclomatic Complexity 13 net//sctp/stream_interleave.c:sctp_intl_store_ordered
Cyclomatic Complexity 5 net//sctp/stream_interleave.c:sctp_intl_retrieve_ordered
Cyclomatic Complexity 3 net//sctp/stream_interleave.c:sctp_intl_order
Cyclomatic Complexity 2 include/net/sock.h:sk_incoming_cpu_update
Cyclomatic Complexity 2 include/net/sctp/ulpevent.h:sctp_ulpevent_is_enabled
Cyclomatic Complexity 9 net//sctp/stream_interleave.c:sctp_enqueue_event
Cyclomatic Complexity 4 net//sctp/stream_interleave.c:sctp_intl_start_pd
Cyclomatic Complexity 6 net//sctp/stream_interleave.c:sctp_validate_idata
Cyclomatic Complexity 8 net//sctp/stream_interleave.c:sctp_chunk_assign_mid
Cyclomatic Complexity 1 include/linux/skbuff.h:skb_queue_head_init
Cyclomatic Complexity 6 net//sctp/stream_interleave.c:sctp_ulpevent_idata
Cyclomatic Complexity 7 net//sctp/stream_interleave.c:sctp_renege_events
Cyclomatic Complexity 3 net//sctp/stream_interleave.c:sctp_make_idatafrag_empty
Cyclomatic Complexity 3 net//sctp/stream_interleave.c:sctp_stream_interleave_init
net//sctp/stream_interleave.c: In function 'sctp_renege_events':
>> net//sctp/stream_interleave.c:581:26: warning: 'sin' may be used uninitialized in this function [-Wmaybe-uninitialized]
cevent->mid == sin->mid &&
^
net//sctp/stream_interleave.c:550:32: note: 'sin' was declared here
struct sctp_stream_in *csin, *sin;
^
vim +/sin +581 net//sctp/stream_interleave.c
547
548 static struct sctp_ulpevent *sctp_intl_retrieve_first(struct sctp_ulpq *ulpq)
549 {
550 struct sctp_stream_in *csin, *sin;
551 struct sk_buff *first_frag = NULL;
552 struct sk_buff *last_frag = NULL;
553 struct sctp_ulpevent *retval;
554 struct sk_buff *pos;
555 __u32 next_fsn = 0;
556 __u16 sid = 0;
557
558 skb_queue_walk(&ulpq->reasm, pos) {
559 struct sctp_ulpevent *cevent = sctp_skb2event(pos);
560
561 csin = sctp_stream_in(ulpq->asoc, cevent->stream);
562 if (csin->pd_mode)
563 continue;
564
565 switch (cevent->msg_flags & SCTP_DATA_FRAG_MASK) {
566 case SCTP_DATA_FIRST_FRAG:
567 if (first_frag)
568 goto out;
569 if (cevent->mid == csin->mid) {
570 first_frag = pos;
571 last_frag = pos;
572 next_fsn = 0;
573 sin = csin;
574 sid = cevent->stream;
575 }
576 break;
577 case SCTP_DATA_MIDDLE_FRAG:
578 if (!first_frag)
579 break;
580 if (cevent->stream == sid &&
> 581 cevent->mid == sin->mid &&
582 cevent->fsn == next_fsn) {
583 next_fsn++;
584 last_frag = pos;
585 } else {
586 goto out;
587 }
588 break;
589 case SCTP_DATA_LAST_FRAG:
590 if (first_frag)
591 goto out;
592 break;
593 default:
594 break;
595 }
596 }
597
598 if (!first_frag)
599 return NULL;
600
601 out:
602 retval = sctp_make_reassembled_event(sock_net(ulpq->asoc->base.sk),
603 &ulpq->reasm, first_frag,
604 last_frag);
605 if (retval) {
606 sin->fsn = next_fsn;
607 sin->pd_mode = 1;
608 }
609
610 return retval;
611 }
612
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35797 bytes --]
^ permalink raw reply
* Re: [PATCH net-next] tuntap: fix possible deadlock when fail to register netdev
From: Jason Wang @ 2017-12-08 3:27 UTC (permalink / raw)
To: Eric Dumazet, netdev, linux-kernel; +Cc: mst, Willem de Bruijn
In-Reply-To: <1512702678.25033.20.camel@gmail.com>
On 2017年12月08日 11:11, Eric Dumazet wrote:
> On Fri, 2017-12-08 at 10:54 +0800, Jason Wang wrote:
>> Private destructor could be called when register_netdev() fail with
>> rtnl lock held. This will lead deadlock in tun_free_netdev() who
>> tries
>> to hold rtnl_lock. Fixing this by switching to use spinlock to
>> synchronize.
>>
>> Fixes: 96f84061620c ("tun: add eBPF based queue selection method")
>> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
>> Cc: Eric Dumazet <eric.dumazet@gmail.com>
>> Cc: Willem de Bruijn <willemb@google.com>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> drivers/net/tun.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
>> index 787cc35..f7ccd79 100644
>> --- a/drivers/net/tun.c
>> +++ b/drivers/net/tun.c
>> @@ -2050,8 +2050,11 @@ static int __tun_set_steering_ebpf(struct
>> tun_struct *tun,
>> new->prog = prog;
>> }
>>
>> - old = rtnl_dereference(tun->steering_prog);
>> + spin_lock(&tun->lock);
>> + old = rcu_dereference_protected(tun->steering_prog,
>> + lock_is_held(&tun->lock));
>> rcu_assign_pointer(tun->steering_prog, new);
>> + spin_unlock(&tun->lock);
>>
> Hi Jason, thank you for the following up.
>
> Have you tested this code path with lockdep enabled ?
No I test without it.
>
> My gut feeling is that you need spin_lock_bh() here.
>
> Thanks
>
Yes, I miss the fact this the lock is used by e.g flow caches too. Will
post V2.
Thanks
^ permalink raw reply
* Re: [PATCH net-next] tuntap: fix possible deadlock when fail to register netdev
From: Eric Dumazet @ 2017-12-08 3:11 UTC (permalink / raw)
To: Jason Wang, netdev, linux-kernel; +Cc: mst, Willem de Bruijn
In-Reply-To: <1512701655-18751-1-git-send-email-jasowang@redhat.com>
On Fri, 2017-12-08 at 10:54 +0800, Jason Wang wrote:
> Private destructor could be called when register_netdev() fail with
> rtnl lock held. This will lead deadlock in tun_free_netdev() who
> tries
> to hold rtnl_lock. Fixing this by switching to use spinlock to
> synchronize.
>
> Fixes: 96f84061620c ("tun: add eBPF based queue selection method")
> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Willem de Bruijn <willemb@google.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/net/tun.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 787cc35..f7ccd79 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -2050,8 +2050,11 @@ static int __tun_set_steering_ebpf(struct
> tun_struct *tun,
> new->prog = prog;
> }
>
> - old = rtnl_dereference(tun->steering_prog);
> + spin_lock(&tun->lock);
> + old = rcu_dereference_protected(tun->steering_prog,
> + lock_is_held(&tun->lock));
> rcu_assign_pointer(tun->steering_prog, new);
> + spin_unlock(&tun->lock);
>
Hi Jason, thank you for the following up.
Have you tested this code path with lockdep enabled ?
My gut feeling is that you need spin_lock_bh() here.
Thanks
^ permalink raw reply
* [PATCH v2 3/3] Bluetooth: hci_ll: Add optional nvmem BD address source
From: David Lechner @ 2017-12-08 2:57 UTC (permalink / raw)
To: devicetree, linux-bluetooth
Cc: David Lechner, Rob Herring, Mark Rutland, Marcel Holtmann,
Gustavo Padovan, Johan Hedberg, netdev, linux-kernel
In-Reply-To: <1512701860-8321-1-git-send-email-david@lechnology.com>
This adds an optional nvmem consumer to get a BD address from an external
source. The BD address is then set in the Bluetooth chip after the
firmware has been loaded.
This has been tested working with a TI CC2560A chip (in a LEGO MINDSTORMS
EV3).
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes:
* Add support for HCI_QUIRK_INVALID_BDADDR when there is an error getting the
BD address from nvmem
* Rework error handling
* rename "mac-address" to "bd-address"
* use bdaddr_t, bacmp and other bluetooth helper functions
* use ll_set_bdaddr() from new, separate patch
drivers/bluetooth/hci_ll.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index b732004..f5fef2d 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -53,6 +53,7 @@
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
#include <linux/gpio/consumer.h>
+#include <linux/nvmem-consumer.h>
#include "hci_uart.h"
@@ -90,6 +91,7 @@ struct ll_device {
struct serdev_device *serdev;
struct gpio_desc *enable_gpio;
struct clk *ext_clk;
+ bdaddr_t bdaddr;
};
struct ll_struct {
@@ -715,6 +717,19 @@ static int ll_setup(struct hci_uart *hu)
if (err)
return err;
+ /* Set BD address if one was specified at probe */
+ if (!bacmp(&lldev->bdaddr, BDADDR_NONE)) {
+ /*
+ * This means that there was an error getting the BD address
+ * during probe, so mark the device as having a bad address.
+ */
+ set_bit(HCI_QUIRK_INVALID_BDADDR, &hu->hdev->quirks);
+ } else if (bacmp(&lldev->bdaddr, BDADDR_ANY)) {
+ err = ll_set_bdaddr(hu->hdev, &lldev->bdaddr);
+ if (err)
+ set_bit(HCI_QUIRK_INVALID_BDADDR, &hu->hdev->quirks);
+ }
+
/* Operational speed if any */
if (hu->oper_speed)
speed = hu->oper_speed;
@@ -743,6 +758,7 @@ static int hci_ti_probe(struct serdev_device *serdev)
{
struct hci_uart *hu;
struct ll_device *lldev;
+ struct nvmem_cell *bdaddr_cell;
u32 max_speed = 3000000;
lldev = devm_kzalloc(&serdev->dev, sizeof(struct ll_device), GFP_KERNEL);
@@ -764,6 +780,45 @@ static int hci_ti_probe(struct serdev_device *serdev)
of_property_read_u32(serdev->dev.of_node, "max-speed", &max_speed);
hci_uart_set_speeds(hu, 115200, max_speed);
+ /* optional BD address from nvram */
+ bdaddr_cell = nvmem_cell_get(&serdev->dev, "bd-address");
+ if (IS_ERR(bdaddr_cell)) {
+ int err = PTR_ERR(bdaddr_cell);
+
+ if (err == -EPROBE_DEFER)
+ return err;
+
+ /*
+ * ENOENT means there is no matching nvmem cell and ENOSYS
+ * means that nvmem is not enabled in the kernel configuration.
+ */
+ if (err != -ENOENT && err != -ENOSYS) {
+ /*
+ * If there was some other error, give userspace a
+ * chance to fix the problem instead of failing to load
+ * the driver. Using BDADDR_NONE as a flag that is
+ * tested later in the setup function.
+ */
+ dev_warn(&serdev->dev,
+ "Failed to get \"bd-address\" nvmem cell (%d)\n",
+ err);
+ bacpy(&lldev->bdaddr, BDADDR_NONE);
+ }
+ } else {
+ bdaddr_t *bdaddr;
+ int len;
+
+ bdaddr = nvmem_cell_read(bdaddr_cell, &len);
+ if (len != sizeof(bdaddr_t)) {
+ dev_err(&serdev->dev, "Invalid nvmem bd-address length\n");
+ nvmem_cell_put(bdaddr_cell);
+ return -EINVAL;
+ }
+
+ baswap(&lldev->bdaddr, bdaddr);
+ nvmem_cell_put(bdaddr_cell);
+ }
+
return hci_uart_register_device(hu, &llp);
}
--
2.7.4
^ permalink raw reply related
* [PATCH v2 2/3] dt-bindings: Add optional nvmem BD address bindings to ti,wlink-st
From: David Lechner @ 2017-12-08 2:57 UTC (permalink / raw)
To: devicetree, linux-bluetooth
Cc: David Lechner, Rob Herring, Mark Rutland, Marcel Holtmann,
Gustavo Padovan, Johan Hedberg, netdev, linux-kernel
In-Reply-To: <1512701860-8321-1-git-send-email-david@lechnology.com>
This adds optional nvmem consumer properties to the ti,wlink-st device tree
bindings to allow specifying the BD address.
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes:
* Renamed "mac-address" to "bd-address"
* Fixed typos in example
* Specify byte order of "bd-address"
Documentation/devicetree/bindings/net/ti,wilink-st.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/ti,wilink-st.txt b/Documentation/devicetree/bindings/net/ti,wilink-st.txt
index 1649c1f..a45a508 100644
--- a/Documentation/devicetree/bindings/net/ti,wilink-st.txt
+++ b/Documentation/devicetree/bindings/net/ti,wilink-st.txt
@@ -32,6 +32,9 @@ Optional properties:
See ../clocks/clock-bindings.txt for details.
- clock-names : Must include the following entry:
"ext_clock" (External clock provided to the TI combo chip).
+ - nvmem-cells: phandle to nvmem data cell that contains a 6 byte BD address
+ with the most significant byte first (big-endian).
+ - nvmem-cell-names: "bd-address" (required when nvmem-cells is specified)
Example:
@@ -43,5 +46,7 @@ Example:
enable-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
clocks = <&clk32k_wl18xx>;
clock-names = "ext_clock";
+ nvmem-cells = <&bd_address>;
+ nvmem-cell-names = "bd-address";
};
};
--
2.7.4
^ permalink raw reply related
* [PATCH v2 1/3] Bluetooth: hci_ll: add support for setting public address
From: David Lechner @ 2017-12-08 2:57 UTC (permalink / raw)
To: devicetree, linux-bluetooth
Cc: David Lechner, Rob Herring, Mark Rutland, Marcel Holtmann,
Gustavo Padovan, Johan Hedberg, netdev, linux-kernel
In-Reply-To: <1512701860-8321-1-git-send-email-david@lechnology.com>
This adds support for setting the public address on Texas Instruments
Bluetooth chips using a vendor-specific command.
This has been tested on a CC2560A. The TI wiki also indicates that this
command should work on TI WL17xx/WL18xx Bluetooth chips.
Signed-off-by: David Lechner <david@lechnology.com>
---
v2 changes:
* This is a new patch in v2
drivers/bluetooth/hci_ll.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index 974a788..b732004 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -57,6 +57,7 @@
#include "hci_uart.h"
/* Vendor-specific HCI commands */
+#define HCI_VS_WRITE_BD_ADDR 0xfc06
#define HCI_VS_UPDATE_UART_HCI_BAUDRATE 0xff36
/* HCILL commands */
@@ -662,6 +663,20 @@ static int download_firmware(struct ll_device *lldev)
return err;
}
+static int ll_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
+{
+ bdaddr_t bdaddr_swapped;
+ struct sk_buff *skb;
+
+ baswap(&bdaddr_swapped, bdaddr);
+ skb = __hci_cmd_sync(hdev, HCI_VS_WRITE_BD_ADDR, sizeof(bdaddr_t),
+ &bdaddr_swapped, HCI_INIT_TIMEOUT);
+ if (!IS_ERR(skb))
+ kfree_skb(skb);
+
+ return PTR_ERR_OR_ZERO(skb);
+}
+
static int ll_setup(struct hci_uart *hu)
{
int err, retry = 3;
@@ -674,6 +689,8 @@ static int ll_setup(struct hci_uart *hu)
lldev = serdev_device_get_drvdata(serdev);
+ hu->hdev->set_bdaddr = ll_set_bdaddr;
+
serdev_device_set_flow_control(serdev, true);
do {
--
2.7.4
^ permalink raw reply related
* [PATCH v2 0/3] Bluetooth: hci_ll: Get BD address from NVMEM (was "bluetooth: hci_ll: Get MAC address from NVMEM")
From: David Lechner @ 2017-12-08 2:57 UTC (permalink / raw)
To: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-bluetooth-u79uwXL29TY76Z2rM5mHXA
Cc: David Lechner, Rob Herring, Mark Rutland, Marcel Holtmann,
Gustavo Padovan, Johan Hedberg, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
This series adds supporting getting the BD address from a NVMEM provider
for "LL" HCI controllers (Texas Instruments).
v2 changes:
* Fixed typos in dt-bindings
* Use "bd-address" instead of "mac-address"
* Updated dt-bindings to specify the byte order of "bd-address"
* New patch "Bluetooth: hci_ll: add support for setting public address"
* Dropped patch "Bluetooth: hci_ll: add constant for vendor-specific command"
that is already in bluetooth-next
* Rework error handling
* Use bdaddr_t, bacmp and other bluetooth utils
David Lechner (3):
Bluetooth: hci_ll: add support for setting public address
dt-bindings: Add optional nvmem BD address bindings to ti,wlink-st
Bluetooth: hci_ll: Add optional nvmem BD address source
.../devicetree/bindings/net/ti,wilink-st.txt | 5 ++
drivers/bluetooth/hci_ll.c | 71 ++++++++++++++++++++++
2 files changed, 76 insertions(+)
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH net-next] tuntap: fix possible deadlock when fail to register netdev
From: Jason Wang @ 2017-12-08 2:54 UTC (permalink / raw)
To: netdev, linux-kernel; +Cc: mst, Jason Wang, Eric Dumazet, Willem de Bruijn
Private destructor could be called when register_netdev() fail with
rtnl lock held. This will lead deadlock in tun_free_netdev() who tries
to hold rtnl_lock. Fixing this by switching to use spinlock to
synchronize.
Fixes: 96f84061620c ("tun: add eBPF based queue selection method")
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/tun.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 787cc35..f7ccd79 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2050,8 +2050,11 @@ static int __tun_set_steering_ebpf(struct tun_struct *tun,
new->prog = prog;
}
- old = rtnl_dereference(tun->steering_prog);
+ spin_lock(&tun->lock);
+ old = rcu_dereference_protected(tun->steering_prog,
+ lock_is_held(&tun->lock));
rcu_assign_pointer(tun->steering_prog, new);
+ spin_unlock(&tun->lock);
if (old)
call_rcu(&old->rcu, tun_steering_prog_free);
@@ -2067,9 +2070,7 @@ static void tun_free_netdev(struct net_device *dev)
free_percpu(tun->pcpu_stats);
tun_flow_uninit(tun);
security_tun_dev_free_security(tun->security);
- rtnl_lock();
__tun_set_steering_ebpf(tun, NULL);
- rtnl_unlock();
}
static void tun_setup(struct net_device *dev)
--
2.7.4
^ permalink raw reply related
* Re: [PATCH net-next] netdevsim: remove check on return value of debugfs_create_dir
From: Jakub Kicinski @ 2017-12-08 2:47 UTC (permalink / raw)
To: Prashant Bhole; +Cc: David S . Miller, netdev
In-Reply-To: <20171208021456.3392-1-bhole_prashant_q7@lab.ntt.co.jp>
On Fri, 8 Dec 2017 11:14:56 +0900, Prashant Bhole wrote:
> Initial discussion started about correct handling of this condition.
> Later it was decided to remove this check altogether to make it
> consistent.
>
> Removal of this check isn't fatal to this driver.
>
> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
but as I mentioned there is another, similar check in netdevsim/bpf.c:
"... drop this error handling here and in nsim_bpf_create_prog()."
> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index eb8c679fca9f..6d4b35f26ae5 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c
> @@ -469,8 +469,6 @@ static int __init nsim_module_init(void)
> int err;
>
> nsim_ddir = debugfs_create_dir(DRV_NAME, NULL);
> - if (IS_ERR(nsim_ddir))
> - return PTR_ERR(nsim_ddir);
>
> err = bus_register(&nsim_bus);
> if (err)
^ permalink raw reply
* Re: [PATCH net-next v2 1/5] net: Introduce NETIF_F_GRO_HW.
From: Alexander Duyck @ 2017-12-08 2:36 UTC (permalink / raw)
To: Michael Chan
Cc: David Miller, Netdev, Andrew Gospodarek, Ariel Elior,
everest-linux-l2
In-Reply-To: <CACKFLimna4yO28h8JAVSeqdSOtnQJKdVdKHbZiMxsngj65=gLg@mail.gmail.com>
On Thu, Dec 7, 2017 at 4:05 PM, Michael Chan <michael.chan@broadcom.com> wrote:
> On Thu, Dec 7, 2017 at 3:35 PM, Alexander Duyck
> <alexander.duyck@gmail.com> wrote:
>> On Thu, Dec 7, 2017 at 3:17 PM, Michael Chan <michael.chan@broadcom.com> wrote:
>>> I don't get this. I don't see how TSO is related.
>>
>> It isn't. That is the point. If I change ANY feature it will trigger
>> fix_features to get called. It will then see we have GRO_HW and LRO
>> since we have one interface that supports one and one that supports
>> another. It will trigger this code and cause LRO to be disabled which
>> then will be propagated down.
>
> I see. But this won't happen. Because the bonding driver is not
> advertising NETIF_F_GRO_HW in its hw_features. It is not advertising
> NETIF_F_GRO either but I think it gets added automatically since it is
> a software feature. So LRO won't get disabled on the bond when a
> unrelated feature is changed.
>
> But I think I see your point. I can make it so that it is up to
> individual driver's .ndo_fix_features() to drop LRO/GRO_HW as it sees
> fit, instead of doing it in the common netdev_fix_features(). That
> way, it is more flexible at least.
Thank you.
>>
>>>> That
>>>> is a bad behavior and shouldn't happen. In addition I would want to be
>>>> able to disable GRO_HW from the bond should I encounter a buggy
>>>> implementation of the GRO hardware offload at some point in the
>>>> future. I don't like it being tied so closely with GRO since all it
>>>> takes is one hardware failure and then we are dealing with people
>>>> disabling GRO due to reports of it being buggy instead of it being
>>>> tied specifically to GRO_HW.
>>>>
>>>
>>> Today, GRO, RXCSUM, NTUPLE, etc on a bond do not get propagated. You
>>> can propose and make them propagate if you want.
>>
>> Or you can fix your patches so you take it into account now instead of
>> putting things in a broken state and asking others to fix it.
>
> I don't think that things are necessarily broken today. LRO truly
> needs to be propagated. It's debatable whether other features like
> GRO/RXCSUM/NTUPLE should be centrally set by the upper device or not.
So I can agree with the NTUPLE not being propagated since it doesn't
actually effect upper devices. Really the functionality only really
has effects locally since the functionality consists of route to a
specific queue/device or drop the packet.
I'm not sure why RXCSUM isn't being propagated. It seems like that is
something that would make sense to have passed all the way down to the
lower devices since a single device that is doing bad Rx checksum
offloads could potentially corrupt all traffic in a bond. Seems like
that one should definitely be included.
>>
>>> So GRO_HW just naturally follows GRO since it is a true subset of it.
>>
>> Right, and I am saying you have exposed a bug. If I don't want GRO on
>> the bond it should be propagated down. It doesn't make sense to allow
>> lower devices to assemble frames when the bond doesn't want them and
>> GSO won't kick in before it gets to the bond.
>
> GRO kicks in at the lower device before it gets to the bond if the
> lower device calls napi_gro_receive() and GRO is enabled.
I get that. I assume the reason why the bond doesn't have it enabled
is because we don't want it to kick in at every given netdev, there
isn't any point to do GRO more than once. The problem is GRO_HW isn't
a pure software offload like GRO is. Call me a pessimist, but when we
end up encountering a buggy implementation that has to be disabled we
will want the right infrastructure in place to handle it. It becomes
another argument for why we might want to split GRO_HW and GRO without
tying them together. It would make sense to expose GRO_HW in a bond,
but not GRO. It might be something where we want to do any close tying
together of the GRO flag and GRO_HW at the driver as well. Basically
the legacy devices that transition over to GRO_HW from using just the
GRO flag could do that to maintain existing functionality, and new
drivers that implement it could opt in to the same behavior or just
handle GRO_HW as a separate flag.
Actually I just had a thought. What if we consider this a separate GRO
stage instead of just a hardware offload? Our standard GRO is a post
receive from the driver perspective, basically the packet is assembled
after we have handed it to the stack. What you are doing with GRO_HW
is essentially providing an early reassembly before it is handed to
the stack. What if we were to rename GRO_HW to something like
GRO_LOWER, GRO_EARLY, GRO_PRE, or pick your name (I'm lousy at
naming), and used it as a way to indicate that we want to perform GRO
before we begin receive processing on the frame in our driver? Then
for stacked devices you could use this new flag to indicate you don't
want to perform GRO on the lower levels below this device, and could
then use the regular GRO flag to control if we do it ourselves. Doing
that should provide stacked devices with a good way to control GRO on
the lower devices and would resolve what you need to indicate as well.
The only real changes needed might be a rename and to add the
necessary bit shifting for the upper and lower dev sync code. If you
aren't interested in the idea I can probably spend a couple of hours
getting to it tomorrow since I think this might be a much better way
to go as it solves multiple issues.
^ permalink raw reply
* Re: [PATCH net-next V3] tun: add eBPF based queue selection method
From: Jason Wang @ 2017-12-08 2:25 UTC (permalink / raw)
To: Eric Dumazet, netdev, linux-kernel
Cc: mst, willemdebruijn.kernel, tom, aconole, wexu
In-Reply-To: <1512684709.25033.18.camel@gmail.com>
On 2017年12月08日 06:11, Eric Dumazet wrote:
> On Mon, 2017-12-04 at 17:31 +0800, Jason Wang wrote:
>> This patch introduces an eBPF based queue selection method. With
>> this,
>> the policy could be offloaded to userspace completely through a new
>> ioctl TUNSETSTEERINGEBPF.
> Sorry for the delay, I see this patch was merged already.
>
> ...
>
>> static void tun_free_netdev(struct net_device *dev)
>> {
>> struct tun_struct *tun = netdev_priv(dev);
>> @@ -1996,6 +2068,9 @@ static void tun_free_netdev(struct net_device
>> *dev)
>> free_percpu(tun->pcpu_stats);
>> tun_flow_uninit(tun);
>> security_tun_dev_free_security(tun->security);
>> + rtnl_lock();
>> + __tun_set_steering_ebpf(tun, NULL);
>> + rtnl_unlock();
>> }
> I am pretty sure tun_free_netdev() (aka ->priv_destructor()) can be
> called under RTNL (say from register_netdevice())
>
> So this will dead lock badly ?
>
>
Unfortunately yes. Will switch to use spinlock (tun->lock) to
synchronize here.
Thanks
^ permalink raw reply
* Re: WireGuard Upstreaming Roadmap (November 2017)
From: Jason A. Donenfeld @ 2017-12-08 2:17 UTC (permalink / raw)
To: Stefan Tatschner; +Cc: Netdev, LKML
In-Reply-To: <CAB=oiXZYChYMzqK4cufNy+Gr-QHK7jE=h8-9+zQMx67_xsLVoQ@mail.gmail.com>
On Thu, Dec 7, 2017 at 11:22 AM, Stefan Tatschner
<rumpelsepp@sevenbyte.org> wrote:
> I have a question which is related to the involved crypto. As far as I
> have understood the protocol and the concept of wireguard
> What's your opinion on this?
This thread has been picked up on the WireGuard mailing list, not here.
Since this concerns the interworkings of the protocol and cryptography
as a whole, as opposed to implementation details of Linux, please do
not send these inquiries to LKML. Additionally, please start new
threads for new topics in the future, rather than hijacking a roadmap
thread.
Look for my answer on the other mailing list. I'll CC you too.
Regards,
Jason
^ permalink raw reply
* [PATCH net-next] netdevsim: remove check on return value of debugfs_create_dir
From: Prashant Bhole @ 2017-12-08 2:14 UTC (permalink / raw)
To: David S . Miller; +Cc: Prashant Bhole, netdev, Jakub Kicinski
Initial discussion started about correct handling of this condition.
Later it was decided to remove this check altogether to make it
consistent.
Removal of this check isn't fatal to this driver.
Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
---
drivers/net/netdevsim/netdev.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index eb8c679fca9f..6d4b35f26ae5 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -469,8 +469,6 @@ static int __init nsim_module_init(void)
int err;
nsim_ddir = debugfs_create_dir(DRV_NAME, NULL);
- if (IS_ERR(nsim_ddir))
- return PTR_ERR(nsim_ddir);
err = bus_register(&nsim_bus);
if (err)
--
2.13.6
^ permalink raw reply related
* RE: [PATCH net-next] netdevsim: correctly check return value of debugfs_create_dir
From: Prashant Bhole @ 2017-12-08 2:12 UTC (permalink / raw)
To: 'Jakub Kicinski'; +Cc: 'David S . Miller', netdev
In-Reply-To: <20171207171206.183f69a9@cakuba.netronome.com>
> From: Jakub Kicinski [mailto:jakub.kicinski@netronome.com]
>
> On Fri, 8 Dec 2017 09:52:50 +0900, Prashant Bhole wrote:
> > Return value is now checked with IS_ERROR_OR_NULL because
> > debugfs_create_dir doesn't return error value. It either returns NULL
> > or a valid pointer.
> >
> > Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
> > ---
> > drivers/net/netdevsim/netdev.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/netdevsim/netdev.c
> > b/drivers/net/netdevsim/netdev.c index eb8c679fca9f..88d8ee2c89da
> > 100644
> > --- a/drivers/net/netdevsim/netdev.c
> > +++ b/drivers/net/netdevsim/netdev.c
> > @@ -469,7 +469,7 @@ static int __init nsim_module_init(void)
> > int err;
> >
> > nsim_ddir = debugfs_create_dir(DRV_NAME, NULL);
> > - if (IS_ERR(nsim_ddir))
> > + if (IS_ERR_OR_NULL(nsim_ddir))
> > return PTR_ERR(nsim_ddir);
>
> PTR_ERR() will not be good in case of NULL, no? But it's anyone's guess
what
> the correct error code would then be... the EEXIST from
> start_creating() I was after is dropped in debugfs_create_dir(), as you
previously
> pointed out.
>
> Maybe just drop this error handling here and in nsim_bpf_create_prog().
> Let's consistently ignore all DebugFS errors. Sorry about going back and
forth on
> this a little bit.
Ok. I am sending a patch to remove this error handling. Thank you.
-Prashant
^ permalink raw reply
* Re: [PATCH net-next 1/1] forcedeth: remove unnecessary variable
From: Yanjun Zhu @ 2017-12-08 2:11 UTC (permalink / raw)
To: David Miller; +Cc: netdev, keescook
In-Reply-To: <20171207.140719.544312559507472280.davem@davemloft.net>
On 2017/12/8 3:07, David Miller wrote:
> From: Zhu Yanjun <yanjun.zhu@oracle.com>
> Date: Wed, 6 Dec 2017 23:15:15 -0500
>
>> Since both tx_ring and first_tx are the head of tx ring, it not
>> necessary to use two variables. So first_tx is removed.
> These are not variables, they are structure members.
Sure. These 2 structure members are the head of tx ring. And they are
not changed in
the whole driver. So they are duplicate.
I will change to structure members and send V2.
Zhu Yanjun
>
^ permalink raw reply
* Re: [PATCH v5 net-next] net/tcp: trace all TCP/IP state transition with tcp_set_state tracepoint
From: Yafang Shao @ 2017-12-08 1:41 UTC (permalink / raw)
To: Marcelo Ricardo Leitner
Cc: David Miller, Song Liu, Alexey Kuznetsov, yoshfuji,
Steven Rostedt, Brendan Gregg, netdev, LKML
In-Reply-To: <20171207200245.GQ13341@localhost.localdomain>
2017-12-08 4:02 GMT+08:00 Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>:
> On Thu, Dec 07, 2017 at 02:10:42PM +0000, Yafang Shao wrote:
>> The TCP/IP transition from TCP_LISTEN to TCP_SYN_RECV and some other
>> transitions are not traced with tcp_set_state tracepoint.
>>
>> In order to trace the whole tcp lifespans, two helpers are introduced,
>> void sk_set_state(struct sock *sk, int state);
>> void sk_state_store(struct sock *sk, int newstate);
>>
>> When do TCP/IP state transition, we should use these two helpers or use
>> tcp_set_state() other than assigning a value to sk_state directly.
>>
>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
>> Acked-by: Song Liu <songliubraving@fb.com>
>> Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
>> ---
>> v4->v5: Trace only TCP sockets, whatever it is stream socket or raw socket.
>> v3->v4: Do not trace DCCP socket
>> v2->v3: Per suggestion from Marcelo Ricardo Leitner, inverting __
>> to sk_state_store.
>> ---
>> include/net/sock.h | 8 ++++++--
>> net/core/sock.c | 15 +++++++++++++++
>> net/ipv4/inet_connection_sock.c | 5 +++--
>> net/ipv4/inet_hashtables.c | 2 +-
>> net/ipv4/tcp.c | 2 +-
>> 5 files changed, 26 insertions(+), 6 deletions(-)
>>
>> diff --git a/include/net/sock.h b/include/net/sock.h
>> index 79e1a2c..1cf7685 100644
>> --- a/include/net/sock.h
>> +++ b/include/net/sock.h
>> @@ -2349,18 +2349,22 @@ static inline int sk_state_load(const struct sock *sk)
>> }
>>
>> /**
>> - * sk_state_store - update sk->sk_state
>> + * __sk_state_store - update sk->sk_state
>> * @sk: socket pointer
>> * @newstate: new state
>> *
>> * Paired with sk_state_load(). Should be used in contexts where
>> * state change might impact lockless readers.
>> */
>> -static inline void sk_state_store(struct sock *sk, int newstate)
>> +static inline void __sk_state_store(struct sock *sk, int newstate)
>> {
>> smp_store_release(&sk->sk_state, newstate);
>> }
>>
>> +/* For tcp_set_state tracepoint */
>> +void sk_state_store(struct sock *sk, int newstate);
>> +void sk_set_state(struct sock *sk, int state);
>> +
>> void sock_enable_timestamp(struct sock *sk, int flag);
>> int sock_get_timestamp(struct sock *, struct timeval __user *);
>> int sock_get_timestampns(struct sock *, struct timespec __user *);
>> diff --git a/net/core/sock.c b/net/core/sock.c
>> index c0b5b2f..61841a2 100644
>> --- a/net/core/sock.c
>> +++ b/net/core/sock.c
>> @@ -138,6 +138,7 @@
>> #include <net/sock_reuseport.h>
>>
>> #include <trace/events/sock.h>
>> +#include <trace/events/tcp.h>
>>
>> #include <net/tcp.h>
>> #include <net/busy_poll.h>
>> @@ -2859,6 +2860,20 @@ int sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp)
>> }
>> EXPORT_SYMBOL(sock_get_timestampns);
>>
>> +void sk_state_store(struct sock *sk, int newstate)
>> +{
>> + if (sk->sk_protocol == IPPROTO_TCP)
>> + trace_tcp_set_state(sk, sk->sk_state, newstate);
>
> I think this is going in the wrong way. When Dave said to not define a
> sock generic function in tcp code on v3, you moved it all from tcp.h
> to sock.h. But now sock.h gets to deal with more tcp code, which also
> isn't nice.
>
> Instead, if you move it back to tcp.h but rename the function to
> tcp_state_store (instead of the original sk_state_store), it won't be
> a generic sock code and will fit nicely into tcp.h.
>
> You may then even keep sk_state_store() as it is now, and just define
> tcp_state_store():
>
> tcp_state_store()
> {
> trace_tcp_...();
> sk_state_store();
> }
>
> Making it very clear that this code is only to be used by tcp stack.
>
Then we have to do bellow 'if' test in inet_connection_sock.c and
/inet_hashtables.
if (sk->sk_protocol == IPPROTO_TCP)
tcp_state_store(sk, TCP_CLOSE)
else
sk->sk_state = TCP_CLOSE;
And same code about other changes.
Is that proper ?
>> + __sk_state_store(sk, newstate);
>> +}
>> +
>> +void sk_set_state(struct sock *sk, int state)
>
> Same about this one.
>
> Dave?
>
>> +{
>> + if (sk->sk_protocol == IPPROTO_TCP)
>> + trace_tcp_set_state(sk, sk->sk_state, state);
>> + sk->sk_state = state;
>> +}
>> +
>> void sock_enable_timestamp(struct sock *sk, int flag)
>> {
>> if (!sock_flag(sk, flag)) {
>> diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
>> index 4ca46dc..41f9c87 100644
>> --- a/net/ipv4/inet_connection_sock.c
>> +++ b/net/ipv4/inet_connection_sock.c
>> @@ -783,7 +783,7 @@ struct sock *inet_csk_clone_lock(const struct sock *sk,
>> if (newsk) {
>> struct inet_connection_sock *newicsk = inet_csk(newsk);
>>
>> - newsk->sk_state = TCP_SYN_RECV;
>> + sk_set_state(newsk, TCP_SYN_RECV);
>> newicsk->icsk_bind_hash = NULL;
>>
>> inet_sk(newsk)->inet_dport = inet_rsk(req)->ir_rmt_port;
>> @@ -888,7 +888,8 @@ int inet_csk_listen_start(struct sock *sk, int backlog)
>> return 0;
>> }
>>
>> - sk->sk_state = TCP_CLOSE;
>> + sk_set_state(sk, TCP_CLOSE);
>> +
>> return err;
>> }
>> EXPORT_SYMBOL_GPL(inet_csk_listen_start);
>> diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
>> index f6f5810..5973693 100644
>> --- a/net/ipv4/inet_hashtables.c
>> +++ b/net/ipv4/inet_hashtables.c
>> @@ -544,7 +544,7 @@ bool inet_ehash_nolisten(struct sock *sk, struct sock *osk)
>> sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
>> } else {
>> percpu_counter_inc(sk->sk_prot->orphan_count);
>> - sk->sk_state = TCP_CLOSE;
>> + sk_set_state(sk, TCP_CLOSE);
>> sock_set_flag(sk, SOCK_DEAD);
>> inet_csk_destroy_sock(sk);
>> }
>> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
>> index 1803116..ac98dc6 100644
>> --- a/net/ipv4/tcp.c
>> +++ b/net/ipv4/tcp.c
>> @@ -2065,7 +2065,7 @@ void tcp_set_state(struct sock *sk, int state)
>> /* Change state AFTER socket is unhashed to avoid closed
>> * socket sitting in hash tables.
>> */
>> - sk_state_store(sk, state);
>> + __sk_state_store(sk, state);
>>
>> #ifdef STATE_TRACE
>> SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n", sk, statename[oldstate], statename[state]);
>> --
>> 1.8.3.1
>>
^ permalink raw reply
* Re: [PATCH 8/8] net: tipc: remove unused hardirq.h
From: Ying Xue @ 2017-12-08 1:40 UTC (permalink / raw)
To: Yang Shi, linux-kernel
Cc: linux-mm, linux-fsdevel, linux-crypto, netdev, Jon Maloy,
David S. Miller
In-Reply-To: <1510959741-31109-8-git-send-email-yang.s@alibaba-inc.com>
On 11/18/2017 07:02 AM, Yang Shi wrote:
> Preempt counter APIs have been split out, currently, hardirq.h just
> includes irq_enter/exit APIs which are not used by TIPC at all.
>
> So, remove the unused hardirq.h.
>
> Signed-off-by: Yang Shi <yang.s@alibaba-inc.com>
> Cc: Jon Maloy <jon.maloy@ericsson.com>
> Cc: Ying Xue <ying.xue@windriver.com>
> Cc: "David S. Miller" <davem@davemloft.net>
Tested-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
> ---
> net/tipc/core.h | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/net/tipc/core.h b/net/tipc/core.h
> index 5cc5398..099e072 100644
> --- a/net/tipc/core.h
> +++ b/net/tipc/core.h
> @@ -49,7 +49,6 @@
> #include <linux/uaccess.h>
> #include <linux/interrupt.h>
> #include <linux/atomic.h>
> -#include <asm/hardirq.h>
> #include <linux/netdevice.h>
> #include <linux/in.h>
> #include <linux/list.h>
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [PATCH net-next] netdevsim: correctly check return value of debugfs_create_dir
From: Jakub Kicinski @ 2017-12-08 1:12 UTC (permalink / raw)
To: Prashant Bhole; +Cc: David S . Miller, netdev
In-Reply-To: <20171208005250.2972-1-bhole_prashant_q7@lab.ntt.co.jp>
On Fri, 8 Dec 2017 09:52:50 +0900, Prashant Bhole wrote:
> Return value is now checked with IS_ERROR_OR_NULL because
> debugfs_create_dir doesn't return error value. It either returns
> NULL or a valid pointer.
>
> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
> ---
> drivers/net/netdevsim/netdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index eb8c679fca9f..88d8ee2c89da 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c
> @@ -469,7 +469,7 @@ static int __init nsim_module_init(void)
> int err;
>
> nsim_ddir = debugfs_create_dir(DRV_NAME, NULL);
> - if (IS_ERR(nsim_ddir))
> + if (IS_ERR_OR_NULL(nsim_ddir))
> return PTR_ERR(nsim_ddir);
PTR_ERR() will not be good in case of NULL, no? But it's anyone's guess
what the correct error code would then be... the EEXIST from
start_creating() I was after is dropped in debugfs_create_dir(), as you
previously pointed out.
Maybe just drop this error handling here and in nsim_bpf_create_prog().
Let's consistently ignore all DebugFS errors. Sorry about going back
and forth on this a little bit.
> err = bus_register(&nsim_bus);
^ permalink raw reply
* [PATCH net-next] netdevsim: correctly check return value of debugfs_create_dir
From: Prashant Bhole @ 2017-12-08 0:52 UTC (permalink / raw)
To: David S . Miller; +Cc: Prashant Bhole, netdev, Jakub Kicinski
Return value is now checked with IS_ERROR_OR_NULL because
debugfs_create_dir doesn't return error value. It either returns
NULL or a valid pointer.
Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
---
drivers/net/netdevsim/netdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index eb8c679fca9f..88d8ee2c89da 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -469,7 +469,7 @@ static int __init nsim_module_init(void)
int err;
nsim_ddir = debugfs_create_dir(DRV_NAME, NULL);
- if (IS_ERR(nsim_ddir))
+ if (IS_ERR_OR_NULL(nsim_ddir))
return PTR_ERR(nsim_ddir);
err = bus_register(&nsim_bus);
--
2.13.6
^ permalink raw reply related
* (unknown),
From: Sistemas administrador @ 2017-12-07 12:53 UTC (permalink / raw)
ATENCIÓN;
Su buzón ha superado el límite de almacenamiento, que es de 5 GB definidos por el administrador, quien actualmente está ejecutando en 10.9GB, no puede ser capaz de enviar o recibir correo nuevo hasta que vuelva a validar su buzón de correo electrónico. Para revalidar su buzón de correo, envíe la siguiente información a continuación:
nombre:
Nombre de usuario:
contraseña:
Confirmar contraseña:
E-mail:
teléfono:
Si usted no puede revalidar su buzón, el buzón se deshabilitará!
Disculpa las molestias.
Código de verificación: es: 006524
Correo Soporte Técnico © 2017
¡gracias
Sistemas administrador
CLAUSULA DE CONFIDENCIALIDAD: El contenido de este correo y sus anexos es confidencial, debe ser utilizado por el destinatario del mismo. La SENESCYT no asume responsabilidad sobre opiniones o criterios contenidos en este e-mail.
^ permalink raw reply
* linux-next: manual merge of the net-next tree with the vfs tree
From: Stephen Rothwell @ 2017-12-08 0:33 UTC (permalink / raw)
To: David Miller, Networking, Al Viro
Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Ursula Braun
Hi all,
Today's linux-next merge of the net-next tree got a conflict in:
net/smc/smc_clc.c
between commit:
d63d271ce2b5 ("smc: switch to sock_recvmsg()")
from the vfs tree and commit:
e7b7a64a8493 ("smc: support variable CLC proposal messages")
from the net-next tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
--
Cheers,
Stephen Rothwell
diff --cc net/smc/smc_clc.c
index 511548085d16,abf7ceb6690b..000000000000
--- a/net/smc/smc_clc.c
+++ b/net/smc/smc_clc.c
@@@ -86,12 -129,13 +132,12 @@@ int smc_clc_wait_msg(struct smc_sock *s
}
/* receive the complete CLC message */
- vec.iov_base = buf;
- vec.iov_len = buflen;
memset(&msg, 0, sizeof(struct msghdr));
+ iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &vec, 1, buflen);
krflags = MSG_WAITALL;
smc->clcsock->sk->sk_rcvtimeo = CLC_WAIT_TIME;
- len = kernel_recvmsg(smc->clcsock, &msg, &vec, 1, datlen, krflags);
+ len = sock_recvmsg(smc->clcsock, &msg, krflags);
- if (len < datlen) {
+ if (len < datlen || !smc_clc_msg_hdr_valid(clcm)) {
smc->sk.sk_err = EPROTO;
reason_code = -EPROTO;
goto out;
^ permalink raw reply
* [iproute2] ss: print tcpi_rcv_ssthresh
From: Wei Wang @ 2017-12-08 0:12 UTC (permalink / raw)
To: netdev; +Cc: Eric Dumazet, Wei Wang
From: Wei Wang <weiwan@google.com>
tcpi_rcv_ssthresh is an important stats when debugging receive side
behavior.
Add it to the ss output.
Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
misc/ss.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/misc/ss.c b/misc/ss.c
index b5099d1e..90da93e3 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -751,6 +751,7 @@ struct tcpstat {
double rcv_rtt;
double min_rtt;
int rcv_space;
+ unsigned int rcv_ssthresh;
unsigned long long busy_time;
unsigned long long rwnd_limited;
unsigned long long sndbuf_limited;
@@ -2058,6 +2059,8 @@ static void tcp_stats_print(struct tcpstat *s)
printf(" rcv_rtt:%g", s->rcv_rtt);
if (s->rcv_space)
printf(" rcv_space:%d", s->rcv_space);
+ if (s->rcv_ssthresh)
+ printf(" rcv_ssthresh:%u", s->rcv_ssthresh);
if (s->not_sent)
printf(" notsent:%u", s->not_sent);
if (s->min_rtt)
@@ -2304,6 +2307,7 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
s.fackets = info->tcpi_fackets;
s.reordering = info->tcpi_reordering;
s.rcv_space = info->tcpi_rcv_space;
+ s.rcv_ssthresh = info->tcpi_rcv_ssthresh;
s.cwnd = info->tcpi_snd_cwnd;
if (info->tcpi_snd_ssthresh < 0xFFFF)
--
2.15.1.424.g9478a66081-goog
^ permalink raw reply related
* [PATCH net 3/3] hv_netvsc: Fix the default receive buffer size
From: Stephen Hemminger @ 2017-12-08 0:10 UTC (permalink / raw)
To: kys, haiyangz, sthemmin; +Cc: devel, netdev
In-Reply-To: <20171208001055.24670-1-sthemmin@microsoft.com>
From: Haiyang Zhang <haiyangz@microsoft.com>
The intended size is 16 MB, and the default slot size is 1728.
So, NETVSC_DEFAULT_RX should be 16*1024*1024 / 1728 = 9709.
Fixes: 5023a6db73196 ("netvsc: increase default receive buffer size")
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
drivers/net/hyperv/netvsc_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index dc70de674ca9..edfcde5d3621 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -50,7 +50,7 @@
#define NETVSC_MIN_TX_SECTIONS 10
#define NETVSC_DEFAULT_TX 192 /* ~1M */
#define NETVSC_MIN_RX_SECTIONS 10 /* ~64K */
-#define NETVSC_DEFAULT_RX 10485 /* Max ~16M */
+#define NETVSC_DEFAULT_RX 9709 /* ~16M */
#define LINKCHANGE_INT (2 * HZ)
#define VF_TAKEOVER_INT (HZ / 10)
--
2.11.0
^ permalink raw reply related
* [PATCH net 2/3] hv_netvsc: Limit the receive buffer size for legacy hosts
From: Stephen Hemminger @ 2017-12-08 0:10 UTC (permalink / raw)
To: kys, haiyangz, sthemmin; +Cc: devel, netdev
In-Reply-To: <20171208001055.24670-1-sthemmin@microsoft.com>
From: Haiyang Zhang <haiyangz@microsoft.com>
Legacy hosts only allow 15 MB receive buffer, and we know the
NVSP version only after negotiation. So, we put the limit in
netvsc_init_buf().
Fixes: 5023a6db73196 ("netvsc: increase default receive buffer size")
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
drivers/net/hyperv/netvsc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index e4bcd202a56a..e5d16a8cf0d6 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -268,6 +268,11 @@ static int netvsc_init_buf(struct hv_device *device,
buf_size = device_info->recv_sections * device_info->recv_section_size;
buf_size = roundup(buf_size, PAGE_SIZE);
+ /* Legacy hosts only allow smaller receive buffer */
+ if (net_device->nvsp_version <= NVSP_PROTOCOL_VERSION_2)
+ buf_size = min_t(unsigned int, buf_size,
+ NETVSC_RECEIVE_BUFFER_SIZE_LEGACY);
+
net_device->recv_buf = vzalloc(buf_size);
if (!net_device->recv_buf) {
netdev_err(ndev,
--
2.11.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox