* [PATCH net-next 3/8] tcp: simpler NewReno implementation
From: Yuchung Cheng @ 2018-05-16 23:40 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, ncardwell, soheil, priyarjha, Yuchung Cheng
In-Reply-To: <20180516234017.172775-1-ycheng@google.com>
This is a rewrite of NewReno loss recovery implementation that is
simpler and standalone for readability and better performance by
using less states.
Note that NewReno refers to RFC6582 as a modification to the fast
recovery algorithm. It is used only if the connection does not
support SACK in Linux. It should not to be confused with the Reno
(AIMD) congestion control.
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Priyaranjan Jha <priyarjha@google.com>
---
include/net/tcp.h | 1 +
net/ipv4/tcp_input.c | 19 +++++++++++--------
net/ipv4/tcp_recovery.c | 27 +++++++++++++++++++++++++++
3 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 85000c85ddcd..d7f81325bee5 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1878,6 +1878,7 @@ void tcp_v4_init(void);
void tcp_init(void);
/* tcp_recovery.c */
+void tcp_newreno_mark_lost(struct sock *sk, bool snd_una_advanced);
extern void tcp_rack_mark_lost(struct sock *sk);
extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq,
u64 xmit_time);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index ccbe04f80040..076206873e3e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2223,9 +2223,7 @@ static void tcp_update_scoreboard(struct sock *sk, int fast_rexmit)
{
struct tcp_sock *tp = tcp_sk(sk);
- if (tcp_is_reno(tp)) {
- tcp_mark_head_lost(sk, 1, 1);
- } else {
+ if (tcp_is_sack(tp)) {
int sacked_upto = tp->sacked_out - tp->reordering;
if (sacked_upto >= 0)
tcp_mark_head_lost(sk, sacked_upto, 0);
@@ -2723,11 +2721,16 @@ static bool tcp_try_undo_partial(struct sock *sk, u32 prior_snd_una)
return false;
}
-static void tcp_rack_identify_loss(struct sock *sk, int *ack_flag)
+static void tcp_identify_packet_loss(struct sock *sk, int *ack_flag)
{
struct tcp_sock *tp = tcp_sk(sk);
- if (tcp_is_rack(sk)) {
+ if (tcp_rtx_queue_empty(sk))
+ return;
+
+ if (unlikely(tcp_is_reno(tp))) {
+ tcp_newreno_mark_lost(sk, *ack_flag & FLAG_SND_UNA_ADVANCED);
+ } else if (tcp_is_rack(sk)) {
u32 prior_retrans = tp->retrans_out;
tcp_rack_mark_lost(sk);
@@ -2823,11 +2826,11 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una,
tcp_try_keep_open(sk);
return;
}
- tcp_rack_identify_loss(sk, ack_flag);
+ tcp_identify_packet_loss(sk, ack_flag);
break;
case TCP_CA_Loss:
tcp_process_loss(sk, flag, is_dupack, rexmit);
- tcp_rack_identify_loss(sk, ack_flag);
+ tcp_identify_packet_loss(sk, ack_flag);
if (!(icsk->icsk_ca_state == TCP_CA_Open ||
(*ack_flag & FLAG_LOST_RETRANS)))
return;
@@ -2844,7 +2847,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una,
if (icsk->icsk_ca_state <= TCP_CA_Disorder)
tcp_try_undo_dsack(sk);
- tcp_rack_identify_loss(sk, ack_flag);
+ tcp_identify_packet_loss(sk, ack_flag);
if (!tcp_time_to_recover(sk, flag)) {
tcp_try_to_open(sk, flag);
return;
diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c
index 1c1bdf12a96f..299b0e38aa9a 100644
--- a/net/ipv4/tcp_recovery.c
+++ b/net/ipv4/tcp_recovery.c
@@ -216,3 +216,30 @@ void tcp_rack_update_reo_wnd(struct sock *sk, struct rate_sample *rs)
tp->rack.reo_wnd_steps = 1;
}
}
+
+/* RFC6582 NewReno recovery for non-SACK connection. It simply retransmits
+ * the next unacked packet upon receiving
+ * a) three or more DUPACKs to start the fast recovery
+ * b) an ACK acknowledging new data during the fast recovery.
+ */
+void tcp_newreno_mark_lost(struct sock *sk, bool snd_una_advanced)
+{
+ const u8 state = inet_csk(sk)->icsk_ca_state;
+ struct tcp_sock *tp = tcp_sk(sk);
+
+ if ((state < TCP_CA_Recovery && tp->sacked_out >= tp->reordering) ||
+ (state == TCP_CA_Recovery && snd_una_advanced)) {
+ struct sk_buff *skb = tcp_rtx_queue_head(sk);
+ u32 mss;
+
+ if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST)
+ return;
+
+ mss = tcp_skb_mss(skb);
+ if (tcp_skb_pcount(skb) > 1 && skb->len > mss)
+ tcp_fragment(sk, TCP_FRAG_IN_RTX_QUEUE, skb,
+ mss, mss, GFP_ATOMIC);
+
+ tcp_skb_mark_lost_uncond_verify(tp, skb);
+ }
+}
--
2.17.0.441.gb46fe60e1d-goog
^ permalink raw reply related
* [PATCH net-next 4/8] tcp: account lost retransmit after timeout
From: Yuchung Cheng @ 2018-05-16 23:40 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, ncardwell, soheil, priyarjha, Yuchung Cheng
In-Reply-To: <20180516234017.172775-1-ycheng@google.com>
The previous approach for the lost and retransmit bits was to
wipe the slate clean: zero all the lost and retransmit bits,
correspondingly zero the lost_out and retrans_out counters, and
then add back the lost bits (and correspondingly increment lost_out).
The new approach is to treat this very much like marking packets
lost in fast recovery. We don’t wipe the slate clean. We just say
that for all packets that were not yet marked sacked or lost, we now
mark them as lost in exactly the same way we do for fast recovery.
This fixes the lost retransmit accounting at RTO time and greatly
simplifies the RTO code by sharing much of the logic with Fast
Recovery.
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Priyaranjan Jha <priyarjha@google.com>
---
include/net/tcp.h | 1 +
net/ipv4/tcp_input.c | 18 +++---------------
net/ipv4/tcp_recovery.c | 4 ++--
3 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index d7f81325bee5..402484ed9b57 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1878,6 +1878,7 @@ void tcp_v4_init(void);
void tcp_init(void);
/* tcp_recovery.c */
+void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb);
void tcp_newreno_mark_lost(struct sock *sk, bool snd_una_advanced);
extern void tcp_rack_mark_lost(struct sock *sk);
extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq,
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 076206873e3e..6fb0a28977a0 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1929,7 +1929,6 @@ void tcp_enter_loss(struct sock *sk)
struct sk_buff *skb;
bool new_recovery = icsk->icsk_ca_state < TCP_CA_Recovery;
bool is_reneg; /* is receiver reneging on SACKs? */
- bool mark_lost;
/* Reduce ssthresh if it has not yet been made inside this window. */
if (icsk->icsk_ca_state <= TCP_CA_Disorder ||
@@ -1945,9 +1944,6 @@ void tcp_enter_loss(struct sock *sk)
tp->snd_cwnd_cnt = 0;
tp->snd_cwnd_stamp = tcp_jiffies32;
- tp->retrans_out = 0;
- tp->lost_out = 0;
-
if (tcp_is_reno(tp))
tcp_reset_reno_sack(tp);
@@ -1959,21 +1955,13 @@ void tcp_enter_loss(struct sock *sk)
/* Mark SACK reneging until we recover from this loss event. */
tp->is_sack_reneg = 1;
}
- tcp_clear_all_retrans_hints(tp);
-
skb_rbtree_walk_from(skb) {
- mark_lost = (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) ||
- is_reneg);
- if (mark_lost)
- tcp_sum_lost(tp, skb);
- TCP_SKB_CB(skb)->sacked &= (~TCPCB_TAGBITS)|TCPCB_SACKED_ACKED;
- if (mark_lost) {
+ if (is_reneg)
TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_ACKED;
- TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
- tp->lost_out += tcp_skb_pcount(skb);
- }
+ tcp_mark_skb_lost(sk, skb);
}
tcp_verify_left_out(tp);
+ tcp_clear_all_retrans_hints(tp);
/* Timeout in disordered state after receiving substantial DUPACKs
* suggests that the degree of reordering is over-estimated.
diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c
index 299b0e38aa9a..b2f9be388bf3 100644
--- a/net/ipv4/tcp_recovery.c
+++ b/net/ipv4/tcp_recovery.c
@@ -2,7 +2,7 @@
#include <linux/tcp.h>
#include <net/tcp.h>
-static void tcp_rack_mark_skb_lost(struct sock *sk, struct sk_buff *skb)
+void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb)
{
struct tcp_sock *tp = tcp_sk(sk);
@@ -95,7 +95,7 @@ static void tcp_rack_detect_loss(struct sock *sk, u32 *reo_timeout)
remaining = tp->rack.rtt_us + reo_wnd -
tcp_stamp_us_delta(tp->tcp_mstamp, skb->skb_mstamp);
if (remaining <= 0) {
- tcp_rack_mark_skb_lost(sk, skb);
+ tcp_mark_skb_lost(sk, skb);
list_del_init(&skb->tcp_tsorted_anchor);
} else {
/* Record maximum wait time */
--
2.17.0.441.gb46fe60e1d-goog
^ permalink raw reply related
* [PATCH net-next 5/8] tcp: new helper tcp_timeout_mark_lost
From: Yuchung Cheng @ 2018-05-16 23:40 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, ncardwell, soheil, priyarjha, Yuchung Cheng
In-Reply-To: <20180516234017.172775-1-ycheng@google.com>
Refactor using a new helper, tcp_timeout_mark_loss(), that marks packets
lost upon RTO.
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Priyaranjan Jha <priyarjha@google.com>
---
net/ipv4/tcp_input.c | 50 +++++++++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 21 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 6fb0a28977a0..af32accda2a9 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1917,18 +1917,43 @@ static inline void tcp_init_undo(struct tcp_sock *tp)
tp->undo_retrans = tp->retrans_out ? : -1;
}
-/* Enter Loss state. If we detect SACK reneging, forget all SACK information
+/* If we detect SACK reneging, forget all SACK information
* and reset tags completely, otherwise preserve SACKs. If receiver
* dropped its ofo queue, we will know this due to reneging detection.
*/
+static void tcp_timeout_mark_lost(struct sock *sk)
+{
+ struct tcp_sock *tp = tcp_sk(sk);
+ struct sk_buff *skb;
+ bool is_reneg; /* is receiver reneging on SACKs? */
+
+ skb = tcp_rtx_queue_head(sk);
+ is_reneg = skb && (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED);
+ if (is_reneg) {
+ NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSACKRENEGING);
+ tp->sacked_out = 0;
+ /* Mark SACK reneging until we recover from this loss event. */
+ tp->is_sack_reneg = 1;
+ } else if (tcp_is_reno(tp)) {
+ tcp_reset_reno_sack(tp);
+ }
+
+ skb_rbtree_walk_from(skb) {
+ if (is_reneg)
+ TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_ACKED;
+ tcp_mark_skb_lost(sk, skb);
+ }
+ tcp_verify_left_out(tp);
+ tcp_clear_all_retrans_hints(tp);
+}
+
+/* Enter Loss state. */
void tcp_enter_loss(struct sock *sk)
{
const struct inet_connection_sock *icsk = inet_csk(sk);
struct tcp_sock *tp = tcp_sk(sk);
struct net *net = sock_net(sk);
- struct sk_buff *skb;
bool new_recovery = icsk->icsk_ca_state < TCP_CA_Recovery;
- bool is_reneg; /* is receiver reneging on SACKs? */
/* Reduce ssthresh if it has not yet been made inside this window. */
if (icsk->icsk_ca_state <= TCP_CA_Disorder ||
@@ -1944,24 +1969,7 @@ void tcp_enter_loss(struct sock *sk)
tp->snd_cwnd_cnt = 0;
tp->snd_cwnd_stamp = tcp_jiffies32;
- if (tcp_is_reno(tp))
- tcp_reset_reno_sack(tp);
-
- skb = tcp_rtx_queue_head(sk);
- is_reneg = skb && (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED);
- if (is_reneg) {
- NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSACKRENEGING);
- tp->sacked_out = 0;
- /* Mark SACK reneging until we recover from this loss event. */
- tp->is_sack_reneg = 1;
- }
- skb_rbtree_walk_from(skb) {
- if (is_reneg)
- TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_ACKED;
- tcp_mark_skb_lost(sk, skb);
- }
- tcp_verify_left_out(tp);
- tcp_clear_all_retrans_hints(tp);
+ tcp_timeout_mark_lost(sk);
/* Timeout in disordered state after receiving substantial DUPACKs
* suggests that the degree of reordering is over-estimated.
--
2.17.0.441.gb46fe60e1d-goog
^ permalink raw reply related
* [PATCH net-next 6/8] tcp: separate loss marking and state update on RTO
From: Yuchung Cheng @ 2018-05-16 23:40 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, ncardwell, soheil, priyarjha, Yuchung Cheng
In-Reply-To: <20180516234017.172775-1-ycheng@google.com>
Previously when TCP times out, it first updates cwnd and ssthresh,
marks packets lost, and then updates congestion state again. This
was fine because everything not yet delivered is marked lost,
so the inflight is always 0 and cwnd can be safely set to 1 to
retransmit one packet on timeout.
But the inflight may not always be 0 on timeout if TCP changes to
mark packets lost based on packet sent time. Therefore we must
first mark the packet lost, then set the cwnd based on the
(updated) inflight.
This is not a pure refactor. Congestion control may potentially
break if it uses (not yet updated) inflight to compute ssthresh.
Fortunately all existing congestion control modules does not do that.
Also it changes the inflight when CA_LOSS_EVENT is called, and only
westwood processes such an event but does not use inflight.
This change has two other minor side benefits:
1) consistent with Fast Recovery s.t. the inflight is updated
first before tcp_enter_recovery flips state to CA_Recovery.
2) avoid intertwining loss marking with state update, making the
code more readable.
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Priyaranjan Jha <priyarjha@google.com>
---
net/ipv4/tcp_input.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index af32accda2a9..1ccc97b368c7 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1955,6 +1955,8 @@ void tcp_enter_loss(struct sock *sk)
struct net *net = sock_net(sk);
bool new_recovery = icsk->icsk_ca_state < TCP_CA_Recovery;
+ tcp_timeout_mark_lost(sk);
+
/* Reduce ssthresh if it has not yet been made inside this window. */
if (icsk->icsk_ca_state <= TCP_CA_Disorder ||
!after(tp->high_seq, tp->snd_una) ||
@@ -1969,8 +1971,6 @@ void tcp_enter_loss(struct sock *sk)
tp->snd_cwnd_cnt = 0;
tp->snd_cwnd_stamp = tcp_jiffies32;
- tcp_timeout_mark_lost(sk);
-
/* Timeout in disordered state after receiving substantial DUPACKs
* suggests that the degree of reordering is over-estimated.
*/
--
2.17.0.441.gb46fe60e1d-goog
^ permalink raw reply related
* [PATCH net-next 7/8] tcp: new helper tcp_rack_skb_timeout
From: Yuchung Cheng @ 2018-05-16 23:40 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, ncardwell, soheil, priyarjha, Yuchung Cheng
In-Reply-To: <20180516234017.172775-1-ycheng@google.com>
Create and export a new helper tcp_rack_skb_timeout and move tcp_is_rack
to prepare the final RTO change.
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Priyaranjan Jha <priyarjha@google.com>
---
include/net/tcp.h | 2 ++
net/ipv4/tcp_input.c | 10 +++++-----
net/ipv4/tcp_recovery.c | 9 +++++++--
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 402484ed9b57..b46d0f9adbdb 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1880,6 +1880,8 @@ void tcp_init(void);
/* tcp_recovery.c */
void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb);
void tcp_newreno_mark_lost(struct sock *sk, bool snd_una_advanced);
+extern s32 tcp_rack_skb_timeout(struct tcp_sock *tp, struct sk_buff *skb,
+ u32 reo_wnd);
extern void tcp_rack_mark_lost(struct sock *sk);
extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq,
u64 xmit_time);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 1ccc97b368c7..ba8a8e3464aa 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1917,6 +1917,11 @@ static inline void tcp_init_undo(struct tcp_sock *tp)
tp->undo_retrans = tp->retrans_out ? : -1;
}
+static bool tcp_is_rack(const struct sock *sk)
+{
+ return sock_net(sk)->ipv4.sysctl_tcp_recovery & TCP_RACK_LOSS_DETECTION;
+}
+
/* If we detect SACK reneging, forget all SACK information
* and reset tags completely, otherwise preserve SACKs. If receiver
* dropped its ofo queue, we will know this due to reneging detection.
@@ -2031,11 +2036,6 @@ static inline int tcp_dupack_heuristics(const struct tcp_sock *tp)
return tp->sacked_out + 1;
}
-static bool tcp_is_rack(const struct sock *sk)
-{
- return sock_net(sk)->ipv4.sysctl_tcp_recovery & TCP_RACK_LOSS_DETECTION;
-}
-
/* Linux NewReno/SACK/ECN state machine.
* --------------------------------------
*
diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c
index b2f9be388bf3..30cbfb69b1de 100644
--- a/net/ipv4/tcp_recovery.c
+++ b/net/ipv4/tcp_recovery.c
@@ -47,6 +47,12 @@ u32 tcp_rack_reo_wnd(const struct sock *sk)
tp->srtt_us >> 3);
}
+s32 tcp_rack_skb_timeout(struct tcp_sock *tp, struct sk_buff *skb, u32 reo_wnd)
+{
+ return tp->rack.rtt_us + reo_wnd -
+ tcp_stamp_us_delta(tp->tcp_mstamp, skb->skb_mstamp);
+}
+
/* RACK loss detection (IETF draft draft-ietf-tcpm-rack-01):
*
* Marks a packet lost, if some packet sent later has been (s)acked.
@@ -92,8 +98,7 @@ static void tcp_rack_detect_loss(struct sock *sk, u32 *reo_timeout)
/* A packet is lost if it has not been s/acked beyond
* the recent RTT plus the reordering window.
*/
- remaining = tp->rack.rtt_us + reo_wnd -
- tcp_stamp_us_delta(tp->tcp_mstamp, skb->skb_mstamp);
+ remaining = tcp_rack_skb_timeout(tp, skb, reo_wnd);
if (remaining <= 0) {
tcp_mark_skb_lost(sk, skb);
list_del_init(&skb->tcp_tsorted_anchor);
--
2.17.0.441.gb46fe60e1d-goog
^ permalink raw reply related
* [PATCH net-next 8/8] tcp: don't mark recently sent packets lost on RTO
From: Yuchung Cheng @ 2018-05-16 23:40 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, ncardwell, soheil, priyarjha, Yuchung Cheng
In-Reply-To: <20180516234017.172775-1-ycheng@google.com>
An RTO event indicates the head has not been acked for a long time
after its last (re)transmission. But the other packets are not
necessarily lost if they have been only sent recently (for example
due to application limit). This patch would prohibit marking packets
sent within an RTT to be lost on RTO event, using similar logic in
TCP RACK detection.
Normally the head (SND.UNA) would be marked lost since RTO should
fire strictly after the head was sent. An exception is when the
most recent RACK RTT measurement is larger than the (previous)
RTO. To address this exception the head is always marked lost.
Congestion control interaction: since we may not mark every packet
lost, the congestion window may be more than 1 (inflight plus 1).
But only one packet will be retransmitted after RTO, since
tcp_retransmit_timer() calls tcp_retransmit_skb(...,segs=1). The
connection still performs slow start from one packet (with Cubic
congestion control).
This commit was tested in an A/B test with Google web servers,
and showed a reduction of 2% in (spurious) retransmits post
timeout (SlowStartRetrans), and correspondingly reduced DSACKs
(DSACKIgnoredOld) by 7%.
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Priyaranjan Jha <priyarjha@google.com>
---
net/ipv4/tcp_input.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index ba8a8e3464aa..0bf032839548 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1929,11 +1929,11 @@ static bool tcp_is_rack(const struct sock *sk)
static void tcp_timeout_mark_lost(struct sock *sk)
{
struct tcp_sock *tp = tcp_sk(sk);
- struct sk_buff *skb;
+ struct sk_buff *skb, *head;
bool is_reneg; /* is receiver reneging on SACKs? */
- skb = tcp_rtx_queue_head(sk);
- is_reneg = skb && (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED);
+ head = tcp_rtx_queue_head(sk);
+ is_reneg = head && (TCP_SKB_CB(head)->sacked & TCPCB_SACKED_ACKED);
if (is_reneg) {
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSACKRENEGING);
tp->sacked_out = 0;
@@ -1943,9 +1943,13 @@ static void tcp_timeout_mark_lost(struct sock *sk)
tcp_reset_reno_sack(tp);
}
+ skb = head;
skb_rbtree_walk_from(skb) {
if (is_reneg)
TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_ACKED;
+ else if (tcp_is_rack(sk) && skb != head &&
+ tcp_rack_skb_timeout(tp, skb, 0) > 0)
+ continue; /* Don't mark recently sent ones lost yet */
tcp_mark_skb_lost(sk, skb);
}
tcp_verify_left_out(tp);
@@ -1972,7 +1976,7 @@ void tcp_enter_loss(struct sock *sk)
tcp_ca_event(sk, CA_EVENT_LOSS);
tcp_init_undo(tp);
}
- tp->snd_cwnd = 1;
+ tp->snd_cwnd = tcp_packets_in_flight(tp) + 1;
tp->snd_cwnd_cnt = 0;
tp->snd_cwnd_stamp = tcp_jiffies32;
--
2.17.0.441.gb46fe60e1d-goog
^ permalink raw reply related
* [bpf-next PATCH] bpf: sockmap, on update propagate errors back to userspace
From: John Fastabend @ 2018-05-16 23:38 UTC (permalink / raw)
To: ast, daniel; +Cc: netdev
When an error happens in the update sockmap element logic also pass
the err up to the user.
Fixes: e5cd3abcb31a ("bpf: sockmap, refactor sockmap routines to work with hashmap")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
kernel/bpf/sockmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c
index 79f5e89..c6de139 100644
--- a/kernel/bpf/sockmap.c
+++ b/kernel/bpf/sockmap.c
@@ -1875,7 +1875,7 @@ static int sock_map_ctx_update_elem(struct bpf_sock_ops_kern *skops,
write_unlock_bh(&osock->sk_callback_lock);
}
out:
- return 0;
+ return err;
}
int sock_map_prog(struct bpf_map *map, struct bpf_prog *prog, u32 type)
^ permalink raw reply related
* [PATCH bpf] bpf: fix truncated jump targets on heavy expansions
From: Daniel Borkmann @ 2018-05-16 23:44 UTC (permalink / raw)
To: alexei.starovoitov; +Cc: netdev, Daniel Borkmann
Recently during testing, I ran into the following panic:
[ 207.892422] Internal error: Accessing user space memory outside uaccess.h routines: 96000004 [#1] SMP
[ 207.901637] Modules linked in: binfmt_misc [...]
[ 207.966530] CPU: 45 PID: 2256 Comm: test_verifier Tainted: G W 4.17.0-rc3+ #7
[ 207.974956] Hardware name: FOXCONN R2-1221R-A4/C2U4N_MB, BIOS G31FB18A 03/31/2017
[ 207.982428] pstate: 60400005 (nZCv daif +PAN -UAO)
[ 207.987214] pc : bpf_skb_load_helper_8_no_cache+0x34/0xc0
[ 207.992603] lr : 0xffff000000bdb754
[ 207.996080] sp : ffff000013703ca0
[ 207.999384] x29: ffff000013703ca0 x28: 0000000000000001
[ 208.004688] x27: 0000000000000001 x26: 0000000000000000
[ 208.009992] x25: ffff000013703ce0 x24: ffff800fb4afcb00
[ 208.015295] x23: ffff00007d2f5038 x22: ffff00007d2f5000
[ 208.020599] x21: fffffffffeff2a6f x20: 000000000000000a
[ 208.025903] x19: ffff000009578000 x18: 0000000000000a03
[ 208.031206] x17: 0000000000000000 x16: 0000000000000000
[ 208.036510] x15: 0000ffff9de83000 x14: 0000000000000000
[ 208.041813] x13: 0000000000000000 x12: 0000000000000000
[ 208.047116] x11: 0000000000000001 x10: ffff0000089e7f18
[ 208.052419] x9 : fffffffffeff2a6f x8 : 0000000000000000
[ 208.057723] x7 : 000000000000000a x6 : 00280c6160000000
[ 208.063026] x5 : 0000000000000018 x4 : 0000000000007db6
[ 208.068329] x3 : 000000000008647a x2 : 19868179b1484500
[ 208.073632] x1 : 0000000000000000 x0 : ffff000009578c08
[ 208.078938] Process test_verifier (pid: 2256, stack limit = 0x0000000049ca7974)
[ 208.086235] Call trace:
[ 208.088672] bpf_skb_load_helper_8_no_cache+0x34/0xc0
[ 208.093713] 0xffff000000bdb754
[ 208.096845] bpf_test_run+0x78/0xf8
[ 208.100324] bpf_prog_test_run_skb+0x148/0x230
[ 208.104758] sys_bpf+0x314/0x1198
[ 208.108064] el0_svc_naked+0x30/0x34
[ 208.111632] Code: 91302260 f9400001 f9001fa1 d2800001 (29500680)
[ 208.117717] ---[ end trace 263cb8a59b5bf29f ]---
The program itself which caused this had a long jump over the whole
instruction sequence where all of the inner instructions required
heavy expansions into multiple BPF instructions. Additionally, I also
had BPF hardening enabled which requires once more rewrites of all
constant values in order to blind them. Each time we rewrite insns,
bpf_adj_branches() would need to potentially adjust branch targets
which cross the patchlet boundary to accommodate for the additional
delta. Eventually that lead to the case where the target offset could
not fit into insn->off's upper 0x7fff limit anymore where then offset
wraps around becoming negative (in s16 universe), or vice versa
depending on the jump direction.
Therefore it becomes necessary to detect and reject any such occasions
in a generic way for native eBPF and cBPF to eBPF migrations. For
the latter we can simply check bounds in the bpf_convert_filter()'s
BPF_EMIT_JMP helper macro and bail out once we surpass limits. The
bpf_patch_insn_single() for native eBPF (and cBPF to eBPF in case
of subsequent hardening) is a bit more complex in that we need to
detect such truncations before hitting the bpf_prog_realloc(). Thus
the latter is split into an extra pass to probe problematic offsets
on the original program in order to fail early. With that in place
and carefully tested I no longer hit the panic and the rewrites are
rejected properly. The above example panic I've seen on bpf-next,
though the issue itself is generic in that a guard against this issue
in bpf seems more appropriate in this case.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
[ Will follow up with an additional test case in bpf-next. ]
kernel/bpf/core.c | 100 ++++++++++++++++++++++++++++++++++++++++--------------
net/core/filter.c | 11 ++++--
2 files changed, 84 insertions(+), 27 deletions(-)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index ba03ec3..6ef6746 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -218,47 +218,84 @@ int bpf_prog_calc_tag(struct bpf_prog *fp)
return 0;
}
-static void bpf_adj_branches(struct bpf_prog *prog, u32 pos, u32 delta)
+static int bpf_adj_delta_to_imm(struct bpf_insn *insn, u32 pos, u32 delta,
+ u32 curr, const bool probe_pass)
{
+ const s64 imm_min = S32_MIN, imm_max = S32_MAX;
+ s64 imm = insn->imm;
+
+ if (curr < pos && curr + imm + 1 > pos)
+ imm += delta;
+ else if (curr > pos + delta && curr + imm + 1 <= pos + delta)
+ imm -= delta;
+ if (imm < imm_min || imm > imm_max)
+ return -ERANGE;
+ if (!probe_pass)
+ insn->imm = imm;
+ return 0;
+}
+
+static int bpf_adj_delta_to_off(struct bpf_insn *insn, u32 pos, u32 delta,
+ u32 curr, const bool probe_pass)
+{
+ const s32 off_min = S16_MIN, off_max = S16_MAX;
+ s32 off = insn->off;
+
+ if (curr < pos && curr + off + 1 > pos)
+ off += delta;
+ else if (curr > pos + delta && curr + off + 1 <= pos + delta)
+ off -= delta;
+ if (off < off_min || off > off_max)
+ return -ERANGE;
+ if (!probe_pass)
+ insn->off = off;
+ return 0;
+}
+
+static int bpf_adj_branches(struct bpf_prog *prog, u32 pos, u32 delta,
+ const bool probe_pass)
+{
+ u32 i, insn_cnt = prog->len + (probe_pass ? delta : 0);
struct bpf_insn *insn = prog->insnsi;
- u32 i, insn_cnt = prog->len;
- bool pseudo_call;
- u8 code;
- int off;
+ int ret = 0;
for (i = 0; i < insn_cnt; i++, insn++) {
+ u8 code;
+
+ /* In the probing pass we still operate on the original,
+ * unpatched image in order to check overflows before we
+ * do any other adjustments. Therefore skip the patchlet.
+ */
+ if (probe_pass && i == pos) {
+ i += delta + 1;
+ insn++;
+ }
code = insn->code;
- if (BPF_CLASS(code) != BPF_JMP)
- continue;
- if (BPF_OP(code) == BPF_EXIT)
+ if (BPF_CLASS(code) != BPF_JMP ||
+ BPF_OP(code) == BPF_EXIT)
continue;
+ /* Adjust offset of jmps if we cross patch boundaries. */
if (BPF_OP(code) == BPF_CALL) {
- if (insn->src_reg == BPF_PSEUDO_CALL)
- pseudo_call = true;
- else
+ if (insn->src_reg != BPF_PSEUDO_CALL)
continue;
+ ret = bpf_adj_delta_to_imm(insn, pos, delta, i,
+ probe_pass);
} else {
- pseudo_call = false;
+ ret = bpf_adj_delta_to_off(insn, pos, delta, i,
+ probe_pass);
}
- off = pseudo_call ? insn->imm : insn->off;
-
- /* Adjust offset of jmps if we cross boundaries. */
- if (i < pos && i + off + 1 > pos)
- off += delta;
- else if (i > pos + delta && i + off + 1 <= pos + delta)
- off -= delta;
-
- if (pseudo_call)
- insn->imm = off;
- else
- insn->off = off;
+ if (ret)
+ break;
}
+
+ return ret;
}
struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,
const struct bpf_insn *patch, u32 len)
{
u32 insn_adj_cnt, insn_rest, insn_delta = len - 1;
+ const u32 cnt_max = S16_MAX;
struct bpf_prog *prog_adj;
/* Since our patchlet doesn't expand the image, we're done. */
@@ -269,6 +306,15 @@ struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,
insn_adj_cnt = prog->len + insn_delta;
+ /* Reject anything that would potentially let the insn->off
+ * target overflow when we have excessive program expansions.
+ * We need to probe here before we do any reallocation where
+ * we afterwards may not fail anymore.
+ */
+ if (insn_adj_cnt > cnt_max &&
+ bpf_adj_branches(prog, off, insn_delta, true))
+ return NULL;
+
/* Several new instructions need to be inserted. Make room
* for them. Likely, there's no need for a new allocation as
* last page could have large enough tailroom.
@@ -294,7 +340,11 @@ struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,
sizeof(*patch) * insn_rest);
memcpy(prog_adj->insnsi + off, patch, sizeof(*patch) * len);
- bpf_adj_branches(prog_adj, off, insn_delta);
+ /* We are guaranteed to not fail at this point, otherwise
+ * the ship has sailed to reverse to the original state. An
+ * overflow cannot happen at this point.
+ */
+ BUG_ON(bpf_adj_branches(prog_adj, off, insn_delta, false));
return prog_adj;
}
diff --git a/net/core/filter.c b/net/core/filter.c
index e77c30c..201ff36b 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -481,11 +481,18 @@ static int bpf_convert_filter(struct sock_filter *prog, int len,
#define BPF_EMIT_JMP \
do { \
+ const s32 off_min = S16_MIN, off_max = S16_MAX; \
+ s32 off; \
+ \
if (target >= len || target < 0) \
goto err; \
- insn->off = addrs ? addrs[target] - addrs[i] - 1 : 0; \
+ off = addrs ? addrs[target] - addrs[i] - 1 : 0; \
/* Adjust pc relative offset for 2nd or 3rd insn. */ \
- insn->off -= insn - tmp_insns; \
+ off -= insn - tmp_insns; \
+ /* Reject anything not fitting into insn->off. */ \
+ if (off < off_min || off > off_max) \
+ goto err; \
+ insn->off = off; \
} while (0)
case BPF_JMP | BPF_JA:
--
2.9.5
^ permalink raw reply related
* Re: [bpf-next PATCH] bpf: sockmap, on update propagate errors back to userspace
From: Daniel Borkmann @ 2018-05-16 23:50 UTC (permalink / raw)
To: John Fastabend, ast; +Cc: netdev
In-Reply-To: <20180516233814.15266.67859.stgit@john-Precision-Tower-5810>
On 05/17/2018 01:38 AM, John Fastabend wrote:
> When an error happens in the update sockmap element logic also pass
> the err up to the user.
>
> Fixes: e5cd3abcb31a ("bpf: sockmap, refactor sockmap routines to work with hashmap")
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Agree, applied to bpf-next, thanks John!
^ permalink raw reply
* Re: [RFC bpf-next 04/11] bpf: Add PTR_TO_SOCKET verifier type
From: Joe Stringer @ 2018-05-16 23:56 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Joe Stringer, daniel, netdev, ast, john fastabend,
Martin KaFai Lau
In-Reply-To: <20180515023718.3zluffqkf52buc25@ast-mbp>
On 14 May 2018 at 19:37, Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
> On Wed, May 09, 2018 at 02:07:02PM -0700, Joe Stringer wrote:
>> Teach the verifier a little bit about a new type of pointer, a
>> PTR_TO_SOCKET. This pointer type is accessed from BPF through the
>> 'struct bpf_sock' structure.
>>
>> Signed-off-by: Joe Stringer <joe@wand.net.nz>
>> ---
>> include/linux/bpf.h | 19 +++++++++-
>> include/linux/bpf_verifier.h | 2 ++
>> kernel/bpf/verifier.c | 86 ++++++++++++++++++++++++++++++++++++++------
>> net/core/filter.c | 30 +++++++++-------
>> 4 files changed, 114 insertions(+), 23 deletions(-)
>
> Ack for patches 1-3. In this one few nits:
>
>> @@ -1723,6 +1752,16 @@ static int check_mem_access(struct bpf_verifier_env *env, int insn_idx, u32 regn
>> err = check_packet_access(env, regno, off, size, false);
>> if (!err && t == BPF_READ && value_regno >= 0)
>> mark_reg_unknown(env, regs, value_regno);
>> +
>> + } else if (reg->type == PTR_TO_SOCKET) {
>> + if (t == BPF_WRITE) {
>> + verbose(env, "cannot write into socket\n");
>> + return -EACCES;
>> + }
>> + err = check_sock_access(env, regno, off, size, t);
>> + if (!err && t == BPF_READ && value_regno >= 0)
>
> t == BPF_READ check is unnecessary.
>
>> @@ -5785,7 +5845,13 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr)
>>
>> if (ret == 0)
>> /* program is valid, convert *(u32*)(ctx + off) accesses */
>> - ret = convert_ctx_accesses(env);
>> + ret = convert_ctx_accesses(env, env->ops->convert_ctx_access,
>> + PTR_TO_CTX);
>> +
>> + if (ret == 0)
>> + /* Convert *(u32*)(sock_ops + off) accesses */
>> + ret = convert_ctx_accesses(env, bpf_sock_convert_ctx_access,
>> + PTR_TO_SOCKET);
>
> Overall looks great.
> Only this part is missing for PTR_TO_SOCKET:
> } else if (dst_reg_type != *prev_dst_type &&
> (dst_reg_type == PTR_TO_CTX ||
> *prev_dst_type == PTR_TO_CTX)) {
> verbose(env, "same insn cannot be used with different pointers\n");
> return -EINVAL;
> similar logic has to be added.
> Otherwise the following will be accepted:
>
> R1 = sock_ptr
> goto X;
> ...
> R1 = some_other_valid_ptr;
> goto X;
> ...
>
> R2 = *(u32 *)(R1 + 0);
> this will be rewritten for first branch,
> but it's wrong for second.
>
Thanks for the review, will address these comments.
^ permalink raw reply
* [PATCH net] erspan: fix invalid erspan version.
From: William Tu @ 2018-05-17 0:24 UTC (permalink / raw)
To: netdev; +Cc: gvrose8192
ERSPAN only support version 1 and 2. When packets send to an
erspan device which does not have proper version number set,
drop the packet. In real case, we observe multicast packets
sent to the erspan pernet device, erspan0, which does not have
erspan version configured.
Reported-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: William Tu <u9012063@gmail.com>
---
net/ipv4/ip_gre.c | 4 +++-
net/ipv6/ip6_gre.c | 5 ++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 2409e648454d..2d8efeecf619 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -734,10 +734,12 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
erspan_build_header(skb, ntohl(tunnel->parms.o_key),
tunnel->index,
truncate, true);
- else
+ else if (tunnel->erspan_ver == 2)
erspan_build_header_v2(skb, ntohl(tunnel->parms.o_key),
tunnel->dir, tunnel->hwid,
truncate, true);
+ else
+ goto free_skb;
tunnel->parms.o_flags &= ~TUNNEL_KEY;
__gre_xmit(skb, dev, &tunnel->parms.iph, htons(ETH_P_ERSPAN));
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index bede77f24784..d20072fc38cb 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -991,11 +991,14 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
erspan_build_header(skb, ntohl(t->parms.o_key),
t->parms.index,
truncate, false);
- else
+ else if (t->parms.erspan_ver == 2)
erspan_build_header_v2(skb, ntohl(t->parms.o_key),
t->parms.dir,
t->parms.hwid,
truncate, false);
+ else
+ goto tx_err;
+
fl6.daddr = t->parms.raddr;
}
--
2.7.4
^ permalink raw reply related
* Re: [PATCH v3] {net, IB}/mlx5: Use 'kvfree()' for memory allocated by 'kvzalloc()'
From: Saeed Mahameed @ 2018-05-17 0:42 UTC (permalink / raw)
To: christophe.jaillet@wanadoo.fr, Matan Barak, jgg@ziepe.ca,
davem@davemloft.net, leon@kernel.org, dledford@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org
In-Reply-To: <20180516190720.11633-1-christophe.jaillet@wanadoo.fr>
On Wed, 2018-05-16 at 21:07 +0200, Christophe JAILLET wrote:
> When 'kvzalloc()' is used to allocate memory, 'kvfree()' must be used
> to
> free it.
>
> Fixes: 1cbe6fc86ccfe ("IB/mlx5: Add support for CQE compressing")
> Fixes: fed9ce22bf8ae ("net/mlx5: E-Switch, Add API to create vport rx
> rules")
> Fixes: 9efa75254593d ("net/mlx5_core: Introduce access functions to
> query vport RoCE fields")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v1 -> v2: More places to update have been added to the patch
> v2 -> v3: Add Fixes tag
>
> 3 patches with one Fixes tag each should probably be better, but
> honestly, I won't send a v4.
> Fill free to split it if needed.
Applied to mlx5-next, thanks Christophe!
> ---
> drivers/infiniband/hw/mlx5/cq.c | 2 +-
> drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 2 +-
> drivers/net/ethernet/mellanox/mlx5/core/vport.c | 6 +++
> ---
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx5/cq.c
> b/drivers/infiniband/hw/mlx5/cq.c
> index 77d257ec899b..6d52ea03574e 100644
> --- a/drivers/infiniband/hw/mlx5/cq.c
> +++ b/drivers/infiniband/hw/mlx5/cq.c
> @@ -849,7 +849,7 @@ static int create_cq_user(struct mlx5_ib_dev
> *dev, struct ib_udata *udata,
> return 0;
>
> err_cqb:
> - kfree(*cqb);
> + kvfree(*cqb);
>
> err_db:
> mlx5_ib_db_unmap_user(to_mucontext(context), &cq->db);
> diff --git
> a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> index 35e256eb2f6e..b123f8a52ad8 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> @@ -663,7 +663,7 @@ static int esw_create_vport_rx_group(struct
> mlx5_eswitch *esw)
>
> esw->offloads.vport_rx_group = g;
> out:
> - kfree(flow_group_in);
> + kvfree(flow_group_in);
> return err;
> }
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vport.c
> b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
> index 177e076b8d17..719cecb182c6 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
> @@ -511,7 +511,7 @@ int mlx5_query_nic_vport_system_image_guid(struct
> mlx5_core_dev *mdev,
> *system_image_guid = MLX5_GET64(query_nic_vport_context_out,
> out,
> nic_vport_context.system_ima
> ge_guid);
>
> - kfree(out);
> + kvfree(out);
>
> return 0;
> }
> @@ -531,7 +531,7 @@ int mlx5_query_nic_vport_node_guid(struct
> mlx5_core_dev *mdev, u64 *node_guid)
> *node_guid = MLX5_GET64(query_nic_vport_context_out, out,
> nic_vport_context.node_guid);
>
> - kfree(out);
> + kvfree(out);
>
> return 0;
> }
> @@ -587,7 +587,7 @@ int mlx5_query_nic_vport_qkey_viol_cntr(struct
> mlx5_core_dev *mdev,
> *qkey_viol_cntr = MLX5_GET(query_nic_vport_context_out, out,
> nic_vport_context.qkey_violation_
> counter);
>
> - kfree(out);
> + kvfree(out);
>
> return 0;
> }
^ permalink raw reply
* Re: [RFC bpf-next 06/11] bpf: Add reference tracking to verifier
From: Joe Stringer @ 2018-05-17 1:05 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Joe Stringer, daniel, netdev, ast, john fastabend,
Martin KaFai Lau
In-Reply-To: <20180515030415.lhw7jhrl7uowt4la@ast-mbp>
On 14 May 2018 at 20:04, Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
> On Wed, May 09, 2018 at 02:07:04PM -0700, Joe Stringer wrote:
>> Allow helper functions to acquire a reference and return it into a
>> register. Specific pointer types such as the PTR_TO_SOCKET will
>> implicitly represent such a reference. The verifier must ensure that
>> these references are released exactly once in each path through the
>> program.
>>
>> To achieve this, this commit assigns an id to the pointer and tracks it
>> in the 'bpf_func_state', then when the function or program exits,
>> verifies that all of the acquired references have been freed. When the
>> pointer is passed to a function that frees the reference, it is removed
>> from the 'bpf_func_state` and all existing copies of the pointer in
>> registers are marked invalid.
>>
>> Signed-off-by: Joe Stringer <joe@wand.net.nz>
>> ---
>> include/linux/bpf_verifier.h | 18 ++-
>> kernel/bpf/verifier.c | 295 ++++++++++++++++++++++++++++++++++++++++---
>> 2 files changed, 292 insertions(+), 21 deletions(-)
>>
>> diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
>> index 9dcd87f1d322..8dbee360b3ec 100644
>> --- a/include/linux/bpf_verifier.h
>> +++ b/include/linux/bpf_verifier.h
>> @@ -104,6 +104,11 @@ struct bpf_stack_state {
>> u8 slot_type[BPF_REG_SIZE];
>> };
>>
>> +struct bpf_reference_state {
>> + int id;
>> + int insn_idx; /* allocation insn */
>
> the insn_idx is for more verbose messages, right?
> It doesn't seem to affect the safety of algorithm.
> Please add a comment to clarify that.
Yup, will do.
>> +/* Acquire a pointer id from the env and update the state->refs to include
>> + * this new pointer reference.
>> + * On success, returns a valid pointer id to associate with the register
>> + * On failure, returns a negative errno.
>> + */
>> +static int acquire_reference_state(struct bpf_verifier_env *env, int insn_idx)
>> +{
>> + struct bpf_func_state *state = cur_func(env);
>> + int new_ofs = state->acquired_refs;
>> + int id, err;
>> +
>> + err = realloc_reference_state(state, state->acquired_refs + 1, true);
>> + if (err)
>> + return err;
>> + id = ++env->id_gen;
>> + state->refs[new_ofs].id = id;
>> + state->refs[new_ofs].insn_idx = insn_idx;
>
> I thought that we may avoid this extra 'ref_state' array if we store
> 'id' into 'aux' array which is one to one to array of instructions
> and avoid this expensive reallocs, but then I realized we can go
> through the same instruction that returns a pointer to socket
> multiple times and every time it needs to be different 'id' and
> tracked indepdently, so yeah. All that infra is necessary.
> Would be good to document the algorithm a bit more.
Good point, I'll add these details to the bpf_reference_state definition.
Will consider other areas that could receive some docs attention.
>> @@ -2498,6 +2711,15 @@ static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn
>> return err;
>> }
>>
>> + /* If the function is a release() function, mark all copies of the same
>> + * pointer as "freed" in all registers and in the stack.
>> + */
>> + if (is_release_function(func_id)) {
>> + err = release_reference(env);
>
> I think this can be improved if check_func_arg() stores ptr_id into meta.
> Then this loop
> for (i = BPF_REG_1; i < BPF_REG_6; i++) {
> if (reg_is_refcounted(®s[i])) {
> in release_reference() won't be needed.
That's a nice cleanup.
> Also the macros from the previous patch look ugly, but considering this patch
> I guess it's justified. At least I don't see a better way of doing it.
Completely agree, ugly, but I also didn't see a great alternative.
^ permalink raw reply
* pull-request: bpf-next 2018-05-17
From: Daniel Borkmann @ 2018-05-17 1:09 UTC (permalink / raw)
To: davem; +Cc: daniel, ast, netdev
Hi David,
The following pull-request contains BPF updates for your *net-next* tree.
The main changes are:
1) Provide a new BPF helper for doing a FIB and neighbor lookup
in the kernel tables from an XDP or tc BPF program. The helper
provides a fast-path for forwarding packets. The API supports
IPv4, IPv6 and MPLS protocols, but currently IPv4 and IPv6 are
implemented in this initial work, from David (Ahern).
2) Just a tiny diff but huge feature enabled for nfp driver by
extending the BPF offload beyond a pure host processing offload.
Offloaded XDP programs are allowed to set the RX queue index and
thus opening the door for defining a fully programmable RSS/n-tuple
filter replacement. Once BPF decided on a queue already, the device
data-path will skip the conventional RSS processing completely,
from Jakub.
3) The original sockmap implementation was array based similar to
devmap. However unlike devmap where an ifindex has a 1:1 mapping
into the map there are use cases with sockets that need to be
referenced using longer keys. Hence, sockhash map is added reusing
as much of the sockmap code as possible, from John.
4) Introduce BTF ID. The ID is allocatd through an IDR similar as
with BPF maps and progs. It also makes BTF accessible to user
space via BPF_BTF_GET_FD_BY_ID and adds exposure of the BTF data
through BPF_OBJ_GET_INFO_BY_FD, from Martin.
5) Enable BPF stackmap with build_id also in NMI context. Due to the
up_read() of current->mm->mmap_sem build_id cannot be parsed.
This work defers the up_read() via a per-cpu irq_work so that
at least limited support can be enabled, from Song.
6) Various BPF JIT follow-up cleanups and fixups after the LD_ABS/LD_IND
JIT conversion as well as implementation of an optimized 32/64 bit
immediate load in the arm64 JIT that allows to reduce the number of
emitted instructions; in case of tested real-world programs they
were shrinking by three percent, from Daniel.
7) Add ifindex parameter to the libbpf loader in order to enable
BPF offload support. Right now only iproute2 can load offloaded
BPF and this will also enable libbpf for direct integration into
other applications, from David (Beckett).
8) Convert the plain text documentation under Documentation/bpf/ into
RST format since this is the appropriate standard the kernel is
moving to for all documentation. Also add an overview README.rst,
from Jesper.
9) Add __printf verification attribute to the bpf_verifier_vlog()
helper. Though it uses va_list we can still allow gcc to check
the format string, from Mathieu.
10) Fix a bash reference in the BPF selftest's Makefile. The '|& ...'
is a bash 4.0+ feature which is not guaranteed to be available
when calling out to shell, therefore use a more portable variant,
from Joe.
11) Fix a 64 bit division in xdp_umem_reg() by using div_u64()
instead of relying on the gcc built-in, from Björn.
12) Fix a sock hashmap kmalloc warning reported by syzbot when an
overly large key size is used in hashmap then causing overflows
in htab->elem_size. Reject bogus attr->key_size early in the
sock_hash_alloc(), from Yonghong.
13) Ensure in BPF selftests when urandom_read is being linked that
--build-id is always enabled so that test_stacktrace_build_id[_nmi]
won't be failing, from Alexei.
14) Add bitsperlong.h as well as errno.h uapi headers into the tools
header infrastructure which point to one of the arch specific
uapi headers. This was needed in order to fix a build error on
some systems for the BPF selftests, from Sirio.
15) Allow for short options to be used in the xdp_monitor BPF sample
code. And also a bpf.h tools uapi header sync in order to fix a
selftest build failure. Both from Prashant.
16) More formally clarify the meaning of ID in the direct packet access
section of the BPF documentation, from Wang.
Please consider pulling these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
Thanks a lot!
----------------------------------------------------------------
The following changes since commit 53a7bdfb2a2756cce8003b90817f8a6fb4d830d9:
dt-bindings: dsa: Remove unnecessary #address/#size-cells (2018-05-08 20:28:44 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
for you to fetch changes up to e23afe5e7cba89cd0744c5218eda1b3553455c17:
bpf: sockmap, on update propagate errors back to userspace (2018-05-17 01:48:22 +0200)
----------------------------------------------------------------
Alexei Starovoitov (4):
Merge branch 'bpf-jit-cleanups'
Merge branch 'fix-samples'
Merge branch 'convert-doc-to-rst'
selftests/bpf: make sure build-id is on
Björn Töpel (1):
xsk: fix 64-bit division
Daniel Borkmann (14):
Merge branch 'bpf-btf-id'
Merge branch 'bpf-nfp-programmable-rss'
Merge branch 'bpf-fib-lookup-helper'
Merge branch 'bpf-perf-rb-libbpf'
Merge branch 'bpf-stackmap-nmi'
bpf, mips: remove unused function
bpf, sparc: remove unused variable
bpf, x64: clean up retpoline emission slightly
bpf, arm32: save 4 bytes of unneeded stack space
bpf, arm64: save 4 bytes of unneeded stack space
bpf, arm64: optimize 32/64 immediate emission
bpf, arm64: save 4 bytes in prologue when ebpf insns came from cbpf
bpf: add ld64 imm test cases
Merge branch 'bpf-sock-hashmap'
David Ahern (10):
net/ipv6: Rename fib6_lookup to fib6_node_lookup
net/ipv6: Rename rt6_multipath_select
net/ipv6: Extract table lookup from ip6_pol_route
net/ipv6: Refactor fib6_rule_action
net/ipv6: Add fib6_lookup
net/ipv6: Update fib6 tracepoint to take fib6_info
net/ipv6: Add fib lookup stubs for use in bpf helper
bpf: Provide helper to do forwarding lookups in kernel FIB table
samples/bpf: Add example of ipv4 and ipv6 forwarding in XDP
samples/bpf: Decrement ttl in fib forwarding example
David Beckett (1):
libbpf: add ifindex to enable offload support
Jakub Kicinski (14):
bpf: xdp: allow offloads to store into rx_queue_index
nfp: bpf: support setting the RX queue index
tools: bpftool: use PERF_SAMPLE_TIME instead of reading the clock
samples: bpf: rename struct bpf_map_def to avoid conflict with libbpf
samples: bpf: compile and link against full libbpf
tools: bpf: move the event reading loop to libbpf
tools: bpf: improve comments in libbpf.h
tools: bpf: don't complain about no kernel version for networking code
samples: bpf: convert some XDP samples from bpf_load to libbpf
samples: bpf: include bpf/bpf.h instead of local libbpf.h
samples: bpf: rename libbpf.h to bpf_insn.h
samples: bpf: fix build after move to compiling full libbpf.a
samples: bpf: move libbpf from object dependencies to libs
samples: bpf: make the build less noisy
Jesper Dangaard Brouer (5):
bpf, doc: add basic README.rst file
bpf, doc: rename txt files to rst files
bpf, doc: convert bpf_design_QA.rst to use RST formatting
bpf, doc: convert bpf_devel_QA.rst to use RST formatting
bpf, doc: howto use/run the BPF selftests
Joe Stringer (1):
selftests/bpf: Fix bash reference in Makefile
John Fastabend (5):
bpf: sockmap, refactor sockmap routines to work with hashmap
bpf: sockmap, add hash map support
bpf: selftest additions for SOCKHASH
bpf: bpftool, support for sockhash
bpf: sockmap, on update propagate errors back to userspace
Martin KaFai Lau (6):
bpf: btf: Avoid WARN_ON when CONFIG_REFCOUNT_FULL=y
bpf: btf: Introduce BTF ID
bpf: btf: Add struct bpf_btf_info
bpf: btf: Some test_btf clean up
bpf: btf: Update tools/include/uapi/linux/btf.h with BTF ID
bpf: btf: Tests for BPF_OBJ_GET_INFO_BY_FD and BPF_BTF_GET_FD_BY_ID
Mathieu Malaterre (1):
bpf: add __printf verification to bpf_verifier_vlog
Prashant Bhole (2):
bpf: sync tools bpf.h uapi header
samples/bpf: xdp_monitor, accept short options
Sirio Balmelli (2):
selftests/bpf: add architecture-agnostic headers
selftests/bpf: ignore build products
Song Liu (2):
bpf: enable stackmap with build_id in nmi context
bpf: add selftest for stackmap with build_id in NMI context
Wang YanQing (1):
bpf, doc: clarification for the meaning of 'id'
Yonghong Song (1):
bpf: fix sock hashmap kmalloc warning
Documentation/bpf/README.rst | 36 ++
Documentation/bpf/bpf_design_QA.rst | 221 ++++++++
Documentation/bpf/bpf_design_QA.txt | 156 ------
Documentation/bpf/bpf_devel_QA.rst | 640 +++++++++++++++++++++
Documentation/bpf/bpf_devel_QA.txt | 570 -------------------
Documentation/networking/filter.txt | 15 +-
arch/arm/net/bpf_jit_32.c | 13 +-
arch/arm64/net/bpf_jit_comp.c | 115 ++--
arch/mips/net/ebpf_jit.c | 26 -
arch/sparc/net/bpf_jit_comp_64.c | 1 -
arch/x86/include/asm/nospec-branch.h | 29 +-
drivers/net/ethernet/netronome/nfp/bpf/fw.h | 1 +
drivers/net/ethernet/netronome/nfp/bpf/jit.c | 47 ++
drivers/net/ethernet/netronome/nfp/bpf/main.c | 11 +
drivers/net/ethernet/netronome/nfp/bpf/main.h | 8 +
drivers/net/ethernet/netronome/nfp/bpf/verifier.c | 28 +-
drivers/net/ethernet/netronome/nfp/nfp_asm.h | 22 +-
include/linux/bpf.h | 10 +-
include/linux/bpf_types.h | 1 +
include/linux/bpf_verifier.h | 4 +-
include/linux/btf.h | 2 +
include/linux/filter.h | 3 +-
include/net/addrconf.h | 14 +
include/net/ip6_fib.h | 21 +-
include/net/tcp.h | 3 +-
include/trace/events/fib6.h | 14 +-
include/uapi/linux/bpf.h | 142 ++++-
init/Kconfig | 1 +
kernel/bpf/btf.c | 136 ++++-
kernel/bpf/core.c | 1 +
kernel/bpf/sockmap.c | 644 +++++++++++++++++++---
kernel/bpf/stackmap.c | 59 +-
kernel/bpf/syscall.c | 41 +-
kernel/bpf/verifier.c | 16 +-
net/core/filter.c | 365 +++++++++++-
net/ipv6/addrconf_core.c | 33 +-
net/ipv6/af_inet6.c | 6 +-
net/ipv6/fib6_rules.c | 138 ++++-
net/ipv6/ip6_fib.c | 21 +-
net/ipv6/route.c | 76 +--
net/xdp/xdp_umem.c | 2 +-
samples/bpf/Makefile | 166 +++---
samples/bpf/{libbpf.h => bpf_insn.h} | 8 +-
samples/bpf/bpf_load.c | 12 +-
samples/bpf/bpf_load.h | 6 +-
samples/bpf/cookie_uid_helper_example.c | 2 +-
samples/bpf/cpustat_user.c | 2 +-
samples/bpf/fds_example.c | 4 +-
samples/bpf/lathist_user.c | 2 +-
samples/bpf/load_sock_ops.c | 2 +-
samples/bpf/lwt_len_hist_user.c | 2 +-
samples/bpf/map_perf_test_user.c | 2 +-
samples/bpf/sock_example.c | 3 +-
samples/bpf/sock_example.h | 1 -
samples/bpf/sockex1_user.c | 2 +-
samples/bpf/sockex2_user.c | 2 +-
samples/bpf/sockex3_user.c | 2 +-
samples/bpf/syscall_tp_user.c | 2 +-
samples/bpf/tc_l2_redirect_user.c | 2 +-
samples/bpf/test_cgrp2_array_pin.c | 2 +-
samples/bpf/test_cgrp2_attach.c | 3 +-
samples/bpf/test_cgrp2_attach2.c | 3 +-
samples/bpf/test_cgrp2_sock.c | 3 +-
samples/bpf/test_cgrp2_sock2.c | 3 +-
samples/bpf/test_current_task_under_cgroup_user.c | 2 +-
samples/bpf/test_lru_dist.c | 2 +-
samples/bpf/test_map_in_map_user.c | 2 +-
samples/bpf/test_overhead_user.c | 2 +-
samples/bpf/test_probe_write_user_user.c | 2 +-
samples/bpf/trace_output_user.c | 8 +-
samples/bpf/tracex1_user.c | 2 +-
samples/bpf/tracex2_user.c | 2 +-
samples/bpf/tracex3_user.c | 2 +-
samples/bpf/tracex4_user.c | 2 +-
samples/bpf/tracex5_user.c | 2 +-
samples/bpf/tracex6_user.c | 2 +-
samples/bpf/tracex7_user.c | 2 +-
samples/bpf/xdp1_user.c | 31 +-
samples/bpf/xdp_adjust_tail_user.c | 36 +-
samples/bpf/xdp_fwd_kern.c | 138 +++++
samples/bpf/xdp_fwd_user.c | 136 +++++
samples/bpf/xdp_monitor_user.c | 6 +-
samples/bpf/xdp_redirect_cpu_user.c | 2 +-
samples/bpf/xdp_redirect_map_user.c | 2 +-
samples/bpf/xdp_redirect_user.c | 2 +-
samples/bpf/xdp_router_ipv4_user.c | 2 +-
samples/bpf/xdp_rxq_info_user.c | 46 +-
samples/bpf/xdp_tx_iptunnel_user.c | 2 +-
samples/bpf/xdpsock_user.c | 2 +-
tools/bpf/bpftool/.gitignore | 3 +
tools/bpf/bpftool/map.c | 1 +
tools/bpf/bpftool/map_perf_ring.c | 83 +--
tools/include/uapi/asm/bitsperlong.h | 18 +
tools/include/uapi/asm/errno.h | 18 +
tools/include/uapi/linux/bpf.h | 143 ++++-
tools/lib/bpf/Makefile | 2 +-
tools/lib/bpf/bpf.c | 12 +
tools/lib/bpf/bpf.h | 3 +
tools/lib/bpf/libbpf.c | 125 ++++-
tools/lib/bpf/libbpf.h | 62 ++-
tools/testing/selftests/bpf/.gitignore | 1 +
tools/testing/selftests/bpf/Makefile | 12 +-
tools/testing/selftests/bpf/bpf_helpers.h | 11 +
tools/testing/selftests/bpf/bpf_rand.h | 80 +++
tools/testing/selftests/bpf/test_btf.c | 478 ++++++++++++----
tools/testing/selftests/bpf/test_progs.c | 140 ++++-
tools/testing/selftests/bpf/test_sockhash_kern.c | 5 +
tools/testing/selftests/bpf/test_sockmap.c | 27 +-
tools/testing/selftests/bpf/test_sockmap_kern.c | 343 +-----------
tools/testing/selftests/bpf/test_sockmap_kern.h | 363 ++++++++++++
tools/testing/selftests/bpf/test_verifier.c | 62 +++
tools/testing/selftests/bpf/trace_helpers.c | 87 +--
tools/testing/selftests/bpf/trace_helpers.h | 11 +-
tools/testing/selftests/bpf/urandom_read.c | 10 +-
114 files changed, 4600 insertions(+), 1865 deletions(-)
create mode 100644 Documentation/bpf/README.rst
create mode 100644 Documentation/bpf/bpf_design_QA.rst
delete mode 100644 Documentation/bpf/bpf_design_QA.txt
create mode 100644 Documentation/bpf/bpf_devel_QA.rst
delete mode 100644 Documentation/bpf/bpf_devel_QA.txt
rename samples/bpf/{libbpf.h => bpf_insn.h} (98%)
create mode 100644 samples/bpf/xdp_fwd_kern.c
create mode 100644 samples/bpf/xdp_fwd_user.c
create mode 100644 tools/bpf/bpftool/.gitignore
create mode 100644 tools/include/uapi/asm/bitsperlong.h
create mode 100644 tools/include/uapi/asm/errno.h
create mode 100644 tools/testing/selftests/bpf/bpf_rand.h
create mode 100644 tools/testing/selftests/bpf/test_sockhash_kern.c
create mode 100644 tools/testing/selftests/bpf/test_sockmap_kern.h
^ permalink raw reply
* Re: [PATCH 34/40] atm: simplify procfs code
From: Eric W. Biederman @ 2018-05-17 1:15 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Andrew Morton, Alexander Viro, Alexey Dobriyan,
Greg Kroah-Hartman, Jiri Slaby, Alessandro Zummo,
Alexandre Belloni, linux-acpi, drbd-dev, linux-ide, netdev,
linux-rtc, megaraidlinux.pdl, linux-scsi, devel, linux-afs,
linux-ext4, jfs-discussion, netfilter-devel, linux-kernel
In-Reply-To: <20180515141232.GD31296@lst.de>
Christoph Hellwig <hch@lst.de> writes:
> On Sat, May 05, 2018 at 07:51:18AM -0500, Eric W. Biederman wrote:
>> Christoph Hellwig <hch@lst.de> writes:
>>
>> > Use remove_proc_subtree to remove the whole subtree on cleanup, and
>> > unwind the registration loop into individual calls. Switch to use
>> > proc_create_seq where applicable.
>>
>> Can you please explain why you are removing the error handling when
>> you are unwinding the registration loop?
>
> Because there is no point in handling these errors. The code work
> perfectly fine without procfs, or without given proc files and the
> removal works just fine if they don't exist either. This is a very
> common patter in various parts of the kernel already.
>
> I'll document it better in the changelog.
Thank you. That is the kind of thing that could be a signal of
inattentiveness and problems, especially when it is not documented.
Eric
^ permalink raw reply
* linux-next: manual merge of the net-next tree with the vfs tree
From: Stephen Rothwell @ 2018-05-17 1:34 UTC (permalink / raw)
To: David Miller, Networking, Al Viro
Cc: Linux-Next Mailing List, Linux Kernel Mailing List,
Christoph Hellwig, Chris Novakovic
[-- Attachment #1: Type: text/plain, Size: 3612 bytes --]
Hi all,
Today's linux-next merge of the net-next tree got a conflict in:
net/ipv4/ipconfig.c
between commits:
3f3942aca6da ("proc: introduce proc_create_single{,_data}")
c04d2cb2009f ("ipconfig: Write NTP server IPs to /proc/net/ipconfig/ntp_servers")
from the vfs tree and commit:
4d019b3f80dc ("ipconfig: Create /proc/net/ipconfig directory")
from the net-next tree.
I fixed it up (see below - there may be more to do) 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/ipv4/ipconfig.c
index bbcbcc113d19,86c9f755de3d..000000000000
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@@ -1282,6 -1317,74 +1317,61 @@@ static int pnp_seq_show(struct seq_fil
&ic_servaddr);
return 0;
}
-
-static int pnp_seq_open(struct inode *indoe, struct file *file)
-{
- return single_open(file, pnp_seq_show, NULL);
-}
-
-static const struct file_operations pnp_seq_fops = {
- .open = pnp_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
+ /* Create the /proc/net/ipconfig directory */
+ static int __init ipconfig_proc_net_init(void)
+ {
+ ipconfig_dir = proc_net_mkdir(&init_net, "ipconfig", init_net.proc_net);
+ if (!ipconfig_dir)
+ return -ENOMEM;
+
+ return 0;
+ }
+
+ /* Create a new file under /proc/net/ipconfig */
+ static int ipconfig_proc_net_create(const char *name,
+ const struct file_operations *fops)
+ {
+ char *pname;
+ struct proc_dir_entry *p;
+
+ if (!ipconfig_dir)
+ return -ENOMEM;
+
+ pname = kasprintf(GFP_KERNEL, "%s%s", "ipconfig/", name);
+ if (!pname)
+ return -ENOMEM;
+
+ p = proc_create(pname, 0444, init_net.proc_net, fops);
+ kfree(pname);
+ if (!p)
+ return -ENOMEM;
+
+ return 0;
+ }
+
+ /* Write NTP server IP addresses to /proc/net/ipconfig/ntp_servers */
+ static int ntp_servers_seq_show(struct seq_file *seq, void *v)
+ {
+ int i;
+
+ for (i = 0; i < CONF_NTP_SERVERS_MAX; i++) {
+ if (ic_ntp_servers[i] != NONE)
+ seq_printf(seq, "%pI4\n", &ic_ntp_servers[i]);
+ }
+ return 0;
+ }
+
+ static int ntp_servers_seq_open(struct inode *inode, struct file *file)
+ {
+ return single_open(file, ntp_servers_seq_show, NULL);
+ }
+
+ static const struct file_operations ntp_servers_seq_fops = {
+ .open = ntp_servers_seq_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+ };
#endif /* CONFIG_PROC_FS */
/*
@@@ -1356,8 -1459,20 +1446,20 @@@ static int __init ip_auto_config(void
int err;
unsigned int i;
+ /* Initialise all name servers and NTP servers to NONE (but only if the
+ * "ip=" or "nfsaddrs=" kernel command line parameters weren't decoded,
+ * otherwise we'll overwrite the IP addresses specified there)
+ */
+ if (ic_set_manually == 0) {
+ ic_nameservers_predef();
+ ic_ntp_servers_predef();
+ }
+
#ifdef CONFIG_PROC_FS
- proc_create("pnp", 0444, init_net.proc_net, &pnp_seq_fops);
+ proc_create_single("pnp", 0444, init_net.proc_net, pnp_seq_show);
+
+ if (ipconfig_proc_net_init() == 0)
+ ipconfig_proc_net_create("ntp_servers", &ntp_servers_seq_fops);
#endif /* CONFIG_PROC_FS */
if (!ic_enable)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [PATCH ghak81 V3 3/3] audit: collect audit task parameters
From: kbuild test robot @ 2018-05-17 1:43 UTC (permalink / raw)
To: Richard Guy Briggs
Cc: kbuild-all, Linux-Audit Mailing List, LKML,
Linux NetDev Upstream Mailing List, Netfilter Devel List,
Linux Security Module list, Integrity Measurement Architecture,
SElinux list, Eric Paris, Paul Moore, Steve Grubb, Ingo Molnar,
David Howells, Richard Guy Briggs
In-Reply-To: <fbed63483b5206009ee43ae889b30d43051f386c.1526430313.git.rgb@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2340 bytes --]
Hi Richard,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on next-20180516]
[cannot apply to linus/master tip/sched/core v4.17-rc5 v4.17-rc4 v4.17-rc3 v4.17-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Richard-Guy-Briggs/audit-group-task-params/20180517-090703
config: i386-tinyconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
kernel/fork.c: In function 'copy_process':
>> kernel/fork.c:1739:3: error: 'struct task_struct' has no member named 'audit'
p->audit = NULL;
^~
vim +1739 kernel/fork.c
1728
1729 p->default_timer_slack_ns = current->timer_slack_ns;
1730
1731 task_io_accounting_init(&p->ioac);
1732 acct_clear_integrals(p);
1733
1734 posix_cpu_timers_init(p);
1735
1736 p->start_time = ktime_get_ns();
1737 p->real_start_time = ktime_get_boot_ns();
1738 p->io_context = NULL;
> 1739 p->audit = NULL;
1740 cgroup_fork(p);
1741 #ifdef CONFIG_NUMA
1742 p->mempolicy = mpol_dup(p->mempolicy);
1743 if (IS_ERR(p->mempolicy)) {
1744 retval = PTR_ERR(p->mempolicy);
1745 p->mempolicy = NULL;
1746 goto bad_fork_cleanup_threadgroup_lock;
1747 }
1748 #endif
1749 #ifdef CONFIG_CPUSETS
1750 p->cpuset_mem_spread_rotor = NUMA_NO_NODE;
1751 p->cpuset_slab_spread_rotor = NUMA_NO_NODE;
1752 seqcount_init(&p->mems_allowed_seq);
1753 #endif
1754 #ifdef CONFIG_TRACE_IRQFLAGS
1755 p->irq_events = 0;
1756 p->hardirqs_enabled = 0;
1757 p->hardirq_enable_ip = 0;
1758 p->hardirq_enable_event = 0;
1759 p->hardirq_disable_ip = _THIS_IP_;
1760 p->hardirq_disable_event = 0;
1761 p->softirqs_enabled = 1;
1762 p->softirq_enable_ip = _THIS_IP_;
1763 p->softirq_enable_event = 0;
1764 p->softirq_disable_ip = 0;
1765 p->softirq_disable_event = 0;
1766 p->hardirq_context = 0;
1767 p->softirq_context = 0;
1768 #endif
1769
1770 p->pagefault_disabled = 0;
1771
---
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: 6329 bytes --]
^ permalink raw reply
* [PATCH] bonding: introduce link change helper
From: Tonghao Zhang @ 2018-05-17 2:09 UTC (permalink / raw)
To: netdev; +Cc: Tonghao Zhang
Introduce an new common helper to avoid redundancy.
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
drivers/net/bonding/bond_main.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 718e491..3063a9c 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2135,6 +2135,24 @@ static int bond_miimon_inspect(struct bonding *bond)
return commit;
}
+static void bond_miimon_link_change(struct bonding *bond,
+ struct slave *slave,
+ char link)
+{
+ switch (BOND_MODE(bond)) {
+ case BOND_MODE_8023AD:
+ bond_3ad_handle_link_change(slave, link);
+ break;
+ case BOND_MODE_TLB:
+ case BOND_MODE_ALB:
+ bond_alb_handle_link_change(bond, slave, link);
+ break;
+ case BOND_MODE_XOR:
+ bond_update_slave_arr(bond, NULL);
+ break;
+ }
+}
+
static void bond_miimon_commit(struct bonding *bond)
{
struct list_head *iter;
@@ -2176,16 +2194,7 @@ static void bond_miimon_commit(struct bonding *bond)
slave->speed == SPEED_UNKNOWN ? 0 : slave->speed,
slave->duplex ? "full" : "half");
- /* notify ad that the link status has changed */
- if (BOND_MODE(bond) == BOND_MODE_8023AD)
- bond_3ad_handle_link_change(slave, BOND_LINK_UP);
-
- if (bond_is_lb(bond))
- bond_alb_handle_link_change(bond, slave,
- BOND_LINK_UP);
-
- if (BOND_MODE(bond) == BOND_MODE_XOR)
- bond_update_slave_arr(bond, NULL);
+ bond_miimon_link_change(bond, slave, BOND_LINK_UP);
if (!bond->curr_active_slave || slave == primary)
goto do_failover;
@@ -2207,16 +2216,7 @@ static void bond_miimon_commit(struct bonding *bond)
netdev_info(bond->dev, "link status definitely down for interface %s, disabling it\n",
slave->dev->name);
- if (BOND_MODE(bond) == BOND_MODE_8023AD)
- bond_3ad_handle_link_change(slave,
- BOND_LINK_DOWN);
-
- if (bond_is_lb(bond))
- bond_alb_handle_link_change(bond, slave,
- BOND_LINK_DOWN);
-
- if (BOND_MODE(bond) == BOND_MODE_XOR)
- bond_update_slave_arr(bond, NULL);
+ bond_miimon_link_change(bond, slave, BOND_LINK_DOWN);
if (slave == rcu_access_pointer(bond->curr_active_slave))
goto do_failover;
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH net-next v3 1/3] ipv4: support sport, dport and ip_proto in RTM_GETROUTE
From: David Miller @ 2018-05-17 2:36 UTC (permalink / raw)
To: roopa; +Cc: netdev, dsa, nikolay, idosch
In-Reply-To: <CAJieiUi1p31mrRRP2=X-Z-8fWyfea2JVMgmponMwrUzQF-OyoA@mail.gmail.com>
From: Roopa Prabhu <roopa@cumulusnetworks.com>
Date: Wed, 16 May 2018 13:30:28 -0700
> yes, but we hold rcu read lock before calling the reply function for
> fib result. I did consider allocating the skb before the read
> lock..but then the refactoring (into a separate netlink reply func)
> would seem unnecessary.
>
> I am fine with pre-allocating and undoing the refactoring if that works better.
Hmmm... I also notice that with this change we end up doing the
rtnl_unicast() under the RCU lock which is unnecessary too.
So yes, please pull the "out_skb" allocation before the
rcu_read_lock(), and push the rtnl_unicast() after the
rcu_read_unlock().
It really is a shame that sharing the ETH_P_IP skb between the route
route lookup and the netlink response doesn't work properly.
I was using RTM_GETROUTE at one point for route/fib lookup performance
measurements. It never was great at that, but now that there is going
to be two SKB allocations instead of one it is going to be even less
useful for that kind of usage.
^ permalink raw reply
* Re: pull-request: bpf-next 2018-05-17
From: David Miller @ 2018-05-17 2:47 UTC (permalink / raw)
To: daniel; +Cc: ast, netdev
In-Reply-To: <20180517010948.21249-1-daniel@iogearbox.net>
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Thu, 17 May 2018 03:09:48 +0200
> The following pull-request contains BPF updates for your *net-next*
> tree.
Looks good, pulled, thanks Daniel.
^ permalink raw reply
* Re: xdp and fragments with virtio
From: David Ahern @ 2018-05-17 2:55 UTC (permalink / raw)
To: Jason Wang, netdev@vger.kernel.org
In-Reply-To: <4d6952b4-b252-2fe5-8893-a3e2329bd34b@redhat.com>
On 5/16/18 1:24 AM, Jason Wang wrote:
>
>
> On 2018年05月16日 11:51, David Ahern wrote:
>> Hi Jason:
>>
>> I am trying to test MTU changes to the BPF fib_lookup helper and seeing
>> something odd. Hoping you can help.
>>
>> I have a VM with multiple virtio based NICs and tap backends. I install
>> the xdp program on eth1 and eth2 to do forwarding. In the host I send a
>> large packet to eth1:
>>
>> $ ping -s 1500 9.9.9.9
>>
>>
>> The tap device in the host sees 2 packets:
>>
>> $ sudo tcpdump -nv -i vm02-eth1
>> 20:44:33.943160 IP (tos 0x0, ttl 64, id 58746, offset 0, flags [+],
>> proto ICMP (1), length 1500)
>> 10.100.1.254 > 9.9.9.9: ICMP echo request, id 17917, seq 1,
>> length 1480
>> 20:44:33.943172 IP (tos 0x0, ttl 64, id 58746, offset 1480, flags
>> [none], proto ICMP (1), length 48)
>> 10.100.1.254 > 9.9.9.9: ip-proto-1
>>
>>
>> In the VM, the XDP program only sees the first packet, not the fragment.
>> I added a printk to the program (see diff below):
>>
>> $ cat trace_pipe
>> <idle>-0 [003] ..s2 254.436467: 0: packet length 1514
>>
>>
>> Anything come to mind in the virtio xdp implementation that affects
>> fragment packets? I see this with both IPv4 and v6.
>
> Not yet. But we do turn of tap gso when virtio has XDP set, but it
> shouldn't matter this case.
>
> Will try to see what's wrong.
>
I added this to the command line for the NICs and it works:
"mrg_rxbuf=off,guest_tso4=off,guest_tso6=off,guest_ecn=off,guest_ufo=off"
XDP program sees the full size packet and the fragment.
Fun fact: only adding mrg_rxbuf=off so that mergeable_rx_bufs is false
but big_packets is true generates a panic when it receives large packets.
^ permalink raw reply
* Re: [PATCH net-next 1/3] net: ethernet: ti: Allow most drivers with COMPILE_TEST
From: kbuild test robot @ 2018-05-17 3:02 UTC (permalink / raw)
To: Florian Fainelli
Cc: kbuild-all, netdev, Florian Fainelli, David S. Miller,
Andrew Lunn, open list
In-Reply-To: <20180515234825.11240-2-f.fainelli@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 10386 bytes --]
Hi Florian,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-Allow-more-drivers-with-COMPILE_TEST/20180517-092807
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from arch/x86/include/asm/realmode.h:15:0,
from arch/x86/include/asm/acpi.h:33,
from arch/x86/include/asm/fixmap.h:19,
from arch/x86/include/asm/apic.h:10,
from arch/x86/include/asm/smp.h:13,
from include/linux/smp.h:64,
from include/linux/topology.h:33,
from include/linux/gfp.h:9,
from include/linux/idr.h:16,
from include/linux/kernfs.h:14,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/device.h:16,
from drivers/net/ethernet/ti/davinci_cpdma.c:17:
drivers/net/ethernet/ti/davinci_cpdma.c: In function 'cpdma_chan_submit':
>> drivers/net/ethernet/ti/davinci_cpdma.c:1083:17: warning: passing argument 1 of '__writel' makes integer from pointer without a cast [-Wint-conversion]
writel_relaxed(token, &desc->sw_token);
^
arch/x86/include/asm/io.h:88:39: note: in definition of macro 'writel_relaxed'
#define writel_relaxed(v, a) __writel(v, a)
^
arch/x86/include/asm/io.h:71:18: note: expected 'unsigned int' but argument is of type 'void *'
build_mmio_write(__writel, "l", unsigned int, "r", )
^
arch/x86/include/asm/io.h:53:20: note: in definition of macro 'build_mmio_write'
static inline void name(type val, volatile void __iomem *addr) \
^~~~
vim +/__writel +1083 drivers/net/ethernet/ti/davinci_cpdma.c
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1029
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1030 int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data,
aef614e1 drivers/net/ethernet/ti/davinci_cpdma.c Sebastian Siewior 2013-04-23 1031 int len, int directed)
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1032 {
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1033 struct cpdma_ctlr *ctlr = chan->ctlr;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1034 struct cpdma_desc __iomem *desc;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1035 dma_addr_t buffer;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1036 unsigned long flags;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1037 u32 mode;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1038 int ret = 0;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1039
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1040 spin_lock_irqsave(&chan->lock, flags);
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1041
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1042 if (chan->state == CPDMA_STATE_TEARDOWN) {
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1043 ret = -EINVAL;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1044 goto unlock_ret;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1045 }
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1046
742fb20f drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2016-06-27 1047 if (chan->count >= chan->desc_num) {
742fb20f drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2016-06-27 1048 chan->stats.desc_alloc_fail++;
742fb20f drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2016-06-27 1049 ret = -ENOMEM;
742fb20f drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2016-06-27 1050 goto unlock_ret;
742fb20f drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2016-06-27 1051 }
742fb20f drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2016-06-27 1052
742fb20f drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2016-06-27 1053 desc = cpdma_desc_alloc(ctlr->pool);
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1054 if (!desc) {
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1055 chan->stats.desc_alloc_fail++;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1056 ret = -ENOMEM;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1057 goto unlock_ret;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1058 }
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1059
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1060 if (len < ctlr->params.min_packet_size) {
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1061 len = ctlr->params.min_packet_size;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1062 chan->stats.runt_transmit_buff++;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1063 }
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1064
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1065 buffer = dma_map_single(ctlr->dev, data, len, chan->dir);
14bd0769 drivers/net/ethernet/ti/davinci_cpdma.c Sebastian Siewior 2013-06-20 1066 ret = dma_mapping_error(ctlr->dev, buffer);
14bd0769 drivers/net/ethernet/ti/davinci_cpdma.c Sebastian Siewior 2013-06-20 1067 if (ret) {
14bd0769 drivers/net/ethernet/ti/davinci_cpdma.c Sebastian Siewior 2013-06-20 1068 cpdma_desc_free(ctlr->pool, desc, 1);
14bd0769 drivers/net/ethernet/ti/davinci_cpdma.c Sebastian Siewior 2013-06-20 1069 ret = -EINVAL;
14bd0769 drivers/net/ethernet/ti/davinci_cpdma.c Sebastian Siewior 2013-06-20 1070 goto unlock_ret;
14bd0769 drivers/net/ethernet/ti/davinci_cpdma.c Sebastian Siewior 2013-06-20 1071 }
14bd0769 drivers/net/ethernet/ti/davinci_cpdma.c Sebastian Siewior 2013-06-20 1072
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1073 mode = CPDMA_DESC_OWNER | CPDMA_DESC_SOP | CPDMA_DESC_EOP;
f6e135c8 drivers/net/ethernet/ti/davinci_cpdma.c Mugunthan V N 2013-02-11 1074 cpdma_desc_to_port(chan, mode, directed);
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1075
a6c83ccf drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2017-01-06 1076 /* Relaxed IO accessors can be used here as there is read barrier
a6c83ccf drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2017-01-06 1077 * at the end of write sequence.
a6c83ccf drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2017-01-06 1078 */
a6c83ccf drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2017-01-06 1079 writel_relaxed(0, &desc->hw_next);
a6c83ccf drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2017-01-06 1080 writel_relaxed(buffer, &desc->hw_buffer);
a6c83ccf drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2017-01-06 1081 writel_relaxed(len, &desc->hw_len);
a6c83ccf drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2017-01-06 1082 writel_relaxed(mode | len, &desc->hw_mode);
a6c83ccf drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2017-01-06 @1083 writel_relaxed(token, &desc->sw_token);
a6c83ccf drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2017-01-06 1084 writel_relaxed(buffer, &desc->sw_buffer);
a6c83ccf drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2017-01-06 1085 writel_relaxed(len, &desc->sw_len);
a6c83ccf drivers/net/ethernet/ti/davinci_cpdma.c Grygorii Strashko 2017-01-06 1086 desc_read(desc, sw_len);
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1087
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1088 __cpdma_chan_submit(chan, desc);
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1089
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1090 if (chan->state == CPDMA_STATE_ACTIVE && chan->rxfree)
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1091 chan_write(chan, rxfree, 1);
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1092
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1093 chan->count++;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1094
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1095 unlock_ret:
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1096 spin_unlock_irqrestore(&chan->lock, flags);
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1097 return ret;
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1098 }
32a6d90b drivers/net/ethernet/ti/davinci_cpdma.c Arnd Bergmann 2012-04-20 1099 EXPORT_SYMBOL_GPL(cpdma_chan_submit);
ef8c2dab drivers/net/davinci_cpdma.c Cyril Chemparathy 2010-09-15 1100
:::::: The code at line 1083 was first introduced by commit
:::::: a6c83ccf3c534214e0aeb167a70391864da9b1fc net: ethernet: ti: cpdma: am437x: allow descs to be plased in ddr
:::::: TO: Grygorii Strashko <grygorii.strashko@ti.com>
:::::: CC: David S. Miller <davem@davemloft.net>
---
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: 63048 bytes --]
^ permalink raw reply
* Re: Donation
From: M.M. Fridman @ 2018-05-15 2:11 UTC (permalink / raw)
I Mikhail Fridman. has selected you specially as one of my beneficiaries
for my Charitable Donation, Just as I have declared on May 23, 2016 to give
my fortune as charity.
Check the link below for confirmation:
http://www.ibtimes.co.uk/russias-second-wealthiest-man-mikhail-fridman-plans-leaving-14-2bn-fortune-charity-1561604
Reply as soon as possible with further directives.
Best Regards,
Mikhail Fridman.
^ permalink raw reply
* Re: [PATCH net-next 2/3] net: ethernet: freescale: Allow FEC with COMPILE_TEST
From: kbuild test robot @ 2018-05-17 3:38 UTC (permalink / raw)
To: Florian Fainelli
Cc: kbuild-all, netdev, Florian Fainelli, David S. Miller,
Andrew Lunn, open list
In-Reply-To: <20180515234825.11240-3-f.fainelli@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 29906 bytes --]
Hi Florian,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-Allow-more-drivers-with-COMPILE_TEST/20180517-092807
config: m68k-allyesconfig (attached as .config)
compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k
All warnings (new ones prefixed by >>):
In file included from include/linux/swab.h:5:0,
from include/uapi/linux/byteorder/big_endian.h:13,
from include/linux/byteorder/big_endian.h:5,
from arch/m68k/include/uapi/asm/byteorder.h:5,
from include/asm-generic/bitops/le.h:6,
from arch/m68k/include/asm/bitops.h:519,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/module.h:9,
from drivers/net/ethernet/freescale/fec_main.c:24:
drivers/net/ethernet/freescale/fec_main.c: In function 'fec_restart':
drivers/net/ethernet/freescale/fec_main.c:959:26: error: 'FEC_RACC' undeclared (first use in this function); did you mean 'FEC_RXIC0'?
val = readl(fep->hwp + FEC_RACC);
^
include/uapi/linux/swab.h:117:32: note: in definition of macro '__swab32'
(__builtin_constant_p((__u32)(x)) ? \
^
>> include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__le32_to_cpu'
#define le32_to_cpu __le32_to_cpu
^~~~~~~~~~~~~
>> arch/m68k/include/asm/io_mm.h:452:26: note: in expansion of macro 'in_le32'
#define readl(addr) in_le32(addr)
^~~~~~~
>> drivers/net/ethernet/freescale/fec_main.c:959:9: note: in expansion of macro 'readl'
val = readl(fep->hwp + FEC_RACC);
^~~~~
drivers/net/ethernet/freescale/fec_main.c:959:26: note: each undeclared identifier is reported only once for each function it appears in
val = readl(fep->hwp + FEC_RACC);
^
include/uapi/linux/swab.h:117:32: note: in definition of macro '__swab32'
(__builtin_constant_p((__u32)(x)) ? \
^
>> include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__le32_to_cpu'
#define le32_to_cpu __le32_to_cpu
^~~~~~~~~~~~~
>> arch/m68k/include/asm/io_mm.h:452:26: note: in expansion of macro 'in_le32'
#define readl(addr) in_le32(addr)
^~~~~~~
>> drivers/net/ethernet/freescale/fec_main.c:959:9: note: in expansion of macro 'readl'
val = readl(fep->hwp + FEC_RACC);
^~~~~
In file included from arch/m68k/include/asm/io_mm.h:27:0,
from arch/m68k/include/asm/io.h:5,
from include/linux/scatterlist.h:9,
from include/linux/dma-mapping.h:11,
from include/linux/skbuff.h:34,
from include/linux/if_ether.h:23,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from include/linux/netdevice.h:41,
from drivers/net/ethernet/freescale/fec_main.c:34:
drivers/net/ethernet/freescale/fec_main.c:968:38: error: 'FEC_FTRL' undeclared (first use in this function); did you mean 'FEC_ECNTRL'?
writel(PKT_MAXBUF_SIZE, fep->hwp + FEC_FTRL);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
>> drivers/net/ethernet/freescale/fec_main.c:968:3: note: in expansion of macro 'writel'
writel(PKT_MAXBUF_SIZE, fep->hwp + FEC_FTRL);
^~~~~~
drivers/net/ethernet/freescale/fec_main.c:1034:38: error: 'FEC_R_FIFO_RSEM' undeclared (first use in this function); did you mean 'FEC_FIFO_RAM'?
writel(FEC_ENET_RSEM_V, fep->hwp + FEC_R_FIFO_RSEM);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net/ethernet/freescale/fec_main.c:1034:3: note: in expansion of macro 'writel'
writel(FEC_ENET_RSEM_V, fep->hwp + FEC_R_FIFO_RSEM);
^~~~~~
drivers/net/ethernet/freescale/fec_main.c:1035:38: error: 'FEC_R_FIFO_RSFL' undeclared (first use in this function); did you mean 'FEC_R_FIFO_RSEM'?
writel(FEC_ENET_RSFL_V, fep->hwp + FEC_R_FIFO_RSFL);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net/ethernet/freescale/fec_main.c:1035:3: note: in expansion of macro 'writel'
writel(FEC_ENET_RSFL_V, fep->hwp + FEC_R_FIFO_RSFL);
^~~~~~
drivers/net/ethernet/freescale/fec_main.c:1036:38: error: 'FEC_R_FIFO_RAEM' undeclared (first use in this function); did you mean 'FEC_R_FIFO_RSEM'?
writel(FEC_ENET_RAEM_V, fep->hwp + FEC_R_FIFO_RAEM);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net/ethernet/freescale/fec_main.c:1036:3: note: in expansion of macro 'writel'
writel(FEC_ENET_RAEM_V, fep->hwp + FEC_R_FIFO_RAEM);
^~~~~~
drivers/net/ethernet/freescale/fec_main.c:1037:38: error: 'FEC_R_FIFO_RAFL' undeclared (first use in this function); did you mean 'FEC_R_FIFO_RSFL'?
writel(FEC_ENET_RAFL_V, fep->hwp + FEC_R_FIFO_RAFL);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net/ethernet/freescale/fec_main.c:1037:3: note: in expansion of macro 'writel'
writel(FEC_ENET_RAFL_V, fep->hwp + FEC_R_FIFO_RAFL);
^~~~~~
drivers/net/ethernet/freescale/fec_main.c:1040:37: error: 'FEC_OPD' undeclared (first use in this function); did you mean 'FEC_H'?
writel(FEC_ENET_OPD_V, fep->hwp + FEC_OPD);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net/ethernet/freescale/fec_main.c:1040:3: note: in expansion of macro 'writel'
writel(FEC_ENET_OPD_V, fep->hwp + FEC_OPD);
^~~~~~
drivers/net/ethernet/freescale/fec_main.c:1051:23: error: 'FEC_HASH_TABLE_HIGH' undeclared (first use in this function); did you mean 'FEC_GRP_HASH_TABLE_HIGH'?
writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net/ethernet/freescale/fec_main.c:1051:2: note: in expansion of macro 'writel'
writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
^~~~~~
drivers/net/ethernet/freescale/fec_main.c:1052:23: error: 'FEC_HASH_TABLE_LOW' undeclared (first use in this function); did you mean 'FEC_HASH_TABLE_HIGH'?
writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net/ethernet/freescale/fec_main.c:1052:2: note: in expansion of macro 'writel'
writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
^~~~~~
drivers/net/ethernet/freescale/fec_main.c:1067:29: error: 'FEC_MIB_CTRLSTAT' undeclared (first use in this function); did you mean 'TCP_MIB_CURRESTAB'?
writel(0 << 31, fep->hwp + FEC_MIB_CTRLSTAT);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net/ethernet/freescale/fec_main.c:1067:2: note: in expansion of macro 'writel'
writel(0 << 31, fep->hwp + FEC_MIB_CTRLSTAT);
^~~~~~
drivers/net/ethernet/freescale/fec_main.c: At top level:
drivers/net/ethernet/freescale/fec_main.c:2261:18: error: 'RMON_T_DROP' undeclared here (not in a function); did you mean 'RTN_THROW'?
{ "tx_dropped", RMON_T_DROP },
^~~~~~~~~~~
RTN_THROW
drivers/net/ethernet/freescale/fec_main.c:2262:18: error: 'RMON_T_PACKETS' undeclared here (not in a function); did you mean 'SOCK_PACKET'?
{ "tx_packets", RMON_T_PACKETS },
^~~~~~~~~~~~~~
SOCK_PACKET
drivers/net/ethernet/freescale/fec_main.c:2263:20: error: 'RMON_T_BC_PKT' undeclared here (not in a function); did you mean 'RMON_T_DROP'?
{ "tx_broadcast", RMON_T_BC_PKT },
^~~~~~~~~~~~~
RMON_T_DROP
drivers/net/ethernet/freescale/fec_main.c:2264:20: error: 'RMON_T_MC_PKT' undeclared here (not in a function); did you mean 'RMON_T_BC_PKT'?
{ "tx_multicast", RMON_T_MC_PKT },
^~~~~~~~~~~~~
RMON_T_BC_PKT
drivers/net/ethernet/freescale/fec_main.c:2265:21: error: 'RMON_T_CRC_ALIGN' undeclared here (not in a function); did you mean 'RMON_T_MC_PKT'?
{ "tx_crc_errors", RMON_T_CRC_ALIGN },
^~~~~~~~~~~~~~~~
RMON_T_MC_PKT
drivers/net/ethernet/freescale/fec_main.c:2266:20: error: 'RMON_T_UNDERSIZE' undeclared here (not in a function); did you mean 'RMON_T_DROP'?
{ "tx_undersize", RMON_T_UNDERSIZE },
^~~~~~~~~~~~~~~~
RMON_T_DROP
drivers/net/ethernet/freescale/fec_main.c:2267:19: error: 'RMON_T_OVERSIZE' undeclared here (not in a function); did you mean 'RMON_T_UNDERSIZE'?
--
In file included from include/linux/swab.h:5:0,
from include/uapi/linux/byteorder/big_endian.h:13,
from include/linux/byteorder/big_endian.h:5,
from arch/m68k/include/uapi/asm/byteorder.h:5,
from include/asm-generic/bitops/le.h:6,
from arch/m68k/include/asm/bitops.h:519,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/module.h:9,
from drivers/net//ethernet/freescale/fec_main.c:24:
drivers/net//ethernet/freescale/fec_main.c: In function 'fec_restart':
drivers/net//ethernet/freescale/fec_main.c:959:26: error: 'FEC_RACC' undeclared (first use in this function); did you mean 'FEC_RXIC0'?
val = readl(fep->hwp + FEC_RACC);
^
include/uapi/linux/swab.h:117:32: note: in definition of macro '__swab32'
(__builtin_constant_p((__u32)(x)) ? \
^
>> include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__le32_to_cpu'
#define le32_to_cpu __le32_to_cpu
^~~~~~~~~~~~~
>> arch/m68k/include/asm/io_mm.h:452:26: note: in expansion of macro 'in_le32'
#define readl(addr) in_le32(addr)
^~~~~~~
drivers/net//ethernet/freescale/fec_main.c:959:9: note: in expansion of macro 'readl'
val = readl(fep->hwp + FEC_RACC);
^~~~~
drivers/net//ethernet/freescale/fec_main.c:959:26: note: each undeclared identifier is reported only once for each function it appears in
val = readl(fep->hwp + FEC_RACC);
^
include/uapi/linux/swab.h:117:32: note: in definition of macro '__swab32'
(__builtin_constant_p((__u32)(x)) ? \
^
>> include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__le32_to_cpu'
#define le32_to_cpu __le32_to_cpu
^~~~~~~~~~~~~
>> arch/m68k/include/asm/io_mm.h:452:26: note: in expansion of macro 'in_le32'
#define readl(addr) in_le32(addr)
^~~~~~~
drivers/net//ethernet/freescale/fec_main.c:959:9: note: in expansion of macro 'readl'
val = readl(fep->hwp + FEC_RACC);
^~~~~
In file included from arch/m68k/include/asm/io_mm.h:27:0,
from arch/m68k/include/asm/io.h:5,
from include/linux/scatterlist.h:9,
from include/linux/dma-mapping.h:11,
from include/linux/skbuff.h:34,
from include/linux/if_ether.h:23,
from include/uapi/linux/ethtool.h:19,
from include/linux/ethtool.h:18,
from include/linux/netdevice.h:41,
from drivers/net//ethernet/freescale/fec_main.c:34:
drivers/net//ethernet/freescale/fec_main.c:968:38: error: 'FEC_FTRL' undeclared (first use in this function); did you mean 'FEC_ECNTRL'?
writel(PKT_MAXBUF_SIZE, fep->hwp + FEC_FTRL);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net//ethernet/freescale/fec_main.c:968:3: note: in expansion of macro 'writel'
writel(PKT_MAXBUF_SIZE, fep->hwp + FEC_FTRL);
^~~~~~
drivers/net//ethernet/freescale/fec_main.c:1034:38: error: 'FEC_R_FIFO_RSEM' undeclared (first use in this function); did you mean 'FEC_FIFO_RAM'?
writel(FEC_ENET_RSEM_V, fep->hwp + FEC_R_FIFO_RSEM);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net//ethernet/freescale/fec_main.c:1034:3: note: in expansion of macro 'writel'
writel(FEC_ENET_RSEM_V, fep->hwp + FEC_R_FIFO_RSEM);
^~~~~~
drivers/net//ethernet/freescale/fec_main.c:1035:38: error: 'FEC_R_FIFO_RSFL' undeclared (first use in this function); did you mean 'FEC_R_FIFO_RSEM'?
writel(FEC_ENET_RSFL_V, fep->hwp + FEC_R_FIFO_RSFL);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net//ethernet/freescale/fec_main.c:1035:3: note: in expansion of macro 'writel'
writel(FEC_ENET_RSFL_V, fep->hwp + FEC_R_FIFO_RSFL);
^~~~~~
drivers/net//ethernet/freescale/fec_main.c:1036:38: error: 'FEC_R_FIFO_RAEM' undeclared (first use in this function); did you mean 'FEC_R_FIFO_RSEM'?
writel(FEC_ENET_RAEM_V, fep->hwp + FEC_R_FIFO_RAEM);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net//ethernet/freescale/fec_main.c:1036:3: note: in expansion of macro 'writel'
writel(FEC_ENET_RAEM_V, fep->hwp + FEC_R_FIFO_RAEM);
^~~~~~
drivers/net//ethernet/freescale/fec_main.c:1037:38: error: 'FEC_R_FIFO_RAFL' undeclared (first use in this function); did you mean 'FEC_R_FIFO_RSFL'?
writel(FEC_ENET_RAFL_V, fep->hwp + FEC_R_FIFO_RAFL);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net//ethernet/freescale/fec_main.c:1037:3: note: in expansion of macro 'writel'
writel(FEC_ENET_RAFL_V, fep->hwp + FEC_R_FIFO_RAFL);
^~~~~~
drivers/net//ethernet/freescale/fec_main.c:1040:37: error: 'FEC_OPD' undeclared (first use in this function); did you mean 'FEC_H'?
writel(FEC_ENET_OPD_V, fep->hwp + FEC_OPD);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net//ethernet/freescale/fec_main.c:1040:3: note: in expansion of macro 'writel'
writel(FEC_ENET_OPD_V, fep->hwp + FEC_OPD);
^~~~~~
drivers/net//ethernet/freescale/fec_main.c:1051:23: error: 'FEC_HASH_TABLE_HIGH' undeclared (first use in this function); did you mean 'FEC_GRP_HASH_TABLE_HIGH'?
writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net//ethernet/freescale/fec_main.c:1051:2: note: in expansion of macro 'writel'
writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
^~~~~~
drivers/net//ethernet/freescale/fec_main.c:1052:23: error: 'FEC_HASH_TABLE_LOW' undeclared (first use in this function); did you mean 'FEC_HASH_TABLE_HIGH'?
writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net//ethernet/freescale/fec_main.c:1052:2: note: in expansion of macro 'writel'
writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
^~~~~~
drivers/net//ethernet/freescale/fec_main.c:1067:29: error: 'FEC_MIB_CTRLSTAT' undeclared (first use in this function); did you mean 'TCP_MIB_CURRESTAB'?
writel(0 << 31, fep->hwp + FEC_MIB_CTRLSTAT);
^
arch/m68k/include/asm/raw_io.h:48:64: note: in definition of macro 'out_le32'
#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
^~~~
drivers/net//ethernet/freescale/fec_main.c:1067:2: note: in expansion of macro 'writel'
writel(0 << 31, fep->hwp + FEC_MIB_CTRLSTAT);
^~~~~~
drivers/net//ethernet/freescale/fec_main.c: At top level:
drivers/net//ethernet/freescale/fec_main.c:2261:18: error: 'RMON_T_DROP' undeclared here (not in a function); did you mean 'RTN_THROW'?
{ "tx_dropped", RMON_T_DROP },
^~~~~~~~~~~
vim +/__le32_to_cpu +89 include/linux/byteorder/generic.h
^1da177e Linus Torvalds 2005-04-16 4
^1da177e Linus Torvalds 2005-04-16 5 /*
90a85643 Geoff Levand 2014-08-06 6 * linux/byteorder/generic.h
^1da177e Linus Torvalds 2005-04-16 7 * Generic Byte-reordering support
^1da177e Linus Torvalds 2005-04-16 8 *
e0487992 Ed L. Cashin 2005-09-19 9 * The "... p" macros, like le64_to_cpup, can be used with pointers
e0487992 Ed L. Cashin 2005-09-19 10 * to unaligned data, but there will be a performance penalty on
e0487992 Ed L. Cashin 2005-09-19 11 * some architectures. Use get_unaligned for unaligned data.
e0487992 Ed L. Cashin 2005-09-19 12 *
^1da177e Linus Torvalds 2005-04-16 13 * Francois-Rene Rideau <fare@tunes.org> 19970707
^1da177e Linus Torvalds 2005-04-16 14 * gathered all the good ideas from all asm-foo/byteorder.h into one file,
^1da177e Linus Torvalds 2005-04-16 15 * cleaned them up.
^1da177e Linus Torvalds 2005-04-16 16 * I hope it is compliant with non-GCC compilers.
^1da177e Linus Torvalds 2005-04-16 17 * I decided to put __BYTEORDER_HAS_U64__ in byteorder.h,
^1da177e Linus Torvalds 2005-04-16 18 * because I wasn't sure it would be ok to put it in types.h
^1da177e Linus Torvalds 2005-04-16 19 * Upgraded it to 2.1.43
^1da177e Linus Torvalds 2005-04-16 20 * Francois-Rene Rideau <fare@tunes.org> 19971012
^1da177e Linus Torvalds 2005-04-16 21 * Upgraded it to 2.1.57
^1da177e Linus Torvalds 2005-04-16 22 * to please Linus T., replaced huge #ifdef's between little/big endian
^1da177e Linus Torvalds 2005-04-16 23 * by nestedly #include'd files.
^1da177e Linus Torvalds 2005-04-16 24 * Francois-Rene Rideau <fare@tunes.org> 19971205
^1da177e Linus Torvalds 2005-04-16 25 * Made it to 2.1.71; now a facelift:
^1da177e Linus Torvalds 2005-04-16 26 * Put files under include/linux/byteorder/
^1da177e Linus Torvalds 2005-04-16 27 * Split swab from generic support.
^1da177e Linus Torvalds 2005-04-16 28 *
^1da177e Linus Torvalds 2005-04-16 29 * TODO:
^1da177e Linus Torvalds 2005-04-16 30 * = Regular kernel maintainers could also replace all these manual
^1da177e Linus Torvalds 2005-04-16 31 * byteswap macros that remain, disseminated among drivers,
^1da177e Linus Torvalds 2005-04-16 32 * after some grep or the sources...
^1da177e Linus Torvalds 2005-04-16 33 * = Linus might want to rename all these macros and files to fit his taste,
^1da177e Linus Torvalds 2005-04-16 34 * to fit his personal naming scheme.
^1da177e Linus Torvalds 2005-04-16 35 * = it seems that a few drivers would also appreciate
^1da177e Linus Torvalds 2005-04-16 36 * nybble swapping support...
^1da177e Linus Torvalds 2005-04-16 37 * = every architecture could add their byteswap macro in asm/byteorder.h
^1da177e Linus Torvalds 2005-04-16 38 * see how some architectures already do (i386, alpha, ppc, etc)
^1da177e Linus Torvalds 2005-04-16 39 * = cpu_to_beXX and beXX_to_cpu might some day need to be well
^1da177e Linus Torvalds 2005-04-16 40 * distinguished throughout the kernel. This is not the case currently,
^1da177e Linus Torvalds 2005-04-16 41 * since little endian, big endian, and pdp endian machines needn't it.
^1da177e Linus Torvalds 2005-04-16 42 * But this might be the case for, say, a port of Linux to 20/21 bit
^1da177e Linus Torvalds 2005-04-16 43 * architectures (and F21 Linux addict around?).
^1da177e Linus Torvalds 2005-04-16 44 */
^1da177e Linus Torvalds 2005-04-16 45
^1da177e Linus Torvalds 2005-04-16 46 /*
^1da177e Linus Torvalds 2005-04-16 47 * The following macros are to be defined by <asm/byteorder.h>:
^1da177e Linus Torvalds 2005-04-16 48 *
^1da177e Linus Torvalds 2005-04-16 49 * Conversion of long and short int between network and host format
^1da177e Linus Torvalds 2005-04-16 50 * ntohl(__u32 x)
^1da177e Linus Torvalds 2005-04-16 51 * ntohs(__u16 x)
^1da177e Linus Torvalds 2005-04-16 52 * htonl(__u32 x)
^1da177e Linus Torvalds 2005-04-16 53 * htons(__u16 x)
^1da177e Linus Torvalds 2005-04-16 54 * It seems that some programs (which? where? or perhaps a standard? POSIX?)
^1da177e Linus Torvalds 2005-04-16 55 * might like the above to be functions, not macros (why?).
^1da177e Linus Torvalds 2005-04-16 56 * if that's true, then detect them, and take measures.
^1da177e Linus Torvalds 2005-04-16 57 * Anyway, the measure is: define only ___ntohl as a macro instead,
^1da177e Linus Torvalds 2005-04-16 58 * and in a separate file, have
^1da177e Linus Torvalds 2005-04-16 59 * unsigned long inline ntohl(x){return ___ntohl(x);}
^1da177e Linus Torvalds 2005-04-16 60 *
^1da177e Linus Torvalds 2005-04-16 61 * The same for constant arguments
^1da177e Linus Torvalds 2005-04-16 62 * __constant_ntohl(__u32 x)
^1da177e Linus Torvalds 2005-04-16 63 * __constant_ntohs(__u16 x)
^1da177e Linus Torvalds 2005-04-16 64 * __constant_htonl(__u32 x)
^1da177e Linus Torvalds 2005-04-16 65 * __constant_htons(__u16 x)
^1da177e Linus Torvalds 2005-04-16 66 *
^1da177e Linus Torvalds 2005-04-16 67 * Conversion of XX-bit integers (16- 32- or 64-)
^1da177e Linus Torvalds 2005-04-16 68 * between native CPU format and little/big endian format
^1da177e Linus Torvalds 2005-04-16 69 * 64-bit stuff only defined for proper architectures
^1da177e Linus Torvalds 2005-04-16 70 * cpu_to_[bl]eXX(__uXX x)
^1da177e Linus Torvalds 2005-04-16 71 * [bl]eXX_to_cpu(__uXX x)
^1da177e Linus Torvalds 2005-04-16 72 *
^1da177e Linus Torvalds 2005-04-16 73 * The same, but takes a pointer to the value to convert
^1da177e Linus Torvalds 2005-04-16 74 * cpu_to_[bl]eXXp(__uXX x)
^1da177e Linus Torvalds 2005-04-16 75 * [bl]eXX_to_cpup(__uXX x)
^1da177e Linus Torvalds 2005-04-16 76 *
^1da177e Linus Torvalds 2005-04-16 77 * The same, but change in situ
^1da177e Linus Torvalds 2005-04-16 78 * cpu_to_[bl]eXXs(__uXX x)
^1da177e Linus Torvalds 2005-04-16 79 * [bl]eXX_to_cpus(__uXX x)
^1da177e Linus Torvalds 2005-04-16 80 *
^1da177e Linus Torvalds 2005-04-16 81 * See asm-foo/byteorder.h for examples of how to provide
^1da177e Linus Torvalds 2005-04-16 82 * architecture-optimized versions
^1da177e Linus Torvalds 2005-04-16 83 *
^1da177e Linus Torvalds 2005-04-16 84 */
^1da177e Linus Torvalds 2005-04-16 85
^1da177e Linus Torvalds 2005-04-16 86 #define cpu_to_le64 __cpu_to_le64
^1da177e Linus Torvalds 2005-04-16 87 #define le64_to_cpu __le64_to_cpu
^1da177e Linus Torvalds 2005-04-16 88 #define cpu_to_le32 __cpu_to_le32
^1da177e Linus Torvalds 2005-04-16 @89 #define le32_to_cpu __le32_to_cpu
^1da177e Linus Torvalds 2005-04-16 90 #define cpu_to_le16 __cpu_to_le16
^1da177e Linus Torvalds 2005-04-16 91 #define le16_to_cpu __le16_to_cpu
^1da177e Linus Torvalds 2005-04-16 92 #define cpu_to_be64 __cpu_to_be64
^1da177e Linus Torvalds 2005-04-16 93 #define be64_to_cpu __be64_to_cpu
^1da177e Linus Torvalds 2005-04-16 94 #define cpu_to_be32 __cpu_to_be32
^1da177e Linus Torvalds 2005-04-16 95 #define be32_to_cpu __be32_to_cpu
^1da177e Linus Torvalds 2005-04-16 96 #define cpu_to_be16 __cpu_to_be16
^1da177e Linus Torvalds 2005-04-16 97 #define be16_to_cpu __be16_to_cpu
^1da177e Linus Torvalds 2005-04-16 98 #define cpu_to_le64p __cpu_to_le64p
^1da177e Linus Torvalds 2005-04-16 99 #define le64_to_cpup __le64_to_cpup
^1da177e Linus Torvalds 2005-04-16 100 #define cpu_to_le32p __cpu_to_le32p
^1da177e Linus Torvalds 2005-04-16 101 #define le32_to_cpup __le32_to_cpup
^1da177e Linus Torvalds 2005-04-16 102 #define cpu_to_le16p __cpu_to_le16p
^1da177e Linus Torvalds 2005-04-16 103 #define le16_to_cpup __le16_to_cpup
^1da177e Linus Torvalds 2005-04-16 104 #define cpu_to_be64p __cpu_to_be64p
^1da177e Linus Torvalds 2005-04-16 105 #define be64_to_cpup __be64_to_cpup
^1da177e Linus Torvalds 2005-04-16 106 #define cpu_to_be32p __cpu_to_be32p
^1da177e Linus Torvalds 2005-04-16 107 #define be32_to_cpup __be32_to_cpup
^1da177e Linus Torvalds 2005-04-16 108 #define cpu_to_be16p __cpu_to_be16p
^1da177e Linus Torvalds 2005-04-16 109 #define be16_to_cpup __be16_to_cpup
^1da177e Linus Torvalds 2005-04-16 110 #define cpu_to_le64s __cpu_to_le64s
^1da177e Linus Torvalds 2005-04-16 111 #define le64_to_cpus __le64_to_cpus
^1da177e Linus Torvalds 2005-04-16 112 #define cpu_to_le32s __cpu_to_le32s
^1da177e Linus Torvalds 2005-04-16 113 #define le32_to_cpus __le32_to_cpus
^1da177e Linus Torvalds 2005-04-16 114 #define cpu_to_le16s __cpu_to_le16s
^1da177e Linus Torvalds 2005-04-16 115 #define le16_to_cpus __le16_to_cpus
^1da177e Linus Torvalds 2005-04-16 116 #define cpu_to_be64s __cpu_to_be64s
^1da177e Linus Torvalds 2005-04-16 117 #define be64_to_cpus __be64_to_cpus
^1da177e Linus Torvalds 2005-04-16 118 #define cpu_to_be32s __cpu_to_be32s
^1da177e Linus Torvalds 2005-04-16 119 #define be32_to_cpus __be32_to_cpus
^1da177e Linus Torvalds 2005-04-16 120 #define cpu_to_be16s __cpu_to_be16s
^1da177e Linus Torvalds 2005-04-16 121 #define be16_to_cpus __be16_to_cpus
^1da177e Linus Torvalds 2005-04-16 122
:::::: The code at line 89 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>
---
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: 45454 bytes --]
^ permalink raw reply
* [PATCH net-next] vmxnet3: Replace msleep(1) with usleep_range()
From: YueHaibing @ 2018-05-17 3:46 UTC (permalink / raw)
To: doshir, pv-drivers, davem; +Cc: netdev, linux-kernel, YueHaibing
As documented in Documentation/timers/timers-howto.txt,
replace msleep(1) with usleep_range().
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/vmxnet3/vmxnet3_drv.c | 6 +++---
drivers/net/vmxnet3/vmxnet3_ethtool.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 9ebe2a6..2234a33 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -2945,7 +2945,7 @@ vmxnet3_close(struct net_device *netdev)
* completion.
*/
while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state))
- msleep(1);
+ usleep_range(1000, 2000);
vmxnet3_quiesce_dev(adapter);
@@ -2995,7 +2995,7 @@ vmxnet3_change_mtu(struct net_device *netdev, int new_mtu)
* completion.
*/
while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state))
- msleep(1);
+ usleep_range(1000, 2000);
if (netif_running(netdev)) {
vmxnet3_quiesce_dev(adapter);
@@ -3567,7 +3567,7 @@ static void vmxnet3_shutdown_device(struct pci_dev *pdev)
* completion.
*/
while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state))
- msleep(1);
+ usleep_range(1000, 2000);
if (test_and_set_bit(VMXNET3_STATE_BIT_QUIESCED,
&adapter->state)) {
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 2ff2731..559db05 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -600,7 +600,7 @@ vmxnet3_set_ringparam(struct net_device *netdev,
* completion.
*/
while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state))
- msleep(1);
+ usleep_range(1000, 2000);
if (netif_running(netdev)) {
vmxnet3_quiesce_dev(adapter);
--
2.7.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