* [PATCH net-next 0/3] tcp: improve setsockopt() TCP_USER_TIMEOUT accuracy
From: Jon Maxwell @ 2018-07-18 0:46 UTC (permalink / raw)
To: davem
Cc: edumazet, eric.dumazet, ncardwell, David.Laight, kuznet, yoshfuji,
netdev, linux-kernel, jmaxwell
Based on:
https://patchwork.kernel.org/patch/10516195/
Every time the TCP retransmission timer fires. It checks to see if
there is a timeout before scheduling the next retransmit timer. The
retransmit interval between each retransmission increases
exponentially. The issue is that in order for the timeout to occur the
retransmit timer needs to fire again. If the user timeout check happens
after the 9th retransmit for example. It needs to wait for the 10th
retransmit timer to fire in order to evaluate whether a timeout has
occurred or not. If the interval is large enough then the timeout will
be inaccurate.
For example with a TCP_USER_TIMEOUT of 10 seconds without patch:
1st retransmit:
22:25:18.973488 IP host1.49310 > host2.search-agent: Flags [.]
Last retransmit:
22:25:26.205499 IP host1.49310 > host2.search-agent: Flags [.]
Timeout:
send: Connection timed out
Sun Jul 1 22:25:34 EDT 2018
We can see that last retransmit took ~7 seconds. Which pushed the total
timeout to ~15 seconds instead of the expected 10 seconds. This gets
more inaccurate the larger the TCP_USER_TIMEOUT value. As the interval
increases.
Add tcp_clamp_rto_to_user_timeout() to determine if the user rto has
expired. Or whether the rto interval needs to be recalculated. Use the
original interval if user rto is not set.
Test results with the patch is the expected 10 second timeout:
1st retransmit:
01:37:59.022555 IP host1.49310 > host2.search-agent: Flags [.]
Last retransmit:
01:38:06.486558 IP host1.49310 > host2.search-agent: Flags [.]
Timeout:
send: Connection timed out
Mon Jul 2 01:38:09 EDT 2018
Jon Maxwell (3):
tcp: convert icsk_user_timeout from jiffies to msecs
tcp: Add tcp_retransmit_time() helper routine
tcp: Add tcp_clamp_rto_to_user_timeout() helper to improve accuracy
net/ipv4/tcp.c | 4 ++--
net/ipv4/tcp_timer.c | 51 ++++++++++++++++++++++++++++++++++++++-------------
2 files changed, 40 insertions(+), 15 deletions(-)
--
2.13.6
^ permalink raw reply
* tcp: convert icsk_user_timeout from jiffies to msecs
From: Jon Maxwell @ 2018-07-18 0:46 UTC (permalink / raw)
To: davem
Cc: edumazet, eric.dumazet, ncardwell, David.Laight, kuznet, yoshfuji,
netdev, linux-kernel, jmaxwell
This is a preparatory commit. Part of this series that improves the
TCP_USER_TIMEOUT socket option accuracy. Implement Eric Dumazets idea
to convert icsk->icsk_user_timeout from jiffies to msecs. To eliminate
the msecs_to_jiffies() and jiffies_to_msecs() dance in future.
Signed-off-by: Jon Maxwell <jmaxwell37@gmail.com>
---
net/ipv4/tcp.c | 4 ++--
net/ipv4/tcp_timer.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index e3704a49164b..9d900162f16a 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2984,7 +2984,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
if (val < 0)
err = -EINVAL;
else
- icsk->icsk_user_timeout = msecs_to_jiffies(val);
+ icsk->icsk_user_timeout = val;
break;
case TCP_FASTOPEN:
@@ -3440,7 +3440,7 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
break;
case TCP_USER_TIMEOUT:
- val = jiffies_to_msecs(icsk->icsk_user_timeout);
+ val = icsk->icsk_user_timeout;
break;
case TCP_FASTOPEN:
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 3b3611729928..fa34984d0b12 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -183,8 +183,9 @@ static bool retransmits_timed_out(struct sock *sk,
else
timeout = ((2 << linear_backoff_thresh) - 1) * rto_base +
(boundary - linear_backoff_thresh) * TCP_RTO_MAX;
+ timeout = jiffies_to_msecs(timeout);
}
- return (tcp_time_stamp(tcp_sk(sk)) - start_ts) >= jiffies_to_msecs(timeout);
+ return (tcp_time_stamp(tcp_sk(sk)) - start_ts) >= timeout;
}
/* A write timeout has occurred. Process the after effects. */
@@ -337,8 +338,7 @@ static void tcp_probe_timer(struct sock *sk)
if (!start_ts)
skb->skb_mstamp = tp->tcp_mstamp;
else if (icsk->icsk_user_timeout &&
- (s32)(tcp_time_stamp(tp) - start_ts) >
- jiffies_to_msecs(icsk->icsk_user_timeout))
+ (s32)(tcp_time_stamp(tp) - start_ts) > icsk->icsk_user_timeout)
goto abort;
max_probes = sock_net(sk)->ipv4.sysctl_tcp_retries2;
@@ -672,7 +672,7 @@ static void tcp_keepalive_timer (struct timer_list *t)
* to determine when to timeout instead.
*/
if ((icsk->icsk_user_timeout != 0 &&
- elapsed >= icsk->icsk_user_timeout &&
+ elapsed >= msecs_to_jiffies(icsk->icsk_user_timeout) &&
icsk->icsk_probes_out > 0) ||
(icsk->icsk_user_timeout == 0 &&
icsk->icsk_probes_out >= keepalive_probes(tp))) {
--
2.13.6
^ permalink raw reply related
* tcp: Add tcp_retransmit_time() helper routine
From: Jon Maxwell @ 2018-07-18 0:46 UTC (permalink / raw)
To: davem
Cc: edumazet, eric.dumazet, ncardwell, David.Laight, kuznet, yoshfuji,
netdev, linux-kernel, jmaxwell
Create a seperate helper routine as per Neal Cardwells suggestion. To
be used by the final commit in this series and retransmits_timed_out().
Signed-off-by: Jon Maxwell <jmaxwell37@gmail.com>
---
net/ipv4/tcp_timer.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index fa34984d0b12..d212f183dd2d 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -22,6 +22,20 @@
#include <linux/gfp.h>
#include <net/tcp.h>
+u32 tcp_retransmit_stamp(const struct sock *sk)
+{
+ u32 start_ts = tcp_sk(sk)->retrans_stamp;
+
+ if (unlikely(!start_ts)) {
+ struct sk_buff *head = tcp_rtx_queue_head(sk);
+
+ if (!head)
+ return 0;
+ start_ts = tcp_skb_timestamp(head);
+ }
+ return start_ts;
+}
+
/**
* tcp_write_err() - close socket and save error info
* @sk: The socket the error has appeared on.
@@ -166,14 +180,9 @@ static bool retransmits_timed_out(struct sock *sk,
if (!inet_csk(sk)->icsk_retransmits)
return false;
- start_ts = tcp_sk(sk)->retrans_stamp;
- if (unlikely(!start_ts)) {
- struct sk_buff *head = tcp_rtx_queue_head(sk);
-
- if (!head)
- return false;
- start_ts = tcp_skb_timestamp(head);
- }
+ start_ts = tcp_retransmit_stamp(sk);
+ if (!start_ts)
+ return false;
if (likely(timeout == 0)) {
linear_backoff_thresh = ilog2(TCP_RTO_MAX/rto_base);
--
2.13.6
^ permalink raw reply related
* tcp: Add tcp_clamp_rto_to_user_timeout() helper to improve accuracy
From: Jon Maxwell @ 2018-07-18 0:46 UTC (permalink / raw)
To: davem
Cc: edumazet, eric.dumazet, ncardwell, David.Laight, kuznet, yoshfuji,
netdev, linux-kernel, jmaxwell
Create the tcp_clamp_rto_to_user_timeout() helper routine. To calculate
the correct rto, so that the TCP_USER_TIMEOUT socket option is more
accurate. Taking suggestions and feedback into account from
Eric Dumazet, Neal Cardwell and David Laight. Due to the 1st commit we
can avoid the msecs_to_jiffies() and jiffies_to_msecs() dance.
Signed-off-by: Jon Maxwell <jmaxwell37@gmail.com>
---
net/ipv4/tcp_timer.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index d212f183dd2d..a242f8874629 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -36,6 +36,21 @@ u32 tcp_retransmit_stamp(const struct sock *sk)
return start_ts;
}
+static u32 tcp_clamp_rto_to_user_timeout(const struct sock *sk)
+{
+ struct inet_connection_sock *icsk = inet_csk(sk);
+ u32 elapsed, start_ts;
+
+ start_ts = tcp_retransmit_stamp(sk);
+ if (!icsk->icsk_user_timeout || !start_ts)
+ return icsk->icsk_rto;
+ elapsed = tcp_time_stamp(tcp_sk(sk)) - start_ts;
+ if (elapsed >= icsk->icsk_user_timeout)
+ return 1; /* user timeout has passed; fire ASAP */
+ else
+ return min_t(u32, icsk->icsk_rto, msecs_to_jiffies(icsk->icsk_user_timeout - elapsed));
+}
+
/**
* tcp_write_err() - close socket and save error info
* @sk: The socket the error has appeared on.
@@ -544,7 +559,8 @@ void tcp_retransmit_timer(struct sock *sk)
/* Use normal (exponential) backoff */
icsk->icsk_rto = min(icsk->icsk_rto << 1, TCP_RTO_MAX);
}
- inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto, TCP_RTO_MAX);
+ inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
+ tcp_clamp_rto_to_user_timeout(sk), TCP_RTO_MAX);
if (retransmits_timed_out(sk, net->ipv4.sysctl_tcp_retries1 + 1, 0))
__sk_dst_reset(sk);
--
2.13.6
^ permalink raw reply related
* Re: [PATCH bpf-next v2 07/11] bpf: offload: keep the offload state per-ASIC
From: Alexei Starovoitov @ 2018-07-18 0:19 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: daniel, netdev, oss-drivers
In-Reply-To: <20180717175329.12386-8-jakub.kicinski@netronome.com>
On Tue, Jul 17, 2018 at 10:53:25AM -0700, Jakub Kicinski wrote:
> Create a higher-level entity to represent a device/ASIC to allow
> programs and maps to be shared between device ports. The extra
> work is required to make sure we don't destroy BPF objects as
> soon as the netdev for which they were loaded gets destroyed,
> as other ports may still be using them. When netdev goes away
> all of its BPF objects will be moved to other netdevs of the
> device, and only destroyed when last netdev is unregistered.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
the moving logic is a bit odd, but I don't have better suggestions.
For the whole patch set:
Acked-by: Alexei Starovoitov <ast@kernel.org>
^ permalink raw reply
* Re: [PATCH iproute2 2/5] bpf: move bpf_elf_map fixup notification under verbose
From: Jakub Kicinski @ 2018-07-18 0:24 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: dsahern, alexei.starovoitov, netdev
In-Reply-To: <20180717233122.29390-3-daniel@iogearbox.net>
On Wed, 18 Jul 2018 01:31:19 +0200, Daniel Borkmann wrote:
> No need to spam the user with this if it can be fixed gracefully
> anyway. Therefore, move it under verbose option.
>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> ---
> lib/bpf.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/bpf.c b/lib/bpf.c
> index 4e26c0d..42093db 100644
> --- a/lib/bpf.c
> +++ b/lib/bpf.c
> @@ -1893,9 +1893,9 @@ static int bpf_fetch_maps_end(struct bpf_elf_ctx *ctx)
> }
>
> memcpy(ctx->maps, fixup, sizeof(fixup));
> -
> - printf("Note: %zu bytes struct bpf_elf_map fixup performed due to size mismatch!\n",
> - sizeof(struct bpf_elf_map) - ctx->map_len);
> + if (ctx->verbose)
> + printf("%zu bytes struct bpf_elf_map fixup performed due to size mismatch!\n",
> + sizeof(struct bpf_elf_map) - ctx->map_len);
Glad to see that :) FWIW you seem to use fprintf(stderr, ) in the btf
patch for information messages, I think that's a good approach.
Separating "results" from "info/error" messages. Helps JSON too.
Probably doesn't matter much for this message.
^ permalink raw reply
* Re: [PATCH iproute2 5/5] bpf: implement btf handling and map annotation
From: Jakub Kicinski @ 2018-07-18 0:27 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: dsahern, alexei.starovoitov, netdev
In-Reply-To: <20180717233122.29390-6-daniel@iogearbox.net>
On Wed, 18 Jul 2018 01:31:22 +0200, Daniel Borkmann wrote:
> # bpftool map dump id 386
> [{
> "key": 0,
> "value": {
> "": {
> "value": 0,
> "ifindex": 0,
> "mac": []
> }
> }
> },{
> "key": 1,
> "value": {
> "": {
> "value": 0,
> "ifindex": 0,
> "mac": []
> }
> }
> },{
> [...]
Ugh, the empty keys ("") look worrying, we should probably improve
handling of anonymous structs in bpftool :S
FWIW all the patches look nice to me! Thanks for keeping the support
for loading programs from the ".text" section :)
^ permalink raw reply
* Re: [PATCH net-next 1/8] net: dsa: mv88e6xxx: Abstract PTP operations
From: David Miller @ 2018-07-18 0:40 UTC (permalink / raw)
To: andrew; +Cc: richardcochran, vivien.didelot, netdev
In-Reply-To: <1531864140-31233-2-git-send-email-andrew@lunn.ch>
From: Andrew Lunn <andrew@lunn.ch>
Date: Tue, 17 Jul 2018 23:48:53 +0200
> @@ -319,6 +337,8 @@ int mv88e6xxx_ptp_setup(struct mv88e6xxx_chip *chip)
> {
> int i;
>
> + const struct mv88e6xxx_ptp_ops *ptp_ops = chip->info->ops->ptp_ops;
> +
Please keep the local variables together here.
Otherwise, this series looks good to me.
^ permalink raw reply
* Re: [PATCH net-next 0/3] tcp: improve setsockopt() TCP_USER_TIMEOUT accuracy
From: Eric Dumazet @ 2018-07-18 1:20 UTC (permalink / raw)
To: Jon Maxwell, davem
Cc: edumazet, eric.dumazet, ncardwell, David.Laight, kuznet, yoshfuji,
netdev, linux-kernel, jmaxwell
In-Reply-To: <20180718004639.30154-1-jmaxwell37@gmail.com>
On 07/17/2018 05:46 PM, Jon Maxwell wrote:
> Based on:
>
> https://patchwork.kernel.org/patch/10516195/
>
I must confess I am lost with your submissions.
Patchwork is also lost ( https://patchwork.ozlabs.org/project/netdev/list/ )
Are you really using git format-patch ?
Normally all the patches should have a common [PATCH Vx net-next] string
git format-patch -o ../output --cover-letter --subject-prefix "PATCH V3 net-next" HEAD~3
^ permalink raw reply
* Re: [PATCH net-next v3 00/10] r8169: add phylib support
From: David Miller @ 2018-07-18 0:49 UTC (permalink / raw)
To: hkallweit1; +Cc: f.fainelli, andrew, nic_swsd, netdev
In-Reply-To: <a33329d7-96ba-314e-3865-b9800ab14f87@gmail.com>
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Tue, 17 Jul 2018 22:42:40 +0200
> Now that all the basic refactoring has been done we can add phylib
> support. This patch series was successfully tested on:
> RTL8168h
> RTL8168evl
> RTL8169sb
>
> Changes in v2:
> - return error in mdio ops if phyaddr > 0
> - advertise pause modes
> - added reviewed-by for several patches
>
> Changes in v3:
> - return ENODEV for unused phy addresses in mdio ops
> - remove unneeded PHY suspend in patch 2
> - use recently added phy_speed_down and phy_speed_up in patch 7
> - other minor changes based on review comments
This looks great, series applied, thanks!
^ permalink raw reply
* Re: [PATCH net-next 1/7] net: dsa: bcm_sf2: Allow targeting CPU ports for CFP rules
From: David Miller @ 2018-07-18 0:56 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, linville, andrew, vivien.didelot
In-Reply-To: <20180717153645.7500-3-f.fainelli@gmail.com>
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 17 Jul 2018 08:36:39 -0700
> @@ -755,7 +755,8 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
> port_num = fs->ring_cookie / SF2_NUM_EGRESS_QUEUES;
>
> if (fs->ring_cookie == RX_CLS_FLOW_DISC ||
> - !dsa_is_user_port(ds, port_num) ||
> + !(dsa_is_user_port(ds, port_num) ||
> + dsa_is_cpu_port(ds, port_num)) ||
I think the second new line needs to be indented by two more
spaces, but I could be wrong :-)
^ permalink raw reply
* Re: [PATCH net-next 0/4] HWMON support for SFP modules
From: David Miller @ 2018-07-18 1:02 UTC (permalink / raw)
To: andrew; +Cc: linux, netdev, f.fainelli, rmk+kernel, linux-hwmon
In-Reply-To: <1531856893-27884-1-git-send-email-andrew@lunn.ch>
From: Andrew Lunn <andrew@lunn.ch>
Date: Tue, 17 Jul 2018 21:48:09 +0200
> This patchset adds HWMON support to SFP modules. The two patches add
> some attributes for temperature and power sensors which are currently
> missing from the hwmon core. The third patch adds a helper for
> filtering out characters in hwmon names which are invalid. The last
> patch then extends the core SFP code to export the sensors found in
> SFP modules.
>
> This code has been tested with two SFP modules:
>
> module OEM SFP-7000-85 rev 11.0 sn M1512220075 dc 160221
> module FINISAR CORP. FTLF8524E2GNL rev A sn PW40MNN dc 160725
>
> The anonymous module uses external calibration, while the FINISAR uses
> internal calibration. Thus both code paths have been tested.
>
> Due to the cross subsystem nature of these patches, as discussed with
> the RFC, it is hoped Guenter Roeck will ACK the patches, and then Dave
> Miller will merge them all via net-next.
Series applied, thanks Andrew.
^ permalink raw reply
* Re: [PATCH net-next] r8169: power down chip in probe
From: David Miller @ 2018-07-18 1:03 UTC (permalink / raw)
To: hkallweit1; +Cc: nic_swsd, netdev
In-Reply-To: <5bc628cd-b638-df9a-c0bc-5b15105a8fb1@gmail.com>
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Tue, 17 Jul 2018 21:21:37 +0200
> The removed code would be called in two situations:
> 1. interface is brought up never or >10s after driver load
> 2. after close()
>
> Case 1 we can handle cleaner by ensuring chip is powered down when
> leaving probe(). open() callback will power up the chip.
>
> In case 2 we call rtl_pll_power_down() twice currently, from the
> close() callback and 10s later when entering runtime-suspend.
> This is avoided by this patch.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied, thank you.
^ permalink raw reply
* [PATCH] ptp: fix missing break in switch
From: Gustavo A. R. Silva @ 2018-07-18 1:17 UTC (permalink / raw)
To: Stefan Sørensen, Richard Cochran, David S. Miller
Cc: netdev, linux-kernel, Gustavo A. R. Silva
It seems that a *break* is missing in order to avoid falling through
to the default case. Otherwise, checking *chan* makes no sense.
Fixes: 72df7a7244c0 ("ptp: Allow reassigning calibration pin function")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
drivers/ptp/ptp_chardev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index 547dbda..01b0e2b 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -89,6 +89,7 @@ int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin,
case PTP_PF_PHYSYNC:
if (chan != 0)
return -EINVAL;
+ break;
default:
return -EINVAL;
}
--
2.7.4
^ permalink raw reply related
* Re: [PATCH net-next 0/3] tcp: improve setsockopt() TCP_USER_TIMEOUT accuracy
From: Jonathan Maxwell @ 2018-07-18 1:55 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, Eric Dumazet, Neal Cardwell, David Laight, kuznet,
yoshfuji, Netdev, LKML, Jon Maxwell
In-Reply-To: <5aafc511-15a1-da3c-19f8-cc8b658f9c3d@gmail.com>
After committing the patches in my net-next git branch I used git send-mail:
git send-email --identity=XXX --cover-letter --annotate origin
--compose --signoff
and manually updated it based on an example of yours:
https://lwn.net/Articles/706491/
I can see the 3 patches that I just submitted on:
https://patchwork.ozlabs.org/project/netdev/list/
Flagged as under review by DaveM.
On Wed, Jul 18, 2018 at 11:20 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
> On 07/17/2018 05:46 PM, Jon Maxwell wrote:
>> Based on:
>>
>> https://patchwork.kernel.org/patch/10516195/
>>
>
> I must confess I am lost with your submissions.
>
> Patchwork is also lost ( https://patchwork.ozlabs.org/project/netdev/list/ )
>
> Are you really using git format-patch ?
>
> Normally all the patches should have a common [PATCH Vx net-next] string
>
> git format-patch -o ../output --cover-letter --subject-prefix "PATCH V3 net-next" HEAD~3
>
>
^ permalink raw reply
* [PATCH v2] tcp: identify cryptic messages as TCP seq # bugs
From: Randy Dunlap @ 2018-07-18 1:27 UTC (permalink / raw)
To: netdev@vger.kernel.org, Eric Dumazet, David Miller
Cc: 積丹尼 Dan Jacobson
From: Randy Dunlap <rdunlap@infradead.org>
Attempt to make cryptic TCP seq number error messages clearer by
(1) identifying the source of the message as "TCP", (2) identifying the
errors as "seq # bug", and (3) grouping the field identifiers and values
by separating them with commas.
E.g., the following message is changed from:
recvmsg bug 2: copied 73BCB6CD seq 70F17CBE rcvnxt 73BCB9AA fl 0
WARNING: CPU: 2 PID: 1501 at /linux/net/ipv4/tcp.c:1881 tcp_recvmsg+0x649/0xb90
to:
TCP recvmsg seq # bug 2: copied 73BCB6CD, seq 70F17CBE, rcvnxt 73BCB9AA, fl 0
WARNING: CPU: 2 PID: 1501 at /linux/net/ipv4/tcp.c:2011 tcp_recvmsg+0x694/0xba0
Suggested-by: 積丹尼 Dan Jacobson <jidanni@jidanni.org>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
---
v2: drop __func__ because it duplicates part of the error message.
net/ipv4/tcp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- linux-next-20180717.orig/net/ipv4/tcp.c
+++ linux-next-20180717/net/ipv4/tcp.c
@@ -1994,7 +1994,7 @@ int tcp_recvmsg(struct sock *sk, struct
* shouldn't happen.
*/
if (WARN(before(*seq, TCP_SKB_CB(skb)->seq),
- "recvmsg bug: copied %X seq %X rcvnxt %X fl %X\n",
+ "TCP recvmsg seq # bug: copied %X, seq %X, rcvnxt %X, fl %X\n",
*seq, TCP_SKB_CB(skb)->seq, tp->rcv_nxt,
flags))
break;
@@ -2009,7 +2009,7 @@ int tcp_recvmsg(struct sock *sk, struct
if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
goto found_fin_ok;
WARN(!(flags & MSG_PEEK),
- "recvmsg bug 2: copied %X seq %X rcvnxt %X fl %X\n",
+ "TCP recvmsg seq # bug 2: copied %X, seq %X, rcvnxt %X, fl %X\n",
*seq, TCP_SKB_CB(skb)->seq, tp->rcv_nxt, flags);
}
^ permalink raw reply
* linux-next: manual merge of the netfilter-next tree with the net tree
From: Stephen Rothwell @ 2018-07-18 1:28 UTC (permalink / raw)
To: Pablo Neira Ayuso, NetFilter, David Miller, Networking
Cc: Linux-Next Mailing List, Linux Kernel Mailing List,
Florian Westphal
[-- Attachment #1: Type: text/plain, Size: 1765 bytes --]
Hi all,
Today's linux-next merge of the netfilter-next tree got a conflict in:
include/net/netfilter/nf_tables_core.h
between commit:
e240cd0df481 ("netfilter: nf_tables: place all set backends in one single module")
from the net tree and commit:
da8f7d227adc ("netfilter: nf_tables: handle meta/lookup with direct call")
from the netfilter-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 include/net/netfilter/nf_tables_core.h
index a05134507e7b,0096f65096b5..000000000000
--- a/include/net/netfilter/nf_tables_core.h
+++ b/include/net/netfilter/nf_tables_core.h
@@@ -65,10 -65,11 +65,17 @@@ extern const struct nft_expr_ops nft_pa
extern struct static_key_false nft_counters_enabled;
extern struct static_key_false nft_trace_enabled;
+extern struct nft_set_type nft_set_rhash_type;
+extern struct nft_set_type nft_set_hash_type;
+extern struct nft_set_type nft_set_hash_fast_type;
+extern struct nft_set_type nft_set_rbtree_type;
+extern struct nft_set_type nft_set_bitmap_type;
+
+ struct nft_expr;
+ struct nft_regs;
+ struct nft_pktinfo;
+ void nft_meta_get_eval(const struct nft_expr *expr,
+ struct nft_regs *regs, const struct nft_pktinfo *pkt);
+ void nft_lookup_eval(const struct nft_expr *expr,
+ struct nft_regs *regs, const struct nft_pktinfo *pkt);
#endif /* _NET_NF_TABLES_CORE_H */
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* linux-next: build failure after merge of the netfilter-next tree
From: Stephen Rothwell @ 2018-07-18 1:50 UTC (permalink / raw)
To: Pablo Neira Ayuso, NetFilter, David Miller, Networking
Cc: Linux-Next Mailing List, Linux Kernel Mailing List,
Máté Eckl
[-- Attachment #1: Type: text/plain, Size: 12543 bytes --]
Hi all,
After merging the netfilter-next tree, today's linux-next build (x86_64
allmodconfig) failed like this:
net/netfilter/nft_tproxy.c: In function 'nft_tproxy_eval_v4':
net/netfilter/nft_tproxy.c:48:48: warning: passing argument 3 of 'nf_tproxy_get_sock_v4' makes integer from pointer without a cast [-Wint-conversion]
sk = nf_tproxy_get_sock_v4(nft_net(pkt), skb, hp, iph->protocol,
^~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:75:1: note: expected 'u8 {aka const unsigned char}' but argument is of type 'struct udphdr *'
nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:50:20: warning: passing argument 8 of 'nf_tproxy_get_sock_v4' makes pointer from integer without a cast [-Wint-conversion]
hp->source, hp->dest,
^~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:75:1: note: expected 'const struct net_device *' but argument is of type '__be16 {aka short unsigned int}'
nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:51:8: error: incompatible type for argument 9 of 'nf_tproxy_get_sock_v4'
skb->dev, NF_TPROXY_LOOKUP_ESTABLISHED);
^~~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:75:1: note: expected 'const enum nf_tproxy_lookup_t' but argument is of type 'struct net_device *'
nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:48:7: error: too many arguments to function 'nf_tproxy_get_sock_v4'
sk = nf_tproxy_get_sock_v4(nft_net(pkt), skb, hp, iph->protocol,
^~~~~~~~~~~~~~~~~~~~~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:75:1: note: declared here
nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:69:49: warning: passing argument 3 of 'nf_tproxy_get_sock_v4' makes integer from pointer without a cast [-Wint-conversion]
sk = nf_tproxy_get_sock_v4(nft_net(pkt), skb, hp, iph->protocol,
^~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:75:1: note: expected 'u8 {aka const unsigned char}' but argument is of type 'struct udphdr *'
nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:71:21: warning: passing argument 8 of 'nf_tproxy_get_sock_v4' makes pointer from integer without a cast [-Wint-conversion]
hp->source, tport,
^~~~~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:75:1: note: expected 'const struct net_device *' but argument is of type '__be16 {aka short unsigned int}'
nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:72:9: error: incompatible type for argument 9 of 'nf_tproxy_get_sock_v4'
skb->dev, NF_TPROXY_LOOKUP_LISTENER);
^~~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:75:1: note: expected 'const enum nf_tproxy_lookup_t' but argument is of type 'struct net_device *'
nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:69:8: error: too many arguments to function 'nf_tproxy_get_sock_v4'
sk = nf_tproxy_get_sock_v4(nft_net(pkt), skb, hp, iph->protocol,
^~~~~~~~~~~~~~~~~~~~~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:75:1: note: declared here
nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c: In function 'nft_tproxy_eval_v6':
net/netfilter/nft_tproxy.c:111:55: warning: passing argument 4 of 'nf_tproxy_get_sock_v6' makes integer from pointer without a cast [-Wint-conversion]
sk = nf_tproxy_get_sock_v6(nft_net(pkt), skb, thoff, hp, l4proto,
^~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:114:1: note: expected 'u8 {aka const unsigned char}' but argument is of type 'struct udphdr *'
nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:111:59: warning: passing argument 5 of 'nf_tproxy_get_sock_v6' makes pointer from integer without a cast [-Wint-conversion]
sk = nf_tproxy_get_sock_v6(nft_net(pkt), skb, thoff, hp, l4proto,
^~~~~~~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:114:1: note: expected 'const struct in6_addr *' but argument is of type 'int'
nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:112:21: warning: passing argument 7 of 'nf_tproxy_get_sock_v6' makes integer from pointer without a cast [-Wint-conversion]
&iph->saddr, &iph->daddr,
^
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:114:1: note: expected '__be16 {aka const short unsigned int}' but argument is of type 'const struct in6_addr *'
nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:113:20: warning: passing argument 9 of 'nf_tproxy_get_sock_v6' makes pointer from integer without a cast [-Wint-conversion]
hp->source, hp->dest,
^~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:114:1: note: expected 'const struct net_device *' but argument is of type '__be16 {aka short unsigned int}'
nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:114:8: error: incompatible type for argument 10 of 'nf_tproxy_get_sock_v6'
nft_in(pkt), NF_TPROXY_LOOKUP_ESTABLISHED);
^~~~~~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:114:1: note: expected 'const enum nf_tproxy_lookup_t' but argument is of type 'const struct net_device *'
nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:111:7: error: too many arguments to function 'nf_tproxy_get_sock_v6'
sk = nf_tproxy_get_sock_v6(nft_net(pkt), skb, thoff, hp, l4proto,
^~~~~~~~~~~~~~~~~~~~~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:114:1: note: declared here
nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:137:56: warning: passing argument 4 of 'nf_tproxy_get_sock_v6' makes integer from pointer without a cast [-Wint-conversion]
sk = nf_tproxy_get_sock_v6(nft_net(pkt), skb, thoff, hp,
^~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:114:1: note: expected 'u8 {aka const unsigned char}' but argument is of type 'struct udphdr *'
nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:138:9: warning: passing argument 5 of 'nf_tproxy_get_sock_v6' makes pointer from integer without a cast [-Wint-conversion]
l4proto, &iph->saddr, &taddr,
^~~~~~~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:114:1: note: expected 'const struct in6_addr *' but argument is of type 'int'
nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:138:31: warning: passing argument 7 of 'nf_tproxy_get_sock_v6' makes integer from pointer without a cast [-Wint-conversion]
l4proto, &iph->saddr, &taddr,
^
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:114:1: note: expected '__be16 {aka const short unsigned int}' but argument is of type 'struct in6_addr *'
nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:139:21: warning: passing argument 9 of 'nf_tproxy_get_sock_v6' makes pointer from integer without a cast [-Wint-conversion]
hp->source, tport,
^~~~~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:114:1: note: expected 'const struct net_device *' but argument is of type '__be16 {aka short unsigned int}'
nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:140:9: error: incompatible type for argument 10 of 'nf_tproxy_get_sock_v6'
nft_in(pkt), NF_TPROXY_LOOKUP_LISTENER);
^~~~~~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:114:1: note: expected 'const enum nf_tproxy_lookup_t' but argument is of type 'const struct net_device *'
nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff,
^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nft_tproxy.c:137:8: error: too many arguments to function 'nf_tproxy_get_sock_v6'
sk = nf_tproxy_get_sock_v6(nft_net(pkt), skb, thoff, hp,
^~~~~~~~~~~~~~~~~~~~~
In file included from net/netfilter/nft_tproxy.c:6:0:
include/net/netfilter/nf_tproxy.h:114:1: note: declared here
nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff,
^~~~~~~~~~~~~~~~~~~~~
Caused by commit
08668354bdbf ("netfilter: Add native tproxy support for nf_tables")
interacting with commit
5711b4e89319 ("netfilter: nf_tproxy: fix possible non-linear access to transport header")
from the net tree.
I have applied the following merge fix up patch:
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 18 Jul 2018 11:41:50 +1000
Subject: [PATCH] netfilter: nf_tproxy: merge fix ups for API changes
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
net/netfilter/nft_tproxy.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/netfilter/nft_tproxy.c b/net/netfilter/nft_tproxy.c
index 5ca797ea335c..23ea9396a693 100644
--- a/net/netfilter/nft_tproxy.c
+++ b/net/netfilter/nft_tproxy.c
@@ -45,7 +45,7 @@ static void nft_tproxy_eval_v4(const struct nft_expr *expr,
* happens if the redirect already happened and the current packet
* belongs to an already established connection
*/
- sk = nf_tproxy_get_sock_v4(nft_net(pkt), skb, hp, iph->protocol,
+ sk = nf_tproxy_get_sock_v4(nft_net(pkt), skb, iph->protocol,
iph->saddr, iph->daddr,
hp->source, hp->dest,
skb->dev, NF_TPROXY_LOOKUP_ESTABLISHED);
@@ -66,7 +66,7 @@ static void nft_tproxy_eval_v4(const struct nft_expr *expr,
else if (!sk)
/* no, there's no established connection, check if
* there's a listener on the redirected addr/port */
- sk = nf_tproxy_get_sock_v4(nft_net(pkt), skb, hp, iph->protocol,
+ sk = nf_tproxy_get_sock_v4(nft_net(pkt), skb, iph->protocol,
iph->saddr, taddr,
hp->source, tport,
skb->dev, NF_TPROXY_LOOKUP_LISTENER);
@@ -108,7 +108,7 @@ static void nft_tproxy_eval_v6(const struct nft_expr *expr,
* happens if the redirect already happened and the current packet
* belongs to an already established connection.
*/
- sk = nf_tproxy_get_sock_v6(nft_net(pkt), skb, thoff, hp, l4proto,
+ sk = nf_tproxy_get_sock_v6(nft_net(pkt), skb, thoff, l4proto,
&iph->saddr, &iph->daddr,
hp->source, hp->dest,
nft_in(pkt), NF_TPROXY_LOOKUP_ESTABLISHED);
@@ -134,7 +134,7 @@ static void nft_tproxy_eval_v6(const struct nft_expr *expr,
else if (!sk)
/* no there's no established connection, check if
* there's a listener on the redirected addr/port */
- sk = nf_tproxy_get_sock_v6(nft_net(pkt), skb, thoff, hp,
+ sk = nf_tproxy_get_sock_v6(nft_net(pkt), skb, thoff,
l4proto, &iph->saddr, &taddr,
hp->source, tport,
nft_in(pkt), NF_TPROXY_LOOKUP_LISTENER);
--
2.18.0
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related
* Re: [PATCH] lib/rhashtable: consider param->min_size when setting initial table size
From: Andrew Morton @ 2018-07-18 1:58 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: Herbert Xu, tgraf, linux-kernel, Davidlohr Bueso, netdev
In-Reply-To: <20180717223057.7wdtjwbusxfqpvur@linux-r8p5>
On Tue, 17 Jul 2018 15:30:57 -0700 Davidlohr Bueso <dave@stgolabs.net> wrote:
> On Mon, 16 Jul 2018, Herbert Xu wrote:
>
> >On Fri, Jul 13, 2018 at 11:25:16PM -0700, Davidlohr Bueso wrote:
> >> rhashtable_init() currently does not take into account the user-passed
> >> min_size parameter unless param->nelem_hint is set as well. As such,
> >> the default size (number of buckets) will always be HASH_DEFAULT_SIZE
> >> even if the smallest allowed size is larger than that. Remediate this
> >> by unconditionally calling into rounded_hashtable_size() and handling
> >> things accordingly.
> >>
> >> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
> >
> >Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
> >
> >Normally these patches go through netdev so could you please resend
> >it with my ack to netdev@vger.kernel.org?
>
> So I've done the resend, but at least would think that routing the
> patch through Andrew would work best as he picked up the rhashtable
> changes regarding ipc and this touches the same call.
>
Either approach works.
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
^ permalink raw reply
* Re: [PATCH iproute2 net-next] ipneigh: exclude NTF_EXT_LEARNED from default filter
From: David Ahern @ 2018-07-18 1:58 UTC (permalink / raw)
To: Roopa Prabhu; +Cc: netdev
In-Reply-To: <1531779592-17151-1-git-send-email-roopa@cumulusnetworks.com>
On 7/16/18 4:19 PM, Roopa Prabhu wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> NUD_NOARP entries are filtered out by default by iproute2.
> We dont want NUD_NOARP with NTF_EXT_LEARNED flag filtered out.
> This patch extends the default filter check for ip neigh show
> to include the NTF_EXT_LEARNED flag.
>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
> ip/ipneigh.c | 1 +
> 1 file changed, 1 insertion(+)
>
applied to iproute2-next. Thanks
^ permalink raw reply
* Re: [PATCH net-next 0/3] tcp: improve setsockopt() TCP_USER_TIMEOUT accuracy
From: Eric Dumazet @ 2018-07-18 2:40 UTC (permalink / raw)
To: Jonathan Maxwell, Eric Dumazet
Cc: David Miller, Eric Dumazet, Neal Cardwell, David Laight, kuznet,
yoshfuji, Netdev, LKML, Jon Maxwell
In-Reply-To: <CAGHK07D_XCpU6V6oJ2rhR1=rX5P6t8ZhTMT7GEAyrBXoc=hbcQ@mail.gmail.com>
On 07/17/2018 06:55 PM, Jonathan Maxwell wrote:
> After committing the patches in my net-next git branch I used git send-mail:
>
> git send-email --identity=XXX --cover-letter --annotate origin
> --compose --signoff
>
> and manually updated it based on an example of yours:
>
> https://lwn.net/Articles/706491/
>
> I can see the 3 patches that I just submitted on:
>
> https://patchwork.ozlabs.org/project/netdev/list/
>
> Flagged as under review by DaveM.
>
I dunno, each patch belongs to a separate patch series, this is not expected.
Compare to what happens on https://patchwork.ozlabs.org/project/netdev/list/ for a proper submission.
If you click on https://patchwork.ozlabs.org/project/netdev/list/?series=56100 for example,
you can see 5 patch in a series.
Standard workflow :
git-format-patch ...
<edit cover letter>
git send-email --to "David S. Miller <davem@davemloft.net>" \
--cc "netdev <netdev@vger.kernel.org>" \
--cc "Eric Dumazet <edumazet@google.com>" \
00*
^ permalink raw reply
* Re: [PATCH iproute2-next v3] net:sched: add action inheritdsfield to skbedit
From: David Ahern @ 2018-07-18 2:09 UTC (permalink / raw)
To: Qiaobin Fu
Cc: stephen, davem, netdev, jhs, michel, marcelo.leitner,
xiyou.wangcong, dcaratti
In-Reply-To: <20180714071054.3213-1-qiaobinf@bu.edu>
On 7/14/18 1:10 AM, Qiaobin Fu wrote:
> @@ -156,6 +162,9 @@ parse_skbedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
> if (flags & SKBEDIT_F_PTYPE)
> addattr_l(n, MAX_MSG, TCA_SKBEDIT_PTYPE,
> &ptype, sizeof(ptype));
> + if (pure_flags != 0)
> + addattr_l(n, MAX_MSG, TCA_SKBEDIT_FLAGS,
> + &pure_flags, sizeof(pure_flags));
I realize this follows suit with the current code, but tc needs to use
the helpers -- like addattr64 instead of addattr_l
> addattr_nest_end(n, tail);
>
> *argc_p = argc;
> @@ -214,6 +223,13 @@ static int print_skbedit(struct action_util *au, FILE *f, struct rtattr *arg)
> else
> print_uint(PRINT_ANY, "ptype", " ptype %u", ptype);
> }
> + if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
> + __u64 *flags = RTA_DATA(tb[TCA_SKBEDIT_FLAGS]);
and rta_getattr_u64 instead of RTA_DATA.
> +
> + if (*flags & SKBEDIT_F_INHERITDSFIELD)
> + print_null(PRINT_ANY, "inheritdsfield", " %s",
> + "inheritdsfield");
> + }
>
> print_action_control(f, " ", p->action, "");
>
>
^ permalink raw reply
* Re: [PATCH net-next 0/3] tcp: improve setsockopt() TCP_USER_TIMEOUT accuracy
From: Jonathan Maxwell @ 2018-07-18 2:57 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, Eric Dumazet, Neal Cardwell, David Laight, kuznet,
yoshfuji, Netdev, LKML, Jon Maxwell
In-Reply-To: <4cd4429d-bca6-8b3d-1dd2-ef7f4cd102b7@gmail.com>
Okay I see what you mean looking some examples on:
https://patchwork.ozlabs.org/project/netdev/list/
I'll resubmit with the correct patch series numbers but with
the same detailed description.
On Wed, Jul 18, 2018 at 12:40 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
> On 07/17/2018 06:55 PM, Jonathan Maxwell wrote:
>> After committing the patches in my net-next git branch I used git send-mail:
>>
>> git send-email --identity=XXX --cover-letter --annotate origin
>> --compose --signoff
>>
>> and manually updated it based on an example of yours:
>>
>> https://lwn.net/Articles/706491/
>>
>> I can see the 3 patches that I just submitted on:
>>
>> https://patchwork.ozlabs.org/project/netdev/list/
>>
>> Flagged as under review by DaveM.
>>
>
> I dunno, each patch belongs to a separate patch series, this is not expected.
>
> Compare to what happens on https://patchwork.ozlabs.org/project/netdev/list/ for a proper submission.
>
> If you click on https://patchwork.ozlabs.org/project/netdev/list/?series=56100 for example,
> you can see 5 patch in a series.
>
> Standard workflow :
>
> git-format-patch ...
>
> <edit cover letter>
>
> git send-email --to "David S. Miller <davem@davemloft.net>" \
> --cc "netdev <netdev@vger.kernel.org>" \
> --cc "Eric Dumazet <edumazet@google.com>" \
> 00*
^ permalink raw reply
* Re: [PATCH iproute2-next v10] Add support for CAKE qdisc
From: David Ahern @ 2018-07-18 2:31 UTC (permalink / raw)
To: Toke Høiland-Jørgensen, netdev; +Cc: cake, Dave Taht
In-Reply-To: <20180716163926.4826-1-toke@toke.dk>
On 7/16/18 10:39 AM, Toke Høiland-Jørgensen wrote:
> +static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv,
> + struct nlmsghdr *n, const char *dev)
> +{
> + int unlimited = 0;
> + __u64 bandwidth = 0;
> + unsigned interval = 0;
> + unsigned target = 0;
> + unsigned diffserv = 0;
> + unsigned memlimit = 0;
> + int overhead = 0;
> + bool overhead_set = false;
> + bool overhead_override = false;
> + int mpu = 0;
> + int flowmode = -1;
> + int nat = -1;
> + int atm = -1;
> + int autorate = -1;
> + int wash = -1;
> + int ingress = -1;
> + int ack_filter = -1;
> + struct rtattr *tail;
> + struct cake_preset *preset, *preset_set = NULL;
For consistency, please use reverse xmas tree like the net code.
> +
> + while (argc > 0) {
> + if (strcmp(*argv, "bandwidth") == 0) {
> + NEXT_ARG();
> + if (get_rate64(&bandwidth, *argv)) {
> + fprintf(stderr, "Illegal \"bandwidth\"\n");
> + return -1;
> + }
> + unlimited = 0;
> + autorate = 0;
> + } else if (strcmp(*argv, "unlimited") == 0) {
> + bandwidth = 0;
> + unlimited = 1;
> + autorate = 0;
> + } else if (strcmp(*argv, "autorate_ingress") == 0) {
> + autorate = 1;
> +
for consistency, drop the extra newline.
> + } else if (strcmp(*argv, "rtt") == 0) {
> + NEXT_ARG();
> + if (get_time(&interval, *argv)) {
> + fprintf(stderr, "Illegal \"rtt\"\n");
> + return -1;
> + }
> + target = interval / 20;
> + if(!target)
space between 'if('
> + target = 1;
> + } else if ((preset = find_preset(*argv))) {
> + if (preset_set)
> + duparg(*argv, preset_set->name);
> + preset_set = preset;
> + target = preset->target;
> + interval = preset->interval;
> +
extra newline here and many more below. Be consistent with the option list.
> + } else if (strcmp(*argv, "besteffort") == 0) {
> + diffserv = CAKE_DIFFSERV_BESTEFFORT;
> + } else if (strcmp(*argv, "precedence") == 0) {
> + diffserv = CAKE_DIFFSERV_PRECEDENCE;
> + } else if (strcmp(*argv, "diffserv8") == 0) {
> + diffserv = CAKE_DIFFSERV_DIFFSERV8;
> + } else if (strcmp(*argv, "diffserv4") == 0) {
> + diffserv = CAKE_DIFFSERV_DIFFSERV4;
> + } else if (strcmp(*argv, "diffserv") == 0) {
> + diffserv = CAKE_DIFFSERV_DIFFSERV4;
> + } else if (strcmp(*argv, "diffserv3") == 0) {
> + diffserv = CAKE_DIFFSERV_DIFFSERV3;
> +
> + } else if (strcmp(*argv, "nowash") == 0) {
> + wash = 0;
...
> +
> + tail = NLMSG_TAIL(n);
> + addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
> + if (bandwidth || unlimited)
> + addattr_l(n, 1024, TCA_CAKE_BASE_RATE64, &bandwidth, sizeof(bandwidth));
> + if (diffserv)
> + addattr_l(n, 1024, TCA_CAKE_DIFFSERV_MODE, &diffserv, sizeof(diffserv));
> + if (atm != -1)
> + addattr_l(n, 1024, TCA_CAKE_ATM, &atm, sizeof(atm));
> + if (flowmode != -1)
> + addattr_l(n, 1024, TCA_CAKE_FLOW_MODE, &flowmode, sizeof(flowmode));
> + if (overhead_set)
> + addattr_l(n, 1024, TCA_CAKE_OVERHEAD, &overhead, sizeof(overhead));
> + if (overhead_override) {
> + unsigned zero = 0;
> + addattr_l(n, 1024, TCA_CAKE_RAW, &zero, sizeof(zero));
> + }
> + if (mpu > 0)
> + addattr_l(n, 1024, TCA_CAKE_MPU, &mpu, sizeof(mpu));
> + if (interval)
> + addattr_l(n, 1024, TCA_CAKE_RTT, &interval, sizeof(interval));
> + if (target)
> + addattr_l(n, 1024, TCA_CAKE_TARGET, &target, sizeof(target));
> + if (autorate != -1)
> + addattr_l(n, 1024, TCA_CAKE_AUTORATE, &autorate, sizeof(autorate));
> + if (memlimit)
> + addattr_l(n, 1024, TCA_CAKE_MEMORY, &memlimit, sizeof(memlimit));
> + if (nat != -1)
> + addattr_l(n, 1024, TCA_CAKE_NAT, &nat, sizeof(nat));
> + if (wash != -1)
> + addattr_l(n, 1024, TCA_CAKE_WASH, &wash, sizeof(wash));
> + if (ingress != -1)
> + addattr_l(n, 1024, TCA_CAKE_INGRESS, &ingress, sizeof(ingress));
> + if (ack_filter != -1)
> + addattr_l(n, 1024, TCA_CAKE_ACK_FILTER, &ack_filter, sizeof(ack_filter));
there are a number of lines > 80 columns as well. violating for user
messages is fine, but the above needs to be wrapped.
> +
> + tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
> + return 0;
> +}
> +
> +
extra newline
> +static int cake_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
> +{
> + struct rtattr *tb[TCA_CAKE_MAX + 1];
> + __u64 bandwidth = 0;
> + unsigned diffserv = 0;
> + unsigned flowmode = 0;
> + unsigned interval = 0;
> + unsigned memlimit = 0;
> + int overhead = 0;
> + int raw = 0;
> + int mpu = 0;
> + int atm = 0;
> + int nat = 0;
> + int autorate = 0;
> + int wash = 0;
> + int ingress = 0;
> + int ack_filter = 0;
> + int split_gso = 0;
> + SPRINT_BUF(b1);
> + SPRINT_BUF(b2);
> +
> + if (opt == NULL)
> + return 0;
> +
> + parse_rtattr_nested(tb, TCA_CAKE_MAX, opt);
> +
> + if (tb[TCA_CAKE_BASE_RATE64] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_BASE_RATE64]) >= sizeof(bandwidth)) {
> + bandwidth = rta_getattr_u64(tb[TCA_CAKE_BASE_RATE64]);
> + if(bandwidth) {
space between 'if('. There a number of these throughout the file. please
fix them all. I have git am configured to run checkpatch; it tells you
what needs to be fixed.
> + print_uint(PRINT_JSON, "bandwidth", NULL, bandwidth);
> + print_string(PRINT_FP, NULL, "bandwidth %s ", sprint_rate(bandwidth, b1));
> + } else
> + print_string(PRINT_ANY, "bandwidth", "bandwidth %s ", "unlimited");
> + }
> + if (tb[TCA_CAKE_AUTORATE] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_AUTORATE]) >= sizeof(__u32)) {
> + autorate = rta_getattr_u32(tb[TCA_CAKE_AUTORATE]);
> + if(autorate == 1)
> + print_string(PRINT_ANY, "autorate", "autorate_%s ", "ingress");
> + else if(autorate)
> + print_string(PRINT_ANY, "autorate", "(?autorate?) ", "unknown");
Why the '(?' and '?)'? here and the diffserv below.
> + }
> + if (tb[TCA_CAKE_DIFFSERV_MODE] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_DIFFSERV_MODE]) >= sizeof(__u32)) {
> + diffserv = rta_getattr_u32(tb[TCA_CAKE_DIFFSERV_MODE]);
> + switch(diffserv) {
> + case CAKE_DIFFSERV_DIFFSERV3:
> + print_string(PRINT_ANY, "diffserv", "%s ", "diffserv3");
> + break;
> + case CAKE_DIFFSERV_DIFFSERV4:
> + print_string(PRINT_ANY, "diffserv", "%s ", "diffserv4");
> + break;
> + case CAKE_DIFFSERV_DIFFSERV8:
> + print_string(PRINT_ANY, "diffserv", "%s ", "diffserv8");
> + break;
> + case CAKE_DIFFSERV_BESTEFFORT:
> + print_string(PRINT_ANY, "diffserv", "%s ", "besteffort");
> + break;
> + case CAKE_DIFFSERV_PRECEDENCE:
> + print_string(PRINT_ANY, "diffserv", "%s ", "precedence");
> + break;
> + default:
> + print_string(PRINT_ANY, "diffserv", "(?diffserv?) ", "unknown");
> + break;
> + };
The diffserv and flowmode below could both be simplified using a helper,
e.g., cake_print_diffsev, and an array of strings indexed by the value.
> + }
> + if (tb[TCA_CAKE_FLOW_MODE] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_FLOW_MODE]) >= sizeof(__u32)) {
> + flowmode = rta_getattr_u32(tb[TCA_CAKE_FLOW_MODE]);
> + switch(flowmode) {
> + case CAKE_FLOW_NONE:
> + print_string(PRINT_ANY, "flowmode", "%s ", "flowblind");
> + break;
> + case CAKE_FLOW_SRC_IP:
> + print_string(PRINT_ANY, "flowmode", "%s ", "srchost");
> + break;
> + case CAKE_FLOW_DST_IP:
> + print_string(PRINT_ANY, "flowmode", "%s ", "dsthost");
> + break;
> + case CAKE_FLOW_HOSTS:
> + print_string(PRINT_ANY, "flowmode", "%s ", "hosts");
> + break;
> + case CAKE_FLOW_FLOWS:
> + print_string(PRINT_ANY, "flowmode", "%s ", "flows");
> + break;
> + case CAKE_FLOW_DUAL_SRC:
> + print_string(PRINT_ANY, "flowmode", "%s ", "dual-srchost");
> + break;
> + case CAKE_FLOW_DUAL_DST:
> + print_string(PRINT_ANY, "flowmode", "%s ", "dual-dsthost");
> + break;
> + case CAKE_FLOW_TRIPLE:
> + print_string(PRINT_ANY, "flowmode", "%s ", "triple-isolate");
> + break;
> + default:
> + print_string(PRINT_ANY, "flowmode", "(?flowmode?) ", "unknown");
> + break;
> + };
> +
extra newline. check the whole file for these.
> + }
> +
> + if (tb[TCA_CAKE_NAT] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_NAT]) >= sizeof(__u32)) {
> + nat = rta_getattr_u32(tb[TCA_CAKE_NAT]);
> + }
> +
> + if(nat)
> + print_string(PRINT_FP, NULL, "nat ", NULL);
> + print_bool(PRINT_JSON, "nat", NULL, nat);
why is the fp print under the if check but the json one is not? you have
this in a number of places. Why not be consistent in the output?
> +
> + if (tb[TCA_CAKE_WASH] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_WASH]) >= sizeof(__u32)) {
> + wash = rta_getattr_u32(tb[TCA_CAKE_WASH]);
> + }
> + if (tb[TCA_CAKE_ATM] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_ATM]) >= sizeof(__u32)) {
> + atm = rta_getattr_u32(tb[TCA_CAKE_ATM]);
> + }
> + if (tb[TCA_CAKE_OVERHEAD] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_OVERHEAD]) >= sizeof(__s32)) {
> + overhead = *(__s32 *) RTA_DATA(tb[TCA_CAKE_OVERHEAD]);
> + }
> + if (tb[TCA_CAKE_MPU] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_MPU]) >= sizeof(__u32)) {
> + mpu = rta_getattr_u32(tb[TCA_CAKE_MPU]);
> + }
> + if (tb[TCA_CAKE_INGRESS] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_INGRESS]) >= sizeof(__u32)) {
> + ingress = rta_getattr_u32(tb[TCA_CAKE_INGRESS]);
> + }
> + if (tb[TCA_CAKE_ACK_FILTER] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_ACK_FILTER]) >= sizeof(__u32)) {
> + ack_filter = rta_getattr_u32(tb[TCA_CAKE_ACK_FILTER]);
> + }
> + if (tb[TCA_CAKE_SPLIT_GSO] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_SPLIT_GSO]) >= sizeof(__u32)) {
> + split_gso = rta_getattr_u32(tb[TCA_CAKE_SPLIT_GSO]);
> + }
> + if (tb[TCA_CAKE_RAW]) {
> + raw = 1;
> + }
It would be better to kee this with its use below.
> + if (tb[TCA_CAKE_RTT] &&
> + RTA_PAYLOAD(tb[TCA_CAKE_RTT]) >= sizeof(__u32)) {
> + interval = rta_getattr_u32(tb[TCA_CAKE_RTT]);
> + }
> +
> + if (wash)
> + print_string(PRINT_FP, NULL, "wash ", NULL);
> + print_bool(PRINT_JSON, "wash", NULL, wash);
> +
> + if (ingress)
> + print_string(PRINT_FP, NULL, "ingress ", NULL);
> + print_bool(PRINT_JSON, "ingress", NULL, ingress);
> +
> + if (ack_filter == CAKE_ACK_AGGRESSIVE)
> + print_string(PRINT_ANY, "ack-filter", "ack-filter-%s ", "aggressive");
> + else if (ack_filter == CAKE_ACK_FILTER)
> + print_string(PRINT_ANY, "ack-filter", "ack-filter ", "enabled");
> + else
> + print_string(PRINT_JSON, "ack-filter", NULL, "disabled");
> +
> + if (split_gso)
> + print_string(PRINT_FP, NULL, "split-gso ", NULL);
> + print_bool(PRINT_JSON, "split_gso", NULL, split_gso);
> +
> + if (interval)
> + print_string(PRINT_FP, NULL, "rtt %s ", sprint_time(interval, b2));
> + print_uint(PRINT_JSON, "rtt", NULL, interval);
> +
> + if (raw)
> + print_string(PRINT_FP, NULL, "raw ", NULL);
> + print_bool(PRINT_JSON, "raw", NULL, raw);
> +
> + if (atm == CAKE_ATM_ATM)
> + print_string(PRINT_ANY, "atm", "%s ", "atm");
> + else if (atm == CAKE_ATM_PTM)
> + print_string(PRINT_ANY, "atm", "%s ", "ptm");
> + else if (!raw)
> + print_string(PRINT_ANY, "atm", "%s ", "noatm");
> +
> + print_int(PRINT_ANY, "overhead", "overhead %d ", overhead);
> +
> + if (mpu)
> + print_uint(PRINT_ANY, "mpu", "mpu %u ", mpu);
> +
> + if (memlimit) {
> + print_uint(PRINT_JSON, "memlimit", NULL, memlimit);
> + print_string(PRINT_FP, NULL, "memlimit %s", sprint_size(memlimit, b1));
> + }
> +
> + return 0;
> +}
> +
> +static void cake_print_json_tin(struct rtattr **tstat)
> +{
> +#define PRINT_TSTAT_JSON(type, name, attr) if (tstat[TCA_CAKE_TIN_STATS_ ## attr]) \
> + print_u64(PRINT_JSON, name, NULL, \
> + rta_getattr_ ## type((struct rtattr *)tstat[TCA_CAKE_TIN_STATS_ ## attr]))
> +
> + open_json_object(NULL);
> + PRINT_TSTAT_JSON(u64, "threshold_rate", THRESHOLD_RATE64);
> + PRINT_TSTAT_JSON(u64, "sent_bytes", SENT_BYTES64);
> + PRINT_TSTAT_JSON(u32, "backlog_bytes", BACKLOG_BYTES);
> + PRINT_TSTAT_JSON(u32, "target_us", TARGET_US);
> + PRINT_TSTAT_JSON(u32, "interval_us", INTERVAL_US);
> + PRINT_TSTAT_JSON(u32, "peak_delay_us", PEAK_DELAY_US);
> + PRINT_TSTAT_JSON(u32, "avg_delay_us", AVG_DELAY_US);
> + PRINT_TSTAT_JSON(u32, "base_delay_us", BASE_DELAY_US);
> + PRINT_TSTAT_JSON(u32, "sent_packets", SENT_PACKETS);
> + PRINT_TSTAT_JSON(u32, "way_indirect_hits", WAY_INDIRECT_HITS);
> + PRINT_TSTAT_JSON(u32, "way_misses", WAY_MISSES);
> + PRINT_TSTAT_JSON(u32, "way_collisions", WAY_COLLISIONS);
> + PRINT_TSTAT_JSON(u32, "drops", DROPPED_PACKETS);
> + PRINT_TSTAT_JSON(u32, "ecn_mark", ECN_MARKED_PACKETS);
> + PRINT_TSTAT_JSON(u32, "ack_drops", ACKS_DROPPED_PACKETS);
> + PRINT_TSTAT_JSON(u32, "sparse_flows", SPARSE_FLOWS);
> + PRINT_TSTAT_JSON(u32, "bulk_flows", BULK_FLOWS);
> + PRINT_TSTAT_JSON(u32, "unresponsive_flows", UNRESPONSIVE_FLOWS);
> + PRINT_TSTAT_JSON(u32, "max_pkt_len", MAX_SKBLEN);
> + PRINT_TSTAT_JSON(u32, "flow_quantum", FLOW_QUANTUM);
> + close_json_object();
> +
> +#undef PRINT_TSTAT_JSON
> +}
> +
> +static int cake_print_xstats(struct qdisc_util *qu, FILE *f,
> + struct rtattr *xstats)
> +{
> + SPRINT_BUF(b1);
> + struct rtattr *st[TCA_CAKE_STATS_MAX + 1];
> + int i;
> +
> + if (xstats == NULL)
> + return 0;
> +
> +#define GET_STAT_U32(attr) rta_getattr_u32(st[TCA_CAKE_STATS_ ## attr])
> +#define GET_STAT_S32(attr) (*(__s32*)RTA_DATA(st[TCA_CAKE_STATS_ ## attr]))
> +#define GET_STAT_U64(attr) rta_getattr_u64(st[TCA_CAKE_STATS_ ## attr])
> +
> + parse_rtattr_nested(st, TCA_CAKE_STATS_MAX, xstats);
> +
> + if (st[TCA_CAKE_STATS_MEMORY_USED] &&
> + st[TCA_CAKE_STATS_MEMORY_LIMIT]) {
> + print_string(PRINT_FP, NULL, " memory used: %s",
> + sprint_size(GET_STAT_U32(MEMORY_USED), b1));
> +
> + print_string(PRINT_FP, NULL, " of %s\n",
> + sprint_size(GET_STAT_U32(MEMORY_LIMIT), b1));
> +
> + print_uint(PRINT_JSON, "memory_used", NULL,
> + GET_STAT_U32(MEMORY_USED));
> + print_uint(PRINT_JSON, "memory_limit", NULL,
> + GET_STAT_U32(MEMORY_LIMIT));
> + }
> +
> + if (st[TCA_CAKE_STATS_CAPACITY_ESTIMATE64]) {
> + print_string(PRINT_FP, NULL, " capacity estimate: %s\n",
> + sprint_rate(GET_STAT_U64(CAPACITY_ESTIMATE64), b1));
> + print_uint(PRINT_JSON, "capacity_estimate", NULL,
> + GET_STAT_U64(CAPACITY_ESTIMATE64));
> + }
> +
> + if (st[TCA_CAKE_STATS_MIN_NETLEN] &&
> + st[TCA_CAKE_STATS_MAX_NETLEN]) {
> + print_uint(PRINT_ANY, "min_network_size",
> + " min/max network layer size: %12u",
> + GET_STAT_U32(MIN_NETLEN));
> + print_uint(PRINT_ANY, "max_network_size",
> + " /%8u\n", GET_STAT_U32(MAX_NETLEN));
> + }
> +
> + if (st[TCA_CAKE_STATS_MIN_ADJLEN] &&
> + st[TCA_CAKE_STATS_MAX_ADJLEN]) {
> + print_uint(PRINT_ANY, "min_adj_size",
> + " min/max overhead-adjusted size: %8u",
> + GET_STAT_U32(MIN_ADJLEN));
> + print_uint(PRINT_ANY, "max_adj_size",
> + " /%8u\n", GET_STAT_U32(MAX_ADJLEN));
> + }
> +
> + if (st[TCA_CAKE_STATS_AVG_NETOFF])
> + print_uint(PRINT_ANY, "avg_hdr_offset",
> + " average network hdr offset: %12u\n\n",
> + GET_STAT_U32(AVG_NETOFF));
> +
> + /* class stats */
> + if (st[TCA_CAKE_STATS_DEFICIT])
> + print_int(PRINT_ANY, "deficit", " deficit %u",
> + GET_STAT_S32(DEFICIT));
> + if (st[TCA_CAKE_STATS_COBALT_COUNT])
> + print_uint(PRINT_ANY, "count", " count %u",
> + GET_STAT_U32(COBALT_COUNT));
> +
> + if (st[TCA_CAKE_STATS_DROPPING] && GET_STAT_U32(DROPPING)) {
> + print_bool(PRINT_ANY, "dropping", " dropping", true);
> + if (st[TCA_CAKE_STATS_DROP_NEXT_US]) {
> + int drop_next = GET_STAT_S32(DROP_NEXT_US);
> + if (drop_next < 0) {
> + print_string(PRINT_FP, NULL, " drop_next -%s",
> + sprint_time(drop_next, b1));
> + } else {
> + print_uint(PRINT_JSON, "drop_next", NULL,
> + drop_next);
> + print_string(PRINT_FP, NULL, " drop_next %s",
> + sprint_time(drop_next, b1));
> + }
> + }
> + }
> +
> + if (st[TCA_CAKE_STATS_P_DROP]) {
> + print_uint(PRINT_ANY, "blue_prob", " blue_prob %u",
> + GET_STAT_U32(P_DROP));
> + if (st[TCA_CAKE_STATS_BLUE_TIMER_US]) {
> + int blue_timer = GET_STAT_S32(BLUE_TIMER_US);
> + if (blue_timer < 0) {
> + print_string(PRINT_FP, NULL, " blue_timer -%s",
> + sprint_time(blue_timer, b1));
> + } else {
> + print_uint(PRINT_JSON, "blue_timer", NULL,
> + blue_timer);
> + print_string(PRINT_FP, NULL, " blue_timer %s",
> + sprint_time(blue_timer, b1));
> + }
> + }
> + }
> +
> +#undef GET_STAT_U32
> +#undef GET_STAT_S32
> +#undef GET_STAT_U64
> +
> + if (st[TCA_CAKE_STATS_TIN_STATS]) {
> + struct rtattr *tins[TC_CAKE_MAX_TINS + 1];
> + struct rtattr *tstat[TC_CAKE_MAX_TINS][TCA_CAKE_TIN_STATS_MAX + 1];
> + int num_tins = 0;
> +
> + parse_rtattr_nested(tins, TC_CAKE_MAX_TINS, st[TCA_CAKE_STATS_TIN_STATS]);
> +
> + for (i = 1; i <= TC_CAKE_MAX_TINS && tins[i]; i++) {
> + parse_rtattr_nested(tstat[i-1], TCA_CAKE_TIN_STATS_MAX, tins[i]);
> + num_tins++;
> + }
> +
> + if (!num_tins)
> + return 0;
> +
> + if (is_json_context()) {
> + open_json_array(PRINT_JSON, "tins");
> + for (i = 0; i < num_tins; i++)
> + cake_print_json_tin(tstat[i]);
> + close_json_array(PRINT_JSON, NULL);
> +
> + return 0;
> + }
> +
> +
> + switch(num_tins) {
> + case 3:
> + fprintf(f, " Bulk Best Effort Voice\n");
> + break;
> +
> + case 4:
> + fprintf(f, " Bulk Best Effort Video Voice\n");
> + break;
> +
> + default:
> + fprintf(f, " ");
> + for(i=0; i < num_tins; i++)
> + fprintf(f, " Tin %u", i);
> + fprintf(f, "\n");
> + };
> +
> +#define GET_TSTAT(i, attr) (tstat[i][TCA_CAKE_TIN_STATS_ ## attr])
> +#define PRINT_TSTAT(name, attr, fmts, val) do { \
> + if (GET_TSTAT(0, attr)) { \
> + fprintf(f, name); \
> + for (i = 0; i < num_tins; i++) \
> + fprintf(f, " %12" fmts, val); \
> + fprintf(f, "\n"); \
> + } \
> + } while (0)
> +
> +#define SPRINT_TSTAT(pfunc, type, name, attr) PRINT_TSTAT( \
> + name, attr, "s", sprint_ ## pfunc( \
> + rta_getattr_ ## type(GET_TSTAT(i, attr)), b1))
> +
> +#define PRINT_TSTAT_U32(name, attr) PRINT_TSTAT( \
> + name, attr, "u", rta_getattr_u32(GET_TSTAT(i, attr)))
> +
> +#define PRINT_TSTAT_U64(name, attr) PRINT_TSTAT( \
> + name, attr, "llu", rta_getattr_u64(GET_TSTAT(i, attr)))
> +
> + SPRINT_TSTAT(rate, u64, " thresh ", THRESHOLD_RATE64);
> + SPRINT_TSTAT(time, u32, " target ", TARGET_US);
> + SPRINT_TSTAT(time, u32, " interval", INTERVAL_US);
> + SPRINT_TSTAT(time, u32, " pk_delay", PEAK_DELAY_US);
> + SPRINT_TSTAT(time, u32, " av_delay", AVG_DELAY_US);
> + SPRINT_TSTAT(time, u32, " sp_delay", BASE_DELAY_US);
> + SPRINT_TSTAT(size, u32, " backlog ", BACKLOG_BYTES);
> +
> + PRINT_TSTAT_U32(" pkts ", SENT_PACKETS);
> + PRINT_TSTAT_U64(" bytes ", SENT_BYTES64);
> +
> + PRINT_TSTAT_U32(" way_inds", WAY_INDIRECT_HITS);
> + PRINT_TSTAT_U32(" way_miss", WAY_MISSES);
> + PRINT_TSTAT_U32(" way_cols", WAY_COLLISIONS);
> + PRINT_TSTAT_U32(" drops ", DROPPED_PACKETS);
> + PRINT_TSTAT_U32(" marks ", ECN_MARKED_PACKETS);
> + PRINT_TSTAT_U32(" ack_drop", ACKS_DROPPED_PACKETS);
> + PRINT_TSTAT_U32(" sp_flows", SPARSE_FLOWS);
> + PRINT_TSTAT_U32(" bk_flows", BULK_FLOWS);
> + PRINT_TSTAT_U32(" un_flows", UNRESPONSIVE_FLOWS);
> + PRINT_TSTAT_U32(" max_len ", MAX_SKBLEN);
> + PRINT_TSTAT_U32(" quantum ", FLOW_QUANTUM);
I do agree that the above is simpler with macros than expanded into
functions.
^ permalink raw reply
* Re: [PATCH iproute2 0/5] Various BPF improvements
From: David Ahern @ 2018-07-18 2:43 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: jakub.kicinski, alexei.starovoitov, netdev
In-Reply-To: <20180717233122.29390-1-daniel@iogearbox.net>
On 7/17/18 5:31 PM, Daniel Borkmann wrote:
> Main part of this set is to: i) avoid strict af_alg kernel dependency,
> ii) add loader support for bpf to bpf calls and iii) add btf loader
> support with an option to annotate maps. For details please see the
> individual patches. Thanks!
>
> Daniel Borkmann (5):
> bpf: import btf uapi kernel header
> bpf: move bpf_elf_map fixup notification under verbose
> bpf: remove strict dependency on af_alg
> bpf: implement bpf to bpf calls support
> bpf: implement btf handling and map annotation
>
> include/bpf_elf.h | 9 +
> include/bpf_util.h | 1 +
> include/uapi/linux/btf.h | 113 +++++++++
> lib/bpf.c | 645 +++++++++++++++++++++++++++++++++++++----------
> 4 files changed, 639 insertions(+), 129 deletions(-)
> create mode 100644 include/uapi/linux/btf.h
>
Applied 2-5 to iproute2-next. Pulled btf.h from the last header sync
point for consistency.
^ permalink raw reply
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