Netdev List
 help / color / mirror / Atom feed
* Re: behaviour question for igb on nehalem box
From: Chris Friesen @ 2009-10-13 17:32 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: e1000-list, Linux Network Development list, Allan, Bruce W,
	Brandeburg, Jesse, Ronciak, John, Kirsher, Jeffrey T,
	gospo@redhat.com
In-Reply-To: <4ACFCBE8.7060108@intel.com>

On 10/09/2009 05:48 PM, Alexander Duyck wrote:

> The odds of any 2 flows overlapping when you are only using 4 flows is 
> pretty high, especially if the addresses/ports are close in range.  You 
> typically need something on the order of about 16 flows over a wide 
> range of port numbers in order to get a good distribution.

Yes, I realize this.  However, I was surprised that we were seeing the
packet count increasing for only one queue but the interrupt count
increasing for more than one.

Also, if we really crank up the traffic levels the box apparently
panics.  They're working on getting a serial cable hooked up to it to
get the debug information, so I don't really have much information on
that part just yet.

We're going to try the out-of-tree drivers.  Unfortunately it appears
that the out-of-tree igb driver doesn't compile for this kernel.  I
suspect the compat code needs tweaking.

Chris

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

^ permalink raw reply

* [PATCH 2/2] Modifies CCID4 in order to work with tfrc-sp
From: Ivo Calado @ 2009-10-13 17:31 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

Modifies CCID4 in order to work with tfrc-sp.

Changes:
 - Implements random ecn nonce to be added to sent packets at ccid4
 - Adds parsing of options loss intervals and dropped packets
 - Adds checking of parsed info from options

Signed-off-by: Ivo Calado <ivocalado@embedded.ufcg.edu.br>
Signed-off-by: Erivaldo Xavier <desadoc@gmail.com>
Signed-off-by: Leandro Sales <leandroal@gmail.com>

Index: dccp_tree_work04/net/dccp/ccids/ccid4.h
===================================================================
--- dccp_tree_work04.orig/net/dccp/ccids/ccid4.h	2009-10-12 20:01:07.523059905 -0300
+++ dccp_tree_work04/net/dccp/ccids/ccid4.h	2009-10-12 20:11:01.847156634 -0300
@@ -6,6 +6,13 @@
  *
  *  An implementation of the DCCP protocol
  *
+ *  Copyright (c) 2009 Ivo Calado, Erivaldo Xavier, Leandro Sales
+ *
+ *  This code has been developed by the Federal University of Campina Grande
+ *  Embedded Systems and Pervasive Computing Lab. For further information
+ *  please see http://embedded.ufcg.edu.br/
+ *  <ivocalado@embedded.ufcg.edu.br> <desadoc@gmail.com> <leandroal@gmail.com>
+ *
  *  Copyright (c) 2007 Leandro Sales, Tommi Saviranta
  *
  *  This code has been developed by the Federal University of Campina Grande
@@ -47,7 +54,7 @@
 #ifndef _DCCP_CCID4_H_
 #define _DCCP_CCID4_H_
 
-#include "lib/tfrc_ccids.h"
+#include "lib/tfrc_ccids_sp.h"
 
 /* The nominal packet size to be used into TFRC equation as per CCID-4 draft*/
 #define NOM_PACKET_SIZE            1460
Index: dccp_tree_work04/net/dccp/ccids/ccid4.c
===================================================================
--- dccp_tree_work04.orig/net/dccp/ccids/ccid4.c	2009-10-12 20:01:07.511531378 -0300
+++ dccp_tree_work04/net/dccp/ccids/ccid4.c	2009-10-12 20:13:07.272031863 -0300
@@ -6,6 +6,13 @@
  *
  *  An implementation of the DCCP protocol
  *
+ *  Copyright (c) 2009 Ivo Calado, Erivaldo Xavier, Leandro Sales
+ *
+ *  This code has been developed by the Federal University of Campina Grande
+ *  Embedded Systems and Pervasive Computing Lab. For further information
+ *  please see http://embedded.ufcg.edu.br/
+ *  <ivocalado@embedded.ufcg.edu.br> <desadoc@gmail.com> <leandroal@gmail.com>
+ *
  *  Copyright (c) 2007 Leandro Sales, Tommi Saviranta
  *
  *  This code has been developed by the Federal University of Campina Grande
@@ -295,9 +302,14 @@
 		if (delay >= TFRC_T_DELTA)
 			return (u32)delay / USEC_PER_MSEC;
 
-		tfrc_hc_tx_update_win_count(hctx, now);
+		tfrc_sp_hc_tx_update_win_count(hctx, now);
 	}
 
+	if (dccp_data_packet(skb))
+		DCCP_SKB_CB(skb)->dccpd_ecn =
+			tfrc_sp_get_random_ect(&hctx->li_data,
+					       DCCP_SKB_CB(skb)->dccpd_seq);
+
 	/* prepare to send now (add options etc.) */
 	dp->dccps_hc_tx_insert_options = 1;
 	DCCP_SKB_CB(skb)->dccpd_ccval  = hctx->last_win_count;
@@ -314,14 +326,15 @@
 	/* Changes to s will become effective the next time X is computed */
 	hctx->s = ccid4_hc_tx_measure_packet_size(sk, len);
 
-	if (tfrc_tx_hist_add(&hctx->hist, dccp_sk(sk)->dccps_gss))
-		DCCP_CRIT("packet history - out of memory!");
+	if (tfrc_sp_tx_hist_add(&hctx->hist, dccp_sk(sk)->dccps_gss,
+		hctx->last_win_count))
+			DCCP_CRIT("packet history - out of memory!");
 }
 
 static void ccid4_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
 {
 	struct tfrc_hc_tx_sock *hctx = tfrc_hc_tx_sk(sk);
-	struct tfrc_tx_hist_entry *acked;
+	struct tfrc_tx_hist_entry *acked, *old;
 	ktime_t now;
 	unsigned long t_nfb;
 	u32 r_sample;
@@ -342,7 +355,10 @@
 	if (acked == NULL)
 		return;
 	/* For the sake of RTT sampling, ignore/remove all older entries */
-	tfrc_tx_hist_purge(&acked->next);
+	old = tfrc_tx_hist_two_rtt_old(hctx->hist,
+				       DCCP_SKB_CB(skb)->dccpd_ccval);
+	if (old != NULL)
+		tfrc_sp_tx_hist_purge(&old->next);
 
 	/* Update the moving average for the RTT estimate (RFC 3448, 4.3) */
 	now	  = ktime_get_real();
@@ -375,7 +391,7 @@
 
 	/* Update sending rate (step 4 of [RFC 3448, 4.3]) */
 	if (hctx->p > 0)
-		hctx->x_calc = tfrc_calc_x(NOM_PACKET_SIZE, hctx->rtt, hctx->p);
+		hctx->x_calc = tfrc_sp_calc_x(NOM_PACKET_SIZE, hctx->rtt, hctx->p);
 	ccid4_hc_tx_update_x(sk, &now);
 
 done_computing_x:
@@ -453,6 +469,8 @@
 				     u8 option, u8 *optval, u8 optlen)
 {
 	struct tfrc_hc_tx_sock *hctx = tfrc_hc_tx_sk(sk);
+	struct sk_buff *skb;
+	u32 new_p;
 	__be32 opt_val;
 
 	switch (option) {
@@ -477,14 +495,72 @@
 				       dccp_role(sk), sk, opt_val);
 		} else {
 			/* Update the fixpoint Loss Event Rate fraction */
-			hctx->p = tfrc_invert_loss_event_rate(opt_val);
+			hctx->p = tfrc_sp_invert_loss_event_rate(opt_val);
 
 			ccid4_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n",
 				       dccp_role(sk), sk, opt_val);
 		}
 		break;
 	case TFRC_OPT_DROPPED_PACKETS:
-		/* FIXME: Implement this sock option according to ccid-4 draft */
+		tfrc_sp_parse_dropped_packets_opt(&hctx->li_data,
+						  optval, optlen);
+
+		skb = skb_peek(&sk->sk_receive_queue);
+
+		if (skb == NULL)
+			break;
+
+		if (!tfrc_sp_check_ecn_sum(&hctx->li_data,
+					   optval, optlen, skb)) {
+			/*
+			 * TODO: consider ecn sum test fail
+			 * and update allowed sending rate
+			 */
+		}
+
+		new_p =
+		tfrc_sp_p_from_loss_intervals_opt(&hctx->li_data,
+						  hctx->hist,
+						  hctx->last_win_count,
+						  DCCP_SKB_CB(skb)->dccpd_seq);
+		if (hctx->p != new_p) {
+			/*
+			 * TODO: use p value obtained
+			 * from loss intervals option
+			 */
+		}
+
+		break;
+	case TFRC_OPT_LOSS_INTERVALS:
+
+		hctx->li_data.skip_length = *optval;
+		tfrc_sp_parse_loss_intervals_opt(&hctx->li_data,
+						 optval, optlen);
+
+		skb = skb_peek(&sk->sk_receive_queue);
+
+		if (skb == NULL)
+			break;
+
+		if (!tfrc_sp_check_ecn_sum(&hctx->li_data,
+					   optval, optlen, skb)) {
+			/*
+			 * TODO: consider ecn sum test fail
+			 * and update allowed sending rate
+			 */
+		}
+
+		new_p =
+		tfrc_sp_p_from_loss_intervals_opt(&hctx->li_data,
+						  hctx->hist,
+						  hctx->last_win_count,
+						  DCCP_SKB_CB(skb)->dccpd_seq);
+		if (hctx->p != new_p) {
+			/*
+			 * TODO: use p value obtained
+			 * from loss intervals option
+			 */
+		}
 		break;
 	}
 	return 0;
@@ -505,7 +581,8 @@
 	struct tfrc_hc_tx_sock *hctx = tfrc_hc_tx_sk(sk);
 
 	sk_stop_timer(sk, &hctx->no_feedback_timer);
-	tfrc_tx_hist_purge(&hctx->hist);
+	tfrc_sp_tx_hist_purge(&hctx->hist);
+	tfrc_sp_tx_ld_cleanup(&hctx->li_data.ecn_sums_head);
 }
 
 static void ccid4_hc_tx_get_info(struct sock *sk, struct tcp_info *info)
@@ -584,7 +661,7 @@
 		 * have a reliable estimate for R_m of [RFC 3448, 6.2] and so
 		 * always check whether at least RTT time units were covered.
 		 */
-		hcrx->x_recv = tfrc_rx_hist_x_recv(&hcrx->hist, hcrx->x_recv);
+		hcrx->x_recv = tfrc_sp_rx_hist_x_recv(&hcrx->hist, hcrx->x_recv);
 		break;
 	case TFRC_FBACK_PERIODIC:
 		/*
@@ -594,7 +671,7 @@
 		 */
 		if (hcrx->hist.bytes_recvd == 0)
 			goto prepare_for_next_time;
-		hcrx->x_recv = tfrc_rx_hist_x_recv(&hcrx->hist, hcrx->x_recv);
+		hcrx->x_recv = tfrc_sp_rx_hist_x_recv(&hcrx->hist, hcrx->x_recv);
 		break;
 	default:
 		return;
@@ -613,7 +690,8 @@
 
 static int ccid4_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb)
 {
-	const struct tfrc_hc_rx_sock *hcrx = tfrc_hc_rx_sk(sk);
+	u16 dropped_length, loss_intervals_length;
+	struct tfrc_hc_rx_sock *hcrx = tfrc_hc_rx_sk(sk);
 	__be32 x_recv, pinv;
 
 	if (!(sk->sk_state == DCCP_OPEN || sk->sk_state == DCCP_PARTOPEN))
@@ -625,10 +703,24 @@
 	x_recv = htonl(hcrx->x_recv);
 	pinv   = htonl(hcrx->p_inverse);
 
+	loss_intervals_length	=
+		(hcrx->li_data.counter > TFRC_LOSS_INTERVALS_OPT_MAX_LENGTH) ?
+		 TFRC_LOSS_INTERVALS_OPT_MAX_LENGTH : hcrx->li_data.counter;
+	dropped_length		=
+		(hcrx->li_data.counter > TFRC_DROP_OPT_MAX_LENGTH) ?
+		 TFRC_DROP_OPT_MAX_LENGTH : hcrx->li_data.counter;
+
+	tfrc_sp_ld_prepare_data(hcrx->hist.loss_count, &hcrx->li_data);
+
 	if (dccp_insert_option(sk, skb, TFRC_OPT_LOSS_EVENT_RATE,
 			       &pinv, sizeof(pinv)) ||
 	    dccp_insert_option(sk, skb, TFRC_OPT_RECEIVE_RATE,
-			       &x_recv, sizeof(x_recv)))
+			       &x_recv, sizeof(x_recv)) ||
+	    dccp_insert_option(sk, skb, TFRC_OPT_LOSS_INTERVALS,
+			       &hcrx->li_data.loss_intervals_opts[0],
+			       1 + loss_intervals_length*9) ||
+	    dccp_insert_option(sk, skb, TFRC_OPT_DROPPED_PACKETS,
+			       &hcrx->li_data.drop_opts[0], dropped_length*3))
 		return -1;
 
 	return 0;
@@ -657,12 +749,12 @@
 	if (unlikely(hcrx->feedback == TFRC_FBACK_NONE))
 		return 5;
 
-	x_recv = tfrc_rx_hist_x_recv(&hcrx->hist, hcrx->x_recv);
+	x_recv = tfrc_sp_rx_hist_x_recv(&hcrx->hist, hcrx->x_recv);
 	if (x_recv == 0)
 		goto failed;
 
 	fval = scaled_div32(scaled_div(NOM_PACKET_SIZE, rtt), x_recv);
-	p = tfrc_calc_x_reverse_lookup(fval);
+	p = tfrc_sp_calc_x_reverse_lookup(fval);
 
 	ccid4_pr_debug("%s(%p), receive rate=%u bytes/s, implied "
 		       "loss rate=%u\n", dccp_role(sk), sk, x_recv, p);
@@ -682,8 +774,9 @@
 	/*
 	 * Perform loss detection and handle pending losses
 	 */
-	if (tfrc_rx_congestion_event(&hcrx->hist, &hcrx->li_hist,
-				     skb, ndp, ccid4_first_li, sk))
+	if (tfrc_sp_rx_congestion_event(&hcrx->hist, &hcrx->li_hist,
+					&hcrx->li_data,
+					skb, ndp, ccid4_first_li, sk))
 		ccid4_hc_rx_send_feedback(sk, skb, TFRC_FBACK_PARAM_CHANGE);
 	/*
 	 * Feedback for first non-empty data packet (RFC 3448, 6.3)
@@ -703,15 +796,18 @@
 	struct tfrc_hc_rx_sock *hcrx = ccid_priv(ccid);
 
 	tfrc_lh_init(&hcrx->li_hist);
-	return tfrc_rx_hist_init(&hcrx->hist, sk);
+	tfrc_ld_init(&hcrx->li_data);
+
+	return tfrc_sp_rx_hist_init(&hcrx->hist, sk);
 }
 
 static void ccid4_hc_rx_exit(struct sock *sk)
 {
 	struct tfrc_hc_rx_sock *hcrx = tfrc_hc_rx_sk(sk);
 
-	tfrc_rx_hist_purge(&hcrx->hist);
-	tfrc_lh_cleanup(&hcrx->li_hist);
+	tfrc_sp_rx_hist_purge(&hcrx->hist);
+	tfrc_sp_lh_cleanup(&hcrx->li_hist);
+	tfrc_sp_ld_cleanup(&hcrx->li_data);
 }
 
 static void ccid4_hc_rx_get_info(struct sock *sk, struct tcp_info *info)
@@ -733,7 +829,7 @@
 			return -EINVAL;
 		rx_info.tfrcrx_x_recv = hcrx->x_recv;
 		rx_info.tfrcrx_rtt    = tfrc_rx_hist_rtt(&hcrx->hist);
-		rx_info.tfrcrx_p      = tfrc_invert_loss_event_rate(hcrx->p_inverse);
+		rx_info.tfrcrx_p      = tfrc_sp_invert_loss_event_rate(hcrx->p_inverse);
 		len = sizeof(rx_info);
 		val = &rx_info;
 		break;
@@ -755,7 +851,7 @@
 	.ccid_hc_tx_exit	   = ccid4_hc_tx_exit,
 	.ccid_hc_tx_send_packet	   = ccid4_hc_tx_send_packet,
 	.ccid_hc_tx_packet_sent	   = ccid4_hc_tx_packet_sent,
-	.ccid_hc_tx_probe	   = tfrc_hc_tx_probe,
+	.ccid_hc_tx_probe	   = tfrc_sp_hc_tx_probe,
 	.ccid_hc_tx_packet_recv	   = ccid4_hc_tx_packet_recv,
 	.ccid_hc_tx_parse_options  = ccid4_hc_tx_parse_options,
 	.ccid_hc_rx_obj_size	   = sizeof(struct tfrc_hc_rx_sock),
Index: dccp_tree_work04/net/dccp/ccids/Kconfig
===================================================================
--- dccp_tree_work04.orig/net/dccp/ccids/Kconfig	2009-10-12 20:02:20.807391426 -0300
+++ dccp_tree_work04/net/dccp/ccids/Kconfig	2009-10-12 20:02:47.843653027 -0300
@@ -160,7 +160,10 @@
 endif	# IP_DCCP_CCID4
 
 config IP_DCCP_TFRC_LIB
-	def_bool y if (IP_DCCP_CCID3 || IP_DCCP_CCID4)
+	def_bool y if IP_DCCP_CCID3
+
+config IP_DCCP_TFRC_SP_LIB
+	def_bool y if IP_DCCP_CCID4
 
 config IP_DCCP_TFRC_DEBUG
 	def_bool y if (IP_DCCP_CCID3_DEBUG || IP_DCCP_CCID4_DEBUG)


^ permalink raw reply

* Re: [PATCH] net: Add netdev_alloc_skb_ip_align() helper
From: Stephen Hemminger @ 2009-10-13 17:30 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <4AD49DFC.9020406@gmail.com>

On Tue, 13 Oct 2009 17:34:20 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> David Miller a écrit :
> > From: Eric Dumazet <eric.dumazet@gmail.com>
> > Date: Thu, 08 Oct 2009 05:11:23 +0200
> > 
> >> [PATCH] net: Add netdev_alloc_skb_ip_align() helper
> >>
> >> Instead of hardcoding NET_IP_ALIGN stuff in various network drivers, we can
> >> add a helper around netdev_alloc_skb()
> >>
> >> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> > 
> > Applied to net-next-2.6
> 
> Thanks, here is the followup cleanup patch to use this new helper
> 
> [PATCH net-next-2.6] net: Use netdev_alloc_skb_ip_align()
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Name_is_getting_too_damn_long can we think of something beter.

Also, it isn't really ip alignment but compensating for the ethernet
header.
    alloc_ether_skb?




^ permalink raw reply

* [PATCH 1/2] Adds ccid4 to DCCP test tree.
From: Ivo Calado @ 2009-10-13 17:30 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

Adds ccid4 to DCCP test tree.

Changes:
 - Adds ccid4, changing ccid3 code as necessary to keep common symbols separated


Following the rule #8 in Documentation/SubmittingPatches the patch is
stored at
http://embedded.ufcg.edu.br/~ivocalado/dccp/patches/patches_tfrc_sp_ccid4-v1/ccid4.patch




^ permalink raw reply

* [PATCH 0/2] Add implementation of CCID4 into the DCCP test tree
From: Ivo Calado @ 2009-10-13 17:27 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

These patches add implementation of CCID4 into the DCCP test tree.

Patch #1: Adds ccid4 to DCCP test tree.
Patch #2: Modifies CCID4 in order to work with tfrc-sp.


--
Ivo Augusto Andrade Rocha Calado
MSc. Candidate
Embedded Systems and Pervasive Computing Lab -
http://embedded.ufcg.edu.br
Systems and Computing Department - http://www.dsc.ufcg.edu.br
Electrical Engineering and Informatics Center -
http://www.ceei.ufcg.edu.br
Federal University of Campina Grande - http://www.ufcg.edu.br

PGP: 0x03422935
Quidquid latine dictum sit, altum viditur.


^ permalink raw reply

* [PATCH 4/4] Implement loss intervals option
From: Ivo Calado @ 2009-10-13 17:27 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

Implement loss intervals option. Similar to dropped packets option implementation, reference it.

Changes:
 - Adds tfrc_sp_parse_loss_intervals_opt, that parses loss intervals option received data

Signed-off-by: Ivo Calado <ivocalado@embedded.ufcg.edu.br>
Signed-off-by: Erivaldo Xavier <desadoc@gmail.com>
Signed-off-by: Leandro Sales <leandroal@gmail.com>

Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:59:38.114908156 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:59:43.986408220 -0300
@@ -550,6 +550,46 @@
 	li_data->dropped_packets_data[0] = optlen/3;
 }
 
+/*
+ * tfrc_sp_parse_loss_intervals_opt  -  parses loss interval option
+ * li_data:		used to store parsed data
+ * optval:		option data
+ * optlen:		option length
+ */
+void tfrc_sp_parse_loss_intervals_opt(struct tfrc_tx_li_data *li_data,
+				      u8 *optval, u8 optlen)
+{
+	u8 pos;
+	u32 length;
+
+	if ((optlen%9) != 1) {
+		li_data->loss_interval_data[0] = 0;
+		return;
+	}
+
+	pos = 1;
+	optval++;
+
+	while (pos < optlen) {
+		length = ntohl(((*((u32 *)optval)) & 0xFFFFFF00) >> 8);
+		pos += 3;
+		optval += 3;
+
+		length += ntohl(((*((u32 *)optval))&0x7FFFFF00) >> 8);
+		pos += 6;
+		optval += 6;
+
+		li_data->loss_interval_data[(pos-1)%9] = length;
+
+		if ((pos/9) == 9) {
+			li_data->loss_interval_data[0] = 9;
+			return;
+		}
+	}
+
+	li_data->loss_interval_data[0] = (optlen-1)/9;
+}
+
 static void tfrc_sp_lh_calc_i_mean(struct tfrc_loss_hist *lh, __u8 curr_ccval)
 {
 	u32 i_i, i_tot0 = 0, i_tot1 = 0, w_tot = 0;
Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:59:38.114908156 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:59:43.986408220 -0300
@@ -177,6 +177,8 @@
 					     u8 curr_ccval, u64 seqno);
 extern void tfrc_sp_parse_dropped_packets_opt(struct tfrc_tx_li_data *li_data,
 					      u8 *optval, u8 optlen);
+extern void tfrc_sp_parse_loss_intervals_opt(struct tfrc_tx_li_data *li_data,
+					      u8 *optval, u8 optlen);
 extern void tfrc_sp_tx_ld_cleanup(struct tfrc_ecn_echo_sum_entry **);
 
 #endif /* _DCCP_LI_HIST_SP_ */


^ permalink raw reply

* [PATCH 2/2] net: smsc911x: allow platform_data to specify mac address
From: Manuel Lauss @ 2009-10-13 17:25 UTC (permalink / raw)
  To: netdev; +Cc: Steve Glendinning, Manuel Lauss
In-Reply-To: <1255454749-26895-1-git-send-email-manuel.lauss@gmail.com>

Extend the driver to accept a MAC address specified in platform_data.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
---
 drivers/net/smsc911x.c   |    3 +++
 include/linux/smsc911x.h |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index ccdd196..6a9f51d 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -2071,6 +2071,9 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
 	if (is_valid_ether_addr(dev->dev_addr)) {
 		smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
 		SMSC_TRACE(PROBE, "MAC Address is specified by configuration");
+	} else if (is_valid_ether_addr(pdata->config.mac)) {
+		memcpy(dev->dev_addr, pdata->config.mac, 6);
+		SMSC_TRACE(PROBE, "MAC Address specified by platform data");
 	} else {
 		/* Try reading mac address from device. if EEPROM is present
 		 * it will already have been set */
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
index 5241e4f..7144e8a 100644
--- a/include/linux/smsc911x.h
+++ b/include/linux/smsc911x.h
@@ -30,6 +30,7 @@ struct smsc911x_platform_config {
 	unsigned int irq_type;
 	unsigned int flags;
 	phy_interface_t phy_interface;
+	unsigned char mac[6];
 };
 
 /* Constants for platform_device irq polarity configuration */
-- 
1.6.5.rc2


^ permalink raw reply related

* [PATCH 1/2] net: enable smsc911x on MIPS
From: Manuel Lauss @ 2009-10-13 17:25 UTC (permalink / raw)
  To: netdev; +Cc: Steve Glendinning, Manuel Lauss

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
---
 drivers/net/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 7127760..d9772af 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1001,7 +1001,7 @@ config SMC911X
 
 config SMSC911X
 	tristate "SMSC LAN911x/LAN921x families embedded ethernet support"
-	depends on ARM || SUPERH || BLACKFIN
+	depends on ARM || SUPERH || BLACKFIN || MIPS
 	select CRC32
 	select MII
 	select PHYLIB
-- 
1.6.5.rc2


^ permalink raw reply related

* [PATCH 3/4] Implement dropped packets option
From: Ivo Calado @ 2009-10-13 17:25 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

Implement dropped packets option. First we parse the received option and store the data, then we check the ecn sum along
the intervals described. The last step calcs 'p' from the option data and only suceeds if loss interval data was parsed before
and is ready to be consumed.

Changes:
 - Adds tfrc_sp_check_ecn_sum, that checks ecn in the received option
 - Adds tfrc_sp_p_from_loss_intervals_opt, do 'p' calc from parsed and stored option data
 - Adds tfrc_sp_parse_dropped_packets_opt, that do the parsing of received option, storing data

Signed-off-by: Ivo Calado <ivocalado@embedded.ufcg.edu.br>
Signed-off-by: Erivaldo Xavier <desadoc@gmail.com>
Signed-off-by: Leandro Sales <leandroal@gmail.com>

Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:59:26.926501680 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:59:38.114908156 -0300
@@ -350,6 +350,206 @@
 		h->ecn_nonce_sum = !h->ecn_nonce_sum;
 }
 
+/*
+ * tfrc_sp_check_ecn_sum  -  check received ecn sum parsed from
+ *			     loss interval option
+ * li_data:		data parsed from options
+ * optval:		data from option
+ * optlen:		option data length
+ * skb:		last received packet
+ */
+bool tfrc_sp_check_ecn_sum(struct tfrc_tx_li_data *li_data, u8 *optval,
+			   u8 optlen, struct sk_buff *skb)
+{
+	u8 skip_length;
+	u32 data_length;
+	u8 sum0, sum1, li_sum;
+	struct tfrc_ecn_echo_sum_entry *entry;
+	u64 seqn;
+
+	if ((optlen < 10) || ((optlen - 1)%3 != 0))
+		return false;
+
+	if (li_data == NULL)
+		return true;
+
+	entry = li_data->ecn_sums_head;
+
+	if (entry == NULL)
+		return true;
+
+	seqn = dccp_hdr_ack_seq(skb);
+
+	while (entry->seq_num != seqn) {
+		entry = entry->previous;
+
+		if (entry == NULL)
+			return true;
+	}
+
+	skip_length = *optval;
+	optval++;
+	optlen--;
+
+	while (skip_length--) {
+		entry = entry->previous;
+
+		if (entry == NULL)
+			return false;
+	}
+
+	optval += 3;
+	optlen -= 3;
+
+	do {
+		sum0 = entry->ecn_echo_sum;
+
+		li_sum = (*((u32 *)optval)&0x80000000) ? 1 : 0;
+
+		optval += 3;
+		optlen -= 3;
+
+		data_length = ntohl((*((u32 *)optval) & 0xFFFFFF00) >> 8);
+
+		while (--data_length) {
+			entry = entry->previous;
+
+			if (entry == NULL)
+				return true;
+		}
+
+		sum1 = entry->ecn_echo_sum;
+
+		if (((sum0+sum1) & 0x1) != li_sum)
+			return false;
+
+		optval += 6;
+		optlen -= 6;
+
+	} while (optlen >= 9);
+
+	if (entry != NULL)
+		tfrc_sp_tx_ld_cleanup(&entry->previous);
+
+	return true;
+}
+
+static struct tfrc_tx_hist_entry*
+	tfrc_sp_seek_tx_entry(struct tfrc_tx_hist_entry *head,
+			      u64 seqno, u32 backward)
+{
+	if (head == NULL)
+		return NULL;
+
+	while (head->seqno != seqno) {
+		head = head->next;
+
+		if (head == NULL)
+			return NULL;
+	}
+
+	while (backward-- > 0) {
+		head = head->next;
+
+		if (head == NULL)
+			return NULL;
+	}
+
+	return head;
+}
+
+/*
+ * tfrc_sp_p_from_loss_intervals_opt  -  calcs p from loss interval option
+ * li_data:		data parsed from options
+ * head:		contains ccval info
+ * curr_ccval:		current ccval
+ * seqno:		last acked seqno
+ */
+u32 tfrc_sp_p_from_loss_intervals_opt(struct tfrc_tx_li_data *li_data,
+				      struct tfrc_tx_hist_entry *head,
+				      u8 curr_ccval, u64 seqno)
+{
+	int i, k;
+	u8 ccval;
+	u32 i_i, i_tot0, i_tot1, w_tot, i_totl, losses, mean;
+	i_tot0 = i_tot1 = w_tot = i_totl = 0;
+
+	if (li_data->loss_interval_data[0] == 0)
+		return 0;
+
+	if (li_data->loss_interval_data[0] < li_data->dropped_packets_data[0])
+		return 0;
+
+	k = li_data->loss_interval_data[0];
+
+	for (i = 1; i <= k; i++) {
+		i_i = li_data->loss_interval_data[i];
+		i_totl += i_i;
+		ccval = tfrc_sp_seek_tx_entry(head, seqno, i_totl - 1)->ccval;
+
+		if (SUB16(curr_ccval, ccval) <= 8) {
+			losses = li_data->dropped_packets_data[i];
+
+			if (losses > 0)
+				i_i = div64_u64(i_i, losses);
+		}
+
+		if (i != k) {
+			i_tot0 += i_i * tfrc_lh_weights[i-1];
+			w_tot  += tfrc_lh_weights[i-1];
+		}
+
+		if (i > 1)
+			i_tot1 += i_i * tfrc_lh_weights[i-2];
+	}
+
+	ccval = tfrc_sp_seek_tx_entry(head, seqno,
+			li_data->loss_interval_data[1] - 1)->ccval;
+
+	if (SUB16(curr_ccval, ccval) > 8)
+		mean = max(i_tot0, i_tot1) / w_tot;
+	else
+		mean = i_tot1 / w_tot;
+
+	return tfrc_sp_invert_loss_event_rate(mean);
+
+	return 0;
+}
+
+/*
+ * tfrc_sp_parse_dropped_packets_opt  -  parses received dropped packets option
+ * li_data:		used to store parsed data
+ * optval:		option data
+ * optlen:		option length
+ */
+void tfrc_sp_parse_dropped_packets_opt(struct tfrc_tx_li_data *li_data,
+				       u8 *optval, u8 optlen)
+{
+	u8 pos;
+	u32 dropped;
+
+	if ((optlen%3) != 0) {
+		li_data->dropped_packets_data[0] = 0;
+		return;
+	}
+
+	pos = 0;
+
+	while (pos < optlen) {
+		dropped = ntohl(((*((u32 *)(optval + pos))) & 0xFFFFFF00) >> 8);
+		li_data->dropped_packets_data[1 + (pos/3)] = dropped;
+
+		if ((pos/3) == 9) {
+			li_data->dropped_packets_data[0] = 9;
+			return;
+		}
+
+		pos += 3;
+	}
+
+	li_data->dropped_packets_data[0] = optlen/3;
+}
+
 static void tfrc_sp_lh_calc_i_mean(struct tfrc_loss_hist *lh, __u8 curr_ccval)
 {
 	u32 i_i, i_tot0 = 0, i_tot1 = 0, w_tot = 0;
@@ -400,7 +600,10 @@
 	if (cur == NULL)			/* not initialised */
 		return;
 
-	/* FIXME: should probably also count non-data packets (RFC 4342, 6.1) */
+	/*
+	 * FIXME: should probably also count non-data packets
+	 * (RFC 4342, 6.1)
+	 */
 	if (!dccp_data_packet(skb))
 		return;
 
Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:59:26.926501680 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:59:38.114908156 -0300
@@ -169,6 +169,14 @@
 extern void tfrc_sp_ld_cleanup(struct tfrc_loss_data *ld);
 extern void tfrc_sp_ld_prepare_data(u8 loss_count, struct tfrc_loss_data *ld);
 extern int  tfrc_sp_get_random_ect(struct tfrc_tx_li_data *li_data, u64 seqn);
+extern bool tfrc_sp_check_ecn_sum(struct tfrc_tx_li_data *li_data, u8 *optval,
+				  u8 optlen, struct sk_buff *skb);
+struct tfrc_tx_hist_entry;
+extern u32 tfrc_sp_p_from_loss_intervals_opt(struct tfrc_tx_li_data *li_data,
+					     struct tfrc_tx_hist_entry *head,
+					     u8 curr_ccval, u64 seqno);
+extern void tfrc_sp_parse_dropped_packets_opt(struct tfrc_tx_li_data *li_data,
+					      u8 *optval, u8 optlen);
 extern void tfrc_sp_tx_ld_cleanup(struct tfrc_ecn_echo_sum_entry **);
 
 #endif /* _DCCP_LI_HIST_SP_ */


^ permalink raw reply

* [PATCH 2/4] Implement function that allows to keep track of packets sent in last 2 rtt
From: Ivo Calado @ 2009-10-13 17:24 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

Implement function that allows to keep track of packets sent in last 2 rtt

Changes:
 - Creates tfrc_tx_hist_two_rtt_old, that return the first list node at least 2 rtt old

Signed-off-by: Ivo Calado <ivocalado@embedded.ufcg.edu.br>
Signed-off-by: Erivaldo Xavier <desadoc@gmail.com>
Signed-off-by: Leandro Sales <leandroal@gmail.com>

Index: dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.c
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/packet_history_sp.c	2009-10-08 22:59:20.526408512 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.c	2009-10-08 22:59:32.582408479 -0300
@@ -65,7 +65,7 @@
 	}
 }
 
-int tfrc_sp_tx_hist_add(struct tfrc_tx_hist_entry **headp, u64 seqno)
+int tfrc_sp_tx_hist_add(struct tfrc_tx_hist_entry **headp, u64 seqno, u8 ccval)
 {
 	struct tfrc_tx_hist_entry *entry =
 		kmem_cache_alloc(tfrc_tx_hist_slab, gfp_any());
@@ -73,6 +73,7 @@
 	if (entry == NULL)
 		return -ENOBUFS;
 	entry->seqno = seqno;
+	entry->ccval = ccval;
 	entry->stamp = ktime_get_real();
 	entry->next  = *headp;
 	*headp	     = entry;
Index: dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/packet_history_sp.h	2009-10-08 22:59:20.526408512 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.h	2009-10-08 22:59:32.582408479 -0300
@@ -57,6 +57,7 @@
 struct tfrc_tx_hist_entry {
 	struct tfrc_tx_hist_entry *next;
 	u64			  seqno;
+	u8			  ccval:4;
 	ktime_t			  stamp;
 };
 
@@ -69,13 +70,27 @@
 }
 #endif
 
-extern int  tfrc_sp_tx_hist_add(struct tfrc_tx_hist_entry **headp, u64 seqno);
+extern int tfrc_sp_tx_hist_add(struct tfrc_tx_hist_entry **headp,
+			       u64 seqno, u8 ccval);
 extern void tfrc_sp_tx_hist_purge(struct tfrc_tx_hist_entry **headp);
 
 #ifndef _DCCP_PKT_HIST_
 /* Subtraction a-b modulo-16, respects circular wrap-around */
 #define SUB16(a, b) (((a) + 16 - (b)) & 0xF)
 
+/*
+ * tfrc_tx_hist_two_rtt_old  -  returns entry at least two rtt old
+ * head:		list of tx history entries
+ * cur_ccval:		current ccval
+ */
+static inline struct tfrc_tx_hist_entry *
+	tfrc_tx_hist_two_rtt_old(struct tfrc_tx_hist_entry *head, u8 cur_ccval)
+{
+	while ((head != NULL) && (SUB16(cur_ccval, head->ccval) <= 8))
+		head = head->next;
+	return head;
+}
+
 /* Number of packets to wait after a missing packet (RFC 4342, 6.1) */
 #define TFRC_NDUPACK 3
 


^ permalink raw reply

* [PATCH 1/4] Adds random ect generation to tfrc-sp sender side
From: Ivo Calado @ 2009-10-13 17:23 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

Adds random ect generation to tfrc-sp sender side. Before sending the packet, TFRC-SP chooses randomly
one ect codepoint, returns it and register at the ect history list.

Changes:
 - Creates tfrc_sp_get_random_ect, that uses random.h to choose one ect codepoint
 - Defines tfrc_tx_li_data, that stores data parsed from options loss intervals and dropped packets, and ecn nonce history
 - Defines tfrc_ecn_echo_sum_entry, type of entries of ecn nonce history list
 - Adds memory manage routines and code to these structures

Signed-off-by: Ivo Calado <ivocalado@embedded.ufcg.edu.br>
Signed-off-by: Erivaldo Xavier <desadoc@gmail.com>
Signed-off-by: Leandro Sales <leandroal@gmail.com>

Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:59:20.526408512 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:59:26.926501680 -0300
@@ -15,6 +15,7 @@
 
 static struct kmem_cache  *tfrc_lh_slab  __read_mostly;
 static struct kmem_cache  *tfrc_ld_slab  __read_mostly;
+static struct kmem_cache  *tfrc_ecn_echo_sum_slab  __read_mostly;
 /* Loss Interval weights from [RFC 3448, 5.4], scaled by 10 */
 static const int tfrc_lh_weights[NINTERVAL] = { 10, 10, 10, 10, 8, 6, 4, 2 };
 
@@ -84,6 +85,48 @@
 }
 
 /*
+ * tfrc_sp_get_random_ect  -  return random ect codepoint
+ * li_data:		data where to register ect sent
+ * seqn:		packet's sequence number
+ */
+int tfrc_sp_get_random_ect(struct tfrc_tx_li_data *li_data, u64 seqn)
+{
+	int ect;
+	struct tfrc_ecn_echo_sum_entry *sum;
+
+	/* TODO: implement random ect*/
+	ect = INET_ECN_ECT_0;
+
+	sum = kmem_cache_alloc(tfrc_ecn_echo_sum_slab, GFP_ATOMIC);
+
+	sum->previous = li_data->ecn_sums_head;
+	sum->ecn_echo_sum = (sum->previous->ecn_echo_sum) ? !ect : ect;
+	sum->seq_num = seqn;
+
+	li_data->ecn_sums_head = sum;
+
+	return ect;
+}
+
+/*
+ * tfrc_sp_tx_ld_cleanup  -  free all entries
+ * echo_sums_data:		head of the list
+ */
+void tfrc_sp_tx_ld_cleanup(struct tfrc_ecn_echo_sum_entry **echo_sums_data)
+{
+	struct tfrc_ecn_echo_sum_entry *e, *previous;
+	e = *echo_sums_data;
+
+	while (e != NULL) {
+		previous = e->previous;
+		kmem_cache_free(tfrc_ecn_echo_sum_slab, e);
+		e = previous;
+	}
+
+	*echo_sums_data = NULL;
+}
+
+/*
  * Allocation routine for new entries of loss interval data
  */
 static struct tfrc_loss_data_entry *tfrc_ld_add_new(struct tfrc_loss_data *ld)
@@ -493,8 +536,13 @@
 	tfrc_ld_slab = kmem_cache_create("tfrc_sp_li_data",
 					 sizeof(struct tfrc_loss_data_entry), 0,
 					 SLAB_HWCACHE_ALIGN, NULL);
-
-	if ((tfrc_lh_slab != NULL) && (tfrc_ld_slab != NULL))
+	tfrc_ecn_echo_sum_slab = kmem_cache_create("tfrc_sp_ecn_echo_sum",
+				sizeof(struct tfrc_ecn_echo_sum_entry), 0,
+						SLAB_HWCACHE_ALIGN, NULL);
+
+	if ((tfrc_lh_slab != NULL) &&
+	    (tfrc_ld_slab != NULL) &&
+	    (tfrc_ecn_echo_sum_slab != NULL))
 		return 0;
 
 	if (tfrc_lh_slab != NULL) {
@@ -507,6 +555,11 @@
 		tfrc_ld_slab = NULL;
 	}
 
+	if (tfrc_ecn_echo_sum_slab != NULL) {
+		kmem_cache_destroy(tfrc_ecn_echo_sum_slab);
+		tfrc_ecn_echo_sum_slab = NULL;
+	}
+
 	return -ENOBUFS;
 }
 
@@ -521,4 +574,9 @@
 		kmem_cache_destroy(tfrc_ld_slab);
 		tfrc_ld_slab = NULL;
 	}
+
+	if (tfrc_ecn_echo_sum_slab != NULL) {
+		kmem_cache_destroy(tfrc_ecn_echo_sum_slab);
+		tfrc_ecn_echo_sum_slab = NULL;
+	}
 }
Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:59:20.526408512 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:59:26.926501680 -0300
@@ -128,6 +128,31 @@
 	memset(ld, 0, sizeof(*ld));
 }
 
+/*
+ * tfrc_ecn_echo_sum_entry  -  store sent ecn codepoint info
+ * ecn_echo_sum:		ecn echo sum up to that packet
+ * seq_num:			sequence number of packet
+ * previous:			previous sent packet info
+ */
+struct tfrc_ecn_echo_sum_entry {
+	u8				ecn_echo_sum:1;
+	u64				seq_num:48;
+	struct tfrc_ecn_echo_sum_entry	*previous;
+};
+
+/*
+ * tfrc_tx_li_data  -  data about sent ecn and parsed options
+ * ecn_sums_head:		ecn data list
+ * seq_num:			sequence number of packet
+ * previous:			previous sent packet info
+ */
+struct tfrc_tx_li_data {
+	struct tfrc_ecn_echo_sum_entry	*ecn_sums_head;
+	u32				dropped_packets_data[1 + 9];
+	u32				loss_interval_data[1 + 9];
+	u8				skip_length;
+};
+
 struct tfrc_rx_hist;
 
 extern bool tfrc_sp_lh_interval_add(struct tfrc_loss_hist *,
@@ -143,6 +168,8 @@
 extern void tfrc_sp_lh_cleanup(struct tfrc_loss_hist *lh);
 extern void tfrc_sp_ld_cleanup(struct tfrc_loss_data *ld);
 extern void tfrc_sp_ld_prepare_data(u8 loss_count, struct tfrc_loss_data *ld);
+extern int  tfrc_sp_get_random_ect(struct tfrc_tx_li_data *li_data, u64 seqn);
+extern void tfrc_sp_tx_ld_cleanup(struct tfrc_ecn_echo_sum_entry **);
 
 #endif /* _DCCP_LI_HIST_SP_ */
 
Index: dccp_tree_work03/net/dccp/ccids/lib/tfrc_ccids_sp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/tfrc_ccids_sp.h	2009-10-08 22:59:20.526408512 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/tfrc_ccids_sp.h	2009-10-08 22:59:26.926501680 -0300
@@ -85,6 +85,7 @@
 	ktime_t				t_ld;
 	ktime_t				t_nom;
 	struct tfrc_tx_hist_entry	*hist;
+	struct tfrc_tx_li_data 		li_data;
 };
 
 static inline struct tfrc_hc_tx_sock *tfrc_hc_tx_sk(const struct sock *sk)


^ permalink raw reply

* Re: [PATCH 0/8] gianfar: Add support for hibernation
From: Andy Fleming @ 2009-10-13 17:22 UTC (permalink / raw)
  To: David Miller; +Cc: scottwood, linuxppc-dev, netdev
In-Reply-To: <20091012.235747.195783342.davem@davemloft.net>


On Oct 13, 2009, at 1:57 AM, David Miller wrote:

> From: Anton Vorontsov <avorontsov@ru.mvista.com>
> Date: Mon, 12 Oct 2009 20:00:00 +0400
>
>> Here are few patches that add support for hibernation for gianfar
>> driver.
>>
>> Technically, we could just do gfar_close() and then gfar_enet_open()
>> sequence to restore gianfar functionality after hibernation, but
>> close/open does so many unneeded things (e.g. BDs buffers freeing and
>> allocation, IRQ freeing and requesting), that I felt it would be much
>> better to cleanup and refactor some code to make the hibernation [and
>> not only hibernation] code a little bit prettier.
>
> I applied all of this, it's a really nice patch set.  If there are any
> problems we can deal with it using follow-on fixups.
>
> I noticed something, in patch #3 where you remove the spurious wrap
> bit setting in startup_gfar().  It looks like that was not only
> spurious but it was doing it wrong too.
>
> It's writing garbage into the status word, because it's not using the
> BD_LFLAG() macro to shift the value up 16 bits.
>

No, it was fine (though made unnecessary by other patches).  The BD  
has a union:

                 struct {
                         u16     status; /* Status Fields */
                         u16     length; /* Buffer length */
                 };
                 u32 lstatus;

so when you write "lstatus", you need to use the BD_LFLAG() macro, but  
when you write "status", you are just setting the status bits.

Andy

^ permalink raw reply

* [PATCH 0/4] Adds implementation of TFRC-SP  sender side into the DCCP test tree
From: Ivo Calado @ 2009-10-13 17:19 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

These patches adds implementation of TFRC-SP at the sender side, and are targeted at the DCCP branch.



Patch #1: Adds random ect generation to tfrc-sp sender side
Patch #2: Implement function that allows to keep track of packets sent in last 2 rtt
Patch #3: Implement dropped packets option
Patch #4: Implement loss intervals option


--
Ivo Augusto Andrade Rocha Calado
MSc. Candidate
Embedded Systems and Pervasive Computing Lab -
http://embedded.ufcg.edu.br
Systems and Computing Department - http://www.dsc.ufcg.edu.br
Electrical Engineering and Informatics Center -
http://www.ceei.ufcg.edu.br
Federal University of Campina Grande - http://www.ufcg.edu.br

PGP: 0x03422935
Quidquid latine dictum sit, altum viditur.




^ permalink raw reply

* [PATCHv2 4/4] Adds options DROPPED PACKETS and LOSS INTERVALS to receiver
From: Ivo Calado @ 2009-10-13 17:19 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

Adds options DROPPED PACKETS and LOSS INTERVALS to receiver. In this patch is added the
mechanism of gathering information about loss intervals and storing it, for later
construction of these two options.

Changes:
 - Adds tfrc_loss_data and tfrc_loss_data_entry, structures that register loss intervals info
 - Adds dccp_skb_is_ecn_ect0 and dccp_skb_is_ecn_ect1 as necessary, so ecn can be verified and
  used in loss intervals option, that reports ecn nonce sum
 - Adds tfrc_sp_update_li_data that updates information about loss intervals
 - Adds tfrc_sp_ld_prepare_data, that fills fields on tfrc_loss_data with current options values
 - And adds a field of type struct tfrc_loss_data to struct tfrc_hc_rx_sock

Signed-off-by: Ivo Calado <ivocalado@embedded.ufcg.edu.br>
Signed-off-by: Erivaldo Xavier <desadoc@gmail.com>
Signed-off-by: Leandro Sales <leandroal@gmail.com>

Index: dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.c
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/packet_history_sp.c	2009-10-08 22:59:07.442411383 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.c	2009-10-08 22:59:20.526408512 -0300
@@ -356,11 +356,12 @@
  */
 bool tfrc_sp_rx_congestion_event(struct tfrc_rx_hist *h,
 				 struct tfrc_loss_hist *lh,
+				 struct tfrc_loss_data *ld,
 				 struct sk_buff *skb, const u64 ndp,
 				 u32 (*first_li)(struct sock *),
 				 struct sock *sk)
 {
-	bool new_event = false;
+	bool new_loss = false, new_event = false;
 
 	if (tfrc_sp_rx_hist_duplicate(h, skb))
 		return 0;
@@ -377,6 +378,7 @@
 		/*
 		 * Update Loss Interval database and recycle RX records
 		 */
+		new_loss = true;
 		new_event = tfrc_sp_lh_interval_add(lh, h, first_li, sk);
 		__three_after_loss(h);
 
@@ -403,6 +405,11 @@
 	}
 
 	/*
+	 * Update Loss Interval data used for options
+	 */
+	tfrc_sp_update_li_data(ld, h, skb, new_loss, new_event);
+
+	/*
 	 * Update moving-average of `s' and the sum of received payload bytes.
 	 */
 	if (dccp_data_packet(skb)) {
Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:59:14.214408089 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:59:20.526408512 -0300
@@ -14,6 +14,7 @@
 #include "tfrc_sp.h"
 
 static struct kmem_cache  *tfrc_lh_slab  __read_mostly;
+static struct kmem_cache  *tfrc_ld_slab  __read_mostly;
 /* Loss Interval weights from [RFC 3448, 5.4], scaled by 10 */
 static const int tfrc_lh_weights[NINTERVAL] = { 10, 10, 10, 10, 8, 6, 4, 2 };
 
@@ -82,6 +83,230 @@
 		}
 }
 
+/*
+ * Allocation routine for new entries of loss interval data
+ */
+static struct tfrc_loss_data_entry *tfrc_ld_add_new(struct tfrc_loss_data *ld)
+{
+       struct tfrc_loss_data_entry *new =
+			kmem_cache_alloc(tfrc_ld_slab, GFP_ATOMIC);
+
+	if (new == NULL)
+		return NULL;
+
+	memset(new, 0, sizeof(struct tfrc_loss_data_entry));
+
+	new->next = ld->head;
+	ld->head = new;
+	ld->counter++;
+
+	return new;
+}
+
+void tfrc_sp_ld_cleanup(struct tfrc_loss_data *ld)
+{
+	struct tfrc_loss_data_entry *next, *h = ld->head;
+
+	while (h) {
+		next = h->next;
+		kmem_cache_free(tfrc_ld_slab, h);
+		h = next;
+	}
+
+	ld->head = NULL;
+	ld->counter = 0;
+}
+
+/*
+ *  tfrc_sp_ld_prepare_data  -  updates arrays on tfrc_loss_data
+ *                             so they can be sent as options
+ *  @loss_count:       current loss count (packets after hole on transmission),
+ *                     used to determine skip length for loss intervals option
+ *  @ld:               loss intervals data being updated
+ */
+void tfrc_sp_ld_prepare_data(u8 loss_count, struct tfrc_loss_data *ld)
+{
+	u8 *li_ofs, *d_ofs;
+	struct tfrc_loss_data_entry *e;
+	u16 count;
+
+	li_ofs = &ld->loss_intervals_opts[0];
+	d_ofs = &ld->drop_opts[0];
+
+	count = 0;
+	e = ld->head;
+
+	*li_ofs = loss_count + 1;
+	li_ofs++;
+
+	while (e != NULL) {
+
+		if (count < TFRC_LOSS_INTERVALS_OPT_MAX_LENGTH) {
+			*li_ofs = ((htonl(e->lossless_length) & 0xFFFFFF)<<8);
+			li_ofs += 3;
+			*li_ofs = ((e->ecn_nonce_sum&0x1) << 31) |
+				(htonl((e->loss_length & 0x7FFFFF))<<8);
+			li_ofs += 3;
+			*li_ofs = ((htonl(e->data_length) & 0xFFFFFF)<<8);
+			li_ofs += 3;
+		} else
+			break;
+
+		if (count < TFRC_DROP_OPT_MAX_LENGTH) {
+			*d_ofs = (htonl(e->drop_count) & 0xFFFFFF)<<8;
+			d_ofs += 3;
+		} else
+			break;
+
+		count++;
+		e = e->next;
+       }
+}
+
+/*
+ *  tfrc_sp_update_li_data  -  Update tfrc_loss_data upon
+ *  			       packet receiving or loss detection
+ *  @ld:			tfrc_loss_data being updated
+ *  @rh:			loss event record
+ *  @skb:			received packet
+ *  @new_loss:			dictates if new loss was detected
+ *  				upon receiving current packet
+ *  @new_event:			...and if the loss starts new loss interval
+ */
+void tfrc_sp_update_li_data(struct tfrc_loss_data *ld,
+			    struct tfrc_rx_hist *rh,
+			    struct sk_buff *skb,
+			    bool new_loss, bool new_event)
+{
+	struct tfrc_loss_data_entry *new, *h;
+
+	if (!dccp_data_packet(skb))
+		return;
+
+	if (ld->head == NULL) {
+		new = tfrc_ld_add_new(ld);
+		if (unlikely(new == NULL)) {
+			DCCP_CRIT("Cannot allocate new loss data registry.");
+			return;
+		}
+
+		if (new_loss) {
+			new->drop_count = rh->num_losses;
+			new->lossless_length = 1;
+			new->loss_length = rh->num_losses;
+
+			new->data_length = 1;
+
+			if (dccp_skb_is_ecn_ect1(skb))
+				new->ecn_nonce_sum = 1;
+			else
+				new->ecn_nonce_sum = 0;
+		} else {
+			new->drop_count = 0;
+			new->lossless_length = 1;
+			new->loss_length = 0;
+
+			new->data_length = 1;
+
+			if (dccp_skb_is_ecn_ect1(skb))
+				new->ecn_nonce_sum = 1;
+			else
+				new->ecn_nonce_sum = 0;
+		}
+
+		return;
+	}
+
+	if (new_event) {
+		new = tfrc_ld_add_new(ld);
+		if (unlikely(new == NULL)) {
+			DCCP_CRIT("Cannot allocate new loss data registry. \
+					Cleaning up.");
+			tfrc_sp_ld_cleanup(ld);
+			return;
+		}
+
+		new->drop_count = rh->num_losses;
+		new->lossless_length = (ld->last_loss_count - rh->loss_count);
+		new->loss_length = rh->num_losses;
+
+		new->ecn_nonce_sum = 0;
+		new->data_length = 0;
+
+		while (ld->last_loss_count > rh->loss_count) {
+			ld->last_loss_count--;
+
+			if (ld->sto_is_data & (1 << (ld->last_loss_count))) {
+				new->data_length++;
+
+				if (ld->sto_ecn & (1 << (ld->last_loss_count)))
+					new->ecn_nonce_sum =
+						!new->ecn_nonce_sum;
+			}
+		}
+
+		return;
+	}
+
+	h = ld->head;
+
+	if (rh->loss_count > ld->last_loss_count) {
+		ld->last_loss_count = rh->loss_count;
+
+		ld->sto_is_data |= (1 << (ld->last_loss_count - 1));
+
+		if (dccp_skb_is_ecn_ect1(skb))
+			ld->sto_ecn |= (1 << (ld->last_loss_count - 1));
+
+		return;
+	}
+
+	if (new_loss) {
+		h->drop_count += rh->num_losses;
+		h->lossless_length = (ld->last_loss_count - rh->loss_count);
+		h->loss_length += h->lossless_length + rh->num_losses;
+
+		h->ecn_nonce_sum = 0;
+		h->data_length = 0;
+
+		while (ld->last_loss_count > rh->loss_count) {
+			ld->last_loss_count--;
+
+			if (ld->sto_is_data&(1 << (ld->last_loss_count))) {
+				h->data_length++;
+
+				if (ld->sto_ecn & (1 << (ld->last_loss_count)))
+					h->ecn_nonce_sum = !h->ecn_nonce_sum;
+			}
+		}
+
+		return;
+	}
+
+	if (ld->last_loss_count > rh->loss_count) {
+		while (ld->last_loss_count > rh->loss_count) {
+			ld->last_loss_count--;
+
+			h->lossless_length++;
+
+			if (ld->sto_is_data & (1 << (ld->last_loss_count))) {
+				h->data_length++;
+
+				if (ld->sto_ecn & (1 << (ld->last_loss_count)))
+					h->ecn_nonce_sum = !h->ecn_nonce_sum;
+			}
+		}
+
+		return;
+	}
+
+	h->lossless_length++;
+	h->data_length++;
+
+	if (dccp_skb_is_ecn_ect1(skb))
+		h->ecn_nonce_sum = !h->ecn_nonce_sum;
+}
+
 static void tfrc_sp_lh_calc_i_mean(struct tfrc_loss_hist *lh, __u8 curr_ccval)
 {
 	u32 i_i, i_tot0 = 0, i_tot1 = 0, w_tot = 0;
@@ -265,7 +490,24 @@
 	tfrc_lh_slab = kmem_cache_create("tfrc_sp_li_hist",
 					 sizeof(struct tfrc_loss_interval), 0,
 					 SLAB_HWCACHE_ALIGN, NULL);
-	return tfrc_lh_slab == NULL ? -ENOBUFS : 0;
+	tfrc_ld_slab = kmem_cache_create("tfrc_sp_li_data",
+					 sizeof(struct tfrc_loss_data_entry), 0,
+					 SLAB_HWCACHE_ALIGN, NULL);
+
+	if ((tfrc_lh_slab != NULL) && (tfrc_ld_slab != NULL))
+		return 0;
+
+	if (tfrc_lh_slab != NULL) {
+		kmem_cache_destroy(tfrc_lh_slab);
+		tfrc_lh_slab = NULL;
+	}
+
+	if (tfrc_ld_slab != NULL) {
+		kmem_cache_destroy(tfrc_ld_slab);
+		tfrc_ld_slab = NULL;
+	}
+
+	return -ENOBUFS;
 }
 
 void tfrc_sp_li_exit(void)
@@ -274,4 +516,9 @@
 		kmem_cache_destroy(tfrc_lh_slab);
 		tfrc_lh_slab = NULL;
 	}
+
+	if (tfrc_ld_slab != NULL) {
+		kmem_cache_destroy(tfrc_ld_slab);
+		tfrc_ld_slab = NULL;
+	}
 }
Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:59:14.214408089 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:59:20.526408512 -0300
@@ -72,13 +72,77 @@
 struct tfrc_rx_hist;
 #endif
 
+/*
+ *  tfrc_loss_data_entry  -  Holds info about one loss interval
+ *  @next:             next entry on this linked list
+ *  @lossless_length:  length of lossless sequence
+ *  @ecn_nonce_sum:    ecn nonce sum for this interval
+ *  @loss_length:      length of lossy part
+ *  @data_length:      data length on lossless part
+ *  @drop_count:       count of dopped packets
+ */
+struct tfrc_loss_data_entry {
+	struct tfrc_loss_data_entry	*next;
+	u32				lossless_length:24;
+	u8				ecn_nonce_sum:1;
+	u32				loss_length:23;
+	u32				data_length:24;
+	u32				drop_count:24;
+};
+
+/* As defined at section 8.6.1. of RFC 4342 */
+#define TFRC_LOSS_INTERVALS_OPT_MAX_LENGTH	28
+/* Specified on section 8.7. of CCID4 draft */
+#define TFRC_DROP_OPT_MAX_LENGTH		84
+#define TFRC_LI_OPT_SZ	\
+	(2 + TFRC_LOSS_INTERVALS_OPT_MAX_LENGTH*9)
+#define TFRC_DROPPED_OPT_SZ \
+	(1 + TFRC_DROP_OPT_MAX_LENGTH*3)
+
+/*
+ *  tfrc_loss_data  -  loss interval data
+ *  used by loss intervals and dropped packets options
+ *  @head:                     linked list containing loss interval data
+ *  @counter:                  number of entries
+ *  @loss_intervals_opts:      space necessary for writing temporary option
+ *                             data for loss intervals option
+ *  @drop_opts:                        same for dropped packets option
+ *  @last_loss_count:          last loss count (num. of packets
+ *                             after hole on transmission) observed
+ *  @sto_ecn:                  ecn's observed while waiting for hole
+ *                             to be filled or accepted as missing
+ *  @sto_is_data:              flags about if packets saw were data packets
+ */
+struct tfrc_loss_data {
+	struct tfrc_loss_data_entry	*head;
+	u16				counter;
+	u8				loss_intervals_opts[TFRC_LI_OPT_SZ];
+	u8				drop_opts[TFRC_DROPPED_OPT_SZ];
+	u8				last_loss_count;
+	u8				sto_ecn;
+	u8				sto_is_data;
+};
+
+static inline void tfrc_ld_init(struct tfrc_loss_data *ld)
+{
+	memset(ld, 0, sizeof(*ld));
+}
+
+struct tfrc_rx_hist;
+
 extern bool tfrc_sp_lh_interval_add(struct tfrc_loss_hist *,
 				    struct tfrc_rx_hist *,
 				    u32 (*first_li)(struct sock *),
 				    struct sock *);
+extern void tfrc_sp_update_li_data(struct tfrc_loss_data *,
+				   struct tfrc_rx_hist *,
+				   struct sk_buff *,
+				   bool new_loss, bool new_event);
 extern void tfrc_sp_lh_update_i_mean(struct tfrc_loss_hist *lh,
 				     struct sk_buff *);
 extern void tfrc_sp_lh_cleanup(struct tfrc_loss_hist *lh);
+extern void tfrc_sp_ld_cleanup(struct tfrc_loss_data *ld);
+extern void tfrc_sp_ld_prepare_data(u8 loss_count, struct tfrc_loss_data *ld);
 
 #endif /* _DCCP_LI_HIST_SP_ */
 
Index: dccp_tree_work03/net/dccp/dccp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/dccp.h	2009-10-08 22:59:07.442411383 -0300
+++ dccp_tree_work03/net/dccp/dccp.h	2009-10-08 22:59:20.526408512 -0300
@@ -401,6 +401,16 @@
 	return (DCCP_SKB_CB(skb)->dccpd_ecn & INET_ECN_MASK) == INET_ECN_CE;
 }
 
+static inline bool dccp_skb_is_ecn_ect0(const struct sk_buff *skb)
+{
+	return (DCCP_SKB_CB(skb)->dccpd_ecn & INET_ECN_MASK) == INET_ECN_ECT_0;
+}
+
+static inline bool dccp_skb_is_ecn_ect1(const struct sk_buff *skb)
+{
+	return (DCCP_SKB_CB(skb)->dccpd_ecn & INET_ECN_MASK) == INET_ECN_ECT_1;
+}
+
 /* RFC 4340, sec. 7.7 */
 static inline int dccp_non_data_packet(const struct sk_buff *skb)
 {
Index: dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/packet_history_sp.h	2009-10-08 22:59:07.439908552 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.h	2009-10-08 22:59:20.526408512 -0300
@@ -202,6 +202,7 @@
 
 extern bool tfrc_sp_rx_congestion_event(struct tfrc_rx_hist *h,
 				     struct tfrc_loss_hist *lh,
+				     struct tfrc_loss_data *ld,
 				     struct sk_buff *skb, const u64 ndp,
 				     u32 (*first_li)(struct sock *sk),
 				     struct sock *sk);
Index: dccp_tree_work03/net/dccp/ccids/lib/tfrc_ccids_sp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/tfrc_ccids_sp.h	2009-10-08 22:54:16.671408004 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/tfrc_ccids_sp.h	2009-10-08 22:59:20.526408512 -0300
@@ -133,6 +133,7 @@
  *  @hist  -  Packet history (loss detection + RTT sampling)
  *  @li_hist  -  Loss Interval database
  *  @p_inverse  -  Inverse of Loss Event Rate (RFC 4342, sec. 8.5)
+ *  @li_data  -  loss interval data for options
  */
 struct tfrc_hc_rx_sock {
 	u8				last_counter:4;
@@ -142,6 +143,7 @@
 	struct tfrc_rx_hist		hist;
 	struct tfrc_loss_hist		li_hist;
 #define p_inverse			li_hist.i_mean
+	struct tfrc_loss_data		li_data;
 };
 
 static inline struct tfrc_hc_rx_sock *tfrc_hc_rx_sk(const struct sock *sk)


^ permalink raw reply

* [PATCHv2 3/4] Implement TFRC-SP calc of mean length of loss intervals, accordingly to section 3 of RFC 4828
From: Ivo Calado @ 2009-10-13 17:19 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

Implement TFRC-SP calc of mean length of loss intervals accordingly to section 3 of RFC 4828

Changes:
 - Modify tfrc_sp_lh_calc_i_mean header, now receiving the current ccval, so it can determine
  if a loss interval is too recent
 - Consider number of losses in each loss interval
 - Only consider open loss interval if it is at least 2 rtt old
 - Changes function signatures as necessary

Signed-off-by: Ivo Calado <ivocalado@embedded.ufcg.edu.br>
Signed-off-by: Erivaldo Xavier <desadoc@gmail.com>
Signed-off-by: Leandro Sales <leandroal@gmail.com>

Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:59:07.439908552 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:59:14.214408089 -0300
@@ -29,13 +29,15 @@
  *  @li_seqno:		Highest received seqno before the start of loss
  *  @li_ccval:		The CCVal belonging to @li_seqno
  *  @li_is_closed:	Whether @li_seqno is older than 1 RTT
+ *  @li_is_short:	Whether this interval is no longer that 2 RTT
  *  @li_length:		Loss interval sequence length
  *  @li_losses:        Number of losses counted on this interval
  */
 struct tfrc_loss_interval {
 	u64		 li_seqno:48,
 			 li_ccval:4,
-			 li_is_closed:1;
+			 li_is_closed:1,
+			 li_is_short:1;
 	u32		 li_length;
 	u32              li_losses;
 };
Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:59:07.439908552 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:59:14.214408089 -0300
@@ -36,6 +36,27 @@
 	return lh->ring[LIH_INDEX(lh->counter - i - 1)]->li_length;
 }
 
+static inline u32
+tfrc_lh_loss_interval_losses(struct tfrc_loss_hist *lh, const u8 i)
+{
+	BUG_ON(i >= lh->counter);
+	return lh->ring[LIH_INDEX(lh->counter - i - 1)]->li_losses;
+}
+
+static inline u8
+tfrc_lh_interval_is_short(struct tfrc_loss_hist *lh, const u8 i)
+{
+	BUG_ON(i >= lh->counter);
+	return lh->ring[LIH_INDEX(lh->counter - i - 1)]->li_is_short;
+}
+
+static inline u8
+tfrc_lh_loss_interval_ccval(struct tfrc_loss_hist *lh, const u8 i)
+{
+	BUG_ON(i >= lh->counter);
+	return lh->ring[LIH_INDEX(lh->counter - i - 1)]->li_ccval;
+}
+
 /*
  *	On-demand allocation and de-allocation of entries
  */
@@ -61,10 +82,11 @@
 		}
 }
 
-static void tfrc_sp_lh_calc_i_mean(struct tfrc_loss_hist *lh)
+static void tfrc_sp_lh_calc_i_mean(struct tfrc_loss_hist *lh, __u8 curr_ccval)
 {
 	u32 i_i, i_tot0 = 0, i_tot1 = 0, w_tot = 0;
 	int i, k = tfrc_lh_length(lh) - 1; /* k is as in rfc3448bis, 5.4 */
+	u32 losses;
 
 	if (k <= 0)
 		return;
@@ -72,6 +94,14 @@
 	for (i = 0; i <= k; i++) {
 		i_i = tfrc_lh_get_interval(lh, i);
 
+		if (tfrc_lh_interval_is_short(lh, i)) {
+
+			losses = tfrc_lh_loss_interval_losses(lh, i);
+
+			if (losses > 0)
+				i_i = DIV_ROUND_UP(i_i, losses);
+		}
+
 		if (i < k) {
 			i_tot0 += i_i * tfrc_lh_weights[i];
 			w_tot  += tfrc_lh_weights[i];
@@ -81,6 +111,11 @@
 	}
 
 	lh->i_mean = max(i_tot0, i_tot1) / w_tot;
+	BUG_ON(w_tot == 0);
+	if (SUB16(curr_ccval, tfrc_lh_loss_interval_ccval(lh, 0) > 8))
+		lh->i_mean = max(i_tot0, i_tot1) / w_tot;
+	else
+		lh->i_mean = i_tot1 / w_tot;
 }
 
 /**
@@ -121,7 +156,7 @@
 		return;
 
 	cur->li_length = len;
-	tfrc_sp_lh_calc_i_mean(lh);
+	tfrc_sp_lh_calc_i_mean(lh, dccp_hdr(skb)->dccph_ccval);
 }
 
 /* RFC 4342, 10.2: test for the existence of packet with sequence number S */
@@ -191,6 +226,9 @@
 
 		/* RFC 5348, 5.3: length between subsequent intervals */
 		cur->li_length = len;
+
+		if (SUB16(cong_evt->tfrchrx_ccval, cur->li_ccval) <= 8)
+			cur->li_is_short = 1;
 	}
 
 	/* Make the new interval the current one */
@@ -203,6 +241,7 @@
 	cur->li_seqno	  = cong_evt_seqno;
 	cur->li_ccval	  = cong_evt->tfrchrx_ccval;
 	cur->li_is_closed = false;
+	cur->li_is_short  = 0;
 	cur->li_losses    = rh->num_losses;
 	rh->num_losses = 0;
 
@@ -216,7 +255,7 @@
 		if (lh->counter > (2*LIH_SIZE))
 			lh->counter -= LIH_SIZE;
 
-		tfrc_sp_lh_calc_i_mean(lh);
+		tfrc_sp_lh_calc_i_mean(lh, cong_evt->tfrchrx_ccval);
 	}
 	return true;
 }


^ permalink raw reply

* Re: (Solved) Problem compile kernel on Ubuntu and using on Debian
From: Frans Pop @ 2009-10-13 17:19 UTC (permalink / raw)
  To: Jesper Dangaard Brouer; +Cc: linux-kernel, netdev, sam
In-Reply-To: <1255431677.13607.118.camel@localhost.localdomain>

Jesper Dangaard Brouer wrote:
> If you get past this one, by compiling enough modules into the kernel,
> BUT then a lot of modules does not seem to be loaded (modprobe).
[...] 
> Q: I don't know why a depmod update is required, anyone feel free to
> answer that question?

The most likely reason is that the two systems have different, and 
incompatible, versions of module-init-tools.

I've seen the same problem in the past [1] and, after a hefty discussion, 
accepted that you just _have_ to always run depmod -a after installing a 
kernel and before generating an initrd.

Cheers,
FJP

[1] http://bugs.debian.org/518407

^ permalink raw reply

* [PATCHv2 2/4] Implement loss counting on TFRC-SP receiver
From: Ivo Calado @ 2009-10-13 17:18 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

Implement loss counting on TFRC-SP receiver. Consider transmission's hole size as loss count.

Changes:
 - Adds field li_losses to tfrc_loss_interval to track loss count per interval
 - Adds field num_losses to tfrc_rx_hist, used to store loss count per loss event
 - Adds dccp_loss_count function to net/dccp/dccp.h, responsible for loss count using sequence numbers

Signed-off-by: Ivo Calado <ivocalado@embedded.ufcg.edu.br>
Signed-off-by: Erivaldo Xavier <desadoc@gmail.com>
Signed-off-by: Leandro Sales <leandroal@gmail.com>

Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:54:16.819408361 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.c	2009-10-08 22:59:07.439908552 -0300
@@ -183,8 +183,11 @@
 		if (len <= 0)
 			return false;
 
-		if (!tfrc_lh_closed_check(cur, cong_evt->tfrchrx_ccval))
+		if (!tfrc_lh_closed_check(cur, cong_evt->tfrchrx_ccval)) {
+			cur->li_losses += rh->num_losses;
+			rh->num_losses = 0;
 			return false;
+		}
 
 		/* RFC 5348, 5.3: length between subsequent intervals */
 		cur->li_length = len;
@@ -200,6 +203,8 @@
 	cur->li_seqno	  = cong_evt_seqno;
 	cur->li_ccval	  = cong_evt->tfrchrx_ccval;
 	cur->li_is_closed = false;
+	cur->li_losses    = rh->num_losses;
+	rh->num_losses = 0;
 
 	if (++lh->counter == 1)
 		lh->i_mean = cur->li_length = (*calc_first_li)(sk);
Index: dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:54:16.838907787 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/loss_interval_sp.h	2009-10-08 22:59:07.439908552 -0300
@@ -30,12 +30,14 @@
  *  @li_ccval:		The CCVal belonging to @li_seqno
  *  @li_is_closed:	Whether @li_seqno is older than 1 RTT
  *  @li_length:		Loss interval sequence length
+ *  @li_losses:        Number of losses counted on this interval
  */
 struct tfrc_loss_interval {
 	u64		 li_seqno:48,
 			 li_ccval:4,
 			 li_is_closed:1;
 	u32		 li_length;
+	u32              li_losses;
 };
 
 /**
Index: dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/packet_history_sp.h	2009-10-08 22:58:53.134907870 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.h	2009-10-08 22:59:07.439908552 -0300
@@ -104,6 +104,7 @@
  * @packet_size:	Packet size in bytes (as per RFC 3448, 3.1)
  * @bytes_recvd:	Number of bytes received since @bytes_start
  * @bytes_start:	Start time for counting @bytes_recvd
+ * @num_losses:		Number of losses detected
  */
 struct tfrc_rx_hist {
 	struct tfrc_rx_hist_entry *ring[TFRC_NDUPACK + 1];
@@ -116,6 +117,7 @@
 	u32			  packet_size,
 				  bytes_recvd;
 	ktime_t			  bytes_start;
+	u64			  num_losses;
 };
 
 /**
Index: dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.c
===================================================================
--- dccp_tree_work03.orig/net/dccp/ccids/lib/packet_history_sp.c	2009-10-08 22:58:21.418908270 -0300
+++ dccp_tree_work03/net/dccp/ccids/lib/packet_history_sp.c	2009-10-08 22:59:07.442411383 -0300
@@ -243,6 +243,7 @@
 {
 	u64 s0 = tfrc_rx_hist_loss_prev(h)->tfrchrx_seqno,
 	    s1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_seqno,
+	    n1 = tfrc_rx_hist_entry(h, 1)->tfrchrx_ndp,
 	    s2 = tfrc_rx_hist_entry(h, 2)->tfrchrx_seqno,
 	    s3 = DCCP_SKB_CB(skb)->dccpd_seq;
 
@@ -250,6 +251,7 @@
 		h->loss_count = 3;
 		tfrc_sp_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 3),
 					       skb, n3);
+		h->num_losses = dccp_loss_count(s0, s1, n1);
 		return 1;
 	}
 
@@ -263,6 +265,7 @@
 		tfrc_sp_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 2),
 					       skb, n3);
 		h->loss_count = 3;
+		h->num_losses = dccp_loss_count(s0, s1, n1);
 		return 1;
 	}
 
@@ -299,6 +302,7 @@
 	h->loss_start = tfrc_rx_hist_index(h, 3);
 	tfrc_sp_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 1), skb, n3);
 	h->loss_count = 3;
+	h->num_losses = dccp_loss_count(s0, s3, n3);
 
 	return 1;
 }
Index: dccp_tree_work03/net/dccp/dccp.h
===================================================================
--- dccp_tree_work03.orig/net/dccp/dccp.h	2009-10-08 22:54:16.858907920 -0300
+++ dccp_tree_work03/net/dccp/dccp.h	2009-10-08 22:59:07.442411383 -0300
@@ -154,6 +154,22 @@
 }
 
 /**
+ * dccp_loss_count - Approximate the number of data packets lost in a row
+ * @s1:   last known sequence number before the loss ('hole')
+ * @s2:   first sequence number seen after the 'hole'
+ * @ndp:  ndp count associated with packet having sequence number @s2
+ */
+static inline u64 dccp_loss_count(const u64 s1, const u64 s2, const u64 ndp)
+{
+       s64 delta = dccp_delta_seqno(s1, s2);
+
+       WARN_ON(delta < 0);
+       delta -= ndp + 1;
+
+       return delta > 0 ? delta : 0;
+}
+
+/**
  * dccp_loss_free  -  Evaluates condition for data loss from RFC 4340, 7.7.1
  * @s1:	 start sequence number
  * @s2:  end sequence number
@@ -162,10 +178,7 @@
  */
 static inline bool dccp_loss_free(const u64 s1, const u64 s2, const u64 ndp)
 {
-	s64 delta = dccp_delta_seqno(s1, s2);
-
-	WARN_ON(delta < 0);
-	return (u64)delta <= ndp + 1;
+       return dccp_loss_count(s1, s2, ndp) == 0;
 }
 
 enum {


^ permalink raw reply

* Re: [PATCH] wan: pci200syn needs capability.h
From: Krzysztof Halasa @ 2009-10-13 17:19 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Stephen Rothwell, davem, linux-next, LKML, netdev
In-Reply-To: <20091013100016.3c9bfad7.randy.dunlap@oracle.com>

Randy Dunlap <randy.dunlap@oracle.com> writes:

> Driver is missing header file capability.h:
>
> drivers/net/wan/pci200syn.c:212: error: implicit declaration of function 'capable'
> drivers/net/wan/pci200syn.c:212: error: 'CAP_NET_ADMIN' undeclared (first use in this function)

Thanks, but I think a patch for a bunch of WAN drivers has been already
posted.
-- 
Krzysztof Halasa

^ permalink raw reply

* [PATCHv2 1/4] First Patch on TFRC-SP. Copy base files from TFRC
From: Ivo Calado @ 2009-10-13 17:18 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

First Patch on TFRC-SP. Does a copy from TFRC and adjust symbols name
with infix "_sp".
Also updates Kconfig and init/exit code. An #ifndef was added to headers
that
have commom symbols with TFRC that were not changed, so they don't get
included twice.


Following the rule #8 in Documentation/SubmittingPatches the patch is
stored at
http://embedded.ufcg.edu.br/~ivocalado/dccp/patches/patches_tfrc_sp_receiver-v2/tfrc_sp_receiver_01.patch


^ permalink raw reply

* [PATCHv2 0/4] Adds implementation of TFRC-SP receiver side into the DCCP test tree
From: Ivo Calado @ 2009-10-13 17:18 UTC (permalink / raw)
  To: dccp; +Cc: netdev, ivocalado

These patches adds implementation of TFRC-SP receiver side, and
are targeted at the DCCP branch.



Patch #1: First Patch on TFRC-SP. Copy base files from TFRC
Patch #2: Implement loss counting on TFRC-SP receiver
Patch #3: Implement TFRC-SP calc of mean length of loss intervals
accordingly to section 3 of RFC 4828
Patch #4: Adds options DROPPED PACKETS and LOSS INTERVALS to receiver


--
Ivo Augusto Andrade Rocha Calado
MSc. Candidate
Embedded Systems and Pervasive Computing Lab -
http://embedded.ufcg.edu.br
Systems and Computing Department - http://www.dsc.ufcg.edu.br
Electrical Engineering and Informatics Center -
http://www.ceei.ufcg.edu.br
Federal University of Campina Grande - http://www.ufcg.edu.br

PGP: 0x03422935
Quidquid latine dictum sit, altum viditur.



^ permalink raw reply

* RE: PATCH: Network Device Naming mechanism and policy
From: Narendra_K @ 2009-10-13 17:13 UTC (permalink / raw)
  To: dannf; +Cc: netdev, linux-hotplug, Matt_Domsch, Jordan_Hargrave, Charles_Rose
In-Reply-To: <20091013150839.GD32107@ldl.fc.hp.com>


>> These device nodes are not functional at the moment - open() returns 
>> -ENOSYS.  Their only purpose is to provide userspace with a kernel 
>> name to ifindex mapping, in a form that udev can easily manage.
>
>If the idea is just to provide a userspace-visible mapping 
>(and presumably take advantage of udev's infrastructure for 
>naming) does this need kernel changes? Could this be a 
>hierarchy under e.g. /etc/udev instead, using plain text 
>files? It still means we need something like libnetdevname for 
>apps to do the translation, but I'm not seeing why it matters 
>how this map is stored. Is there some special property of the 
>character devices (e.g. uevents) that we're not already 
>getting with the existing interfaces?

Yes. The char device by itself doesn't help in any way. But it provides
a flexible mechanism to provide multiple names for the same device, just
the way it is for disks.

With regards,
Narendra K

^ permalink raw reply

* Re: [PATCH 2/2] [RFC] Add c/r support for connected INET sockets
From: Dan Smith @ 2009-10-13 17:05 UTC (permalink / raw)
  To: Oren Laadan; +Cc: containers, netdev, John Dykstra
In-Reply-To: <4AD3A52B.6050101@librato.com>

OL> * Did you test this with UDP too ?

Not sendmail of course, but I have a little test program that
maintains a DGRAM connection to the echo service on a remote node,
yeah.

OL> * What happens if the the clock on the target machine differs from
OL> the clock on the origin machine ?  (TCP timestamps)

I guess maybe we should canonicalize the timeout values to something
like "milliseconds after checkpoint start"?  This would allow the
remote system to reset the timers to something reasonable.  It would
also cause non-migration restarts to restore the timers appropriately
for a coordinated restart of multiple machines.

OL> * How confident are we that "bad" input in one or more fields,
OL> that you don't currently sanitize, cannot create "bad" behavior ?
OL> (bad can be kernel crash, unauthorized behavior, DoS etc)

I'm going to say 0.052.

I haven't evaluated much of it, no :)

OL> * How much does TCP rely on the validity of the info in the
OL> protocol control block, and what sorts of bads can happen if it
OL> isn't ?  Would TCP be still happy if the URG point is bogus, would
OL> it allow the user to sent packets otherwise disallowed (to that
OL> user?), or maybe it could crash the kernel ?

Good question, I'll have to look.

OL> * Can you please document (brief description) how the restart
OL> logic works (listening parent socket etc) ?

Sure.

OL> * Do you intend to checkpoint (and collect) lingering sockets,
OL> that is they are closed by the application so not references by
OL> any task, but still sending data from their buffers ?

Yeah, I expect that will be important :)

OL> * I'd like to also preserve the "older" behavior - so the user can
OL> choose to restart and reset all previous connections, keep
OL> listening sockets (e.g. RESTART_DISCONNET).

Sure, sounds good to me.

>> +	printk("Doing post-restart hash\n");

(oops, looks like I left some debug messages in place)

OL> I wonder if a user can use this to convince TCP to send some nasty
OL> packets to some arbitrary destination, with specific seq-number or
OL> what not ?

I'm not sure what you mean.  The sk->num value comes from the sport
which should have been refused during the bind() if it's in use or not
permitted, no?

Thanks!

-- 
Dan Smith
IBM Linux Technology Center
email: danms@us.ibm.com

^ permalink raw reply

* [PATCH] wan: pci200syn needs capability.h
From: Randy Dunlap @ 2009-10-13 17:00 UTC (permalink / raw)
  To: Stephen Rothwell, davem, Krzysztof Halasa; +Cc: linux-next, LKML, netdev
In-Reply-To: <20091013162312.8b93998b.sfr@canb.auug.org.au>

From: Randy Dunlap <randy.dunlap@oracle.com>

Driver is missing header file capability.h:

drivers/net/wan/pci200syn.c:212: error: implicit declaration of function 'capable'
drivers/net/wan/pci200syn.c:212: error: 'CAP_NET_ADMIN' undeclared (first use in this function)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 drivers/net/wan/pci200syn.c |    1 +
 1 file changed, 1 insertion(+)

--- linux-next-20091012.orig/drivers/net/wan/pci200syn.c
+++ linux-next-20091012/drivers/net/wan/pci200syn.c
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/types.h>
+#include <linux/capability.h>
 #include <linux/fcntl.h>
 #include <linux/in.h>
 #include <linux/string.h>

^ permalink raw reply

* Re: [PATCH 2/3] sky2: Reading registers in reset causes a hang
From: Stephen Hemminger @ 2009-10-13 16:00 UTC (permalink / raw)
  To: Mike McCormack; +Cc: netdev
In-Reply-To: <392fb48f0910121536x3e7c37fbjd83ef821b3617644@mail.gmail.com>

On Tue, 13 Oct 2009 07:36:45 +0900
Mike McCormack <mikem@ring3k.org> wrote:

> 2009/10/13 Stephen Hemminger <shemminger@linux-foundation.org>
> >
> > On Mon, 12 Oct 2009 23:06:37 +0900
> > Mike McCormack <mikem@ring3k.org> wrote:
> >
> > > When sky2 hardware is in reset, reading registers with ethtool -d
> > > causes a hard system hang. eg.
> > >
> > >     ifconfig eth1 down
> > >     ethtool -d eth1
> > >
> > > Avoid reading FIFOs, descriptor and status unit, etc. after we've
> > >  bought the interface down, as these seem to cause the issue.
> > >
> > > Assume the same is true for the second port, as my port only has
> > >  one card.
> >
> > I don't see this on my cards. Let me investigate further before
> > committing this. Also, the debugfs interface would also be screwed
> > if the registers were unavailable.
> 
> I forgot to include one other piece of information... I'm running a
> ping -f at the sky2 interface on a remote machine. I'll check debugfs
> tonight.
> 

You are flooding a down interface??
-- 

^ permalink raw reply

* [PATCH] cosa: Kill off the use of the old ioctl path
From: Alan Cox @ 2009-10-13 15:31 UTC (permalink / raw)
  To: netdev

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/message/i2o/i2o_config.c |    5 ++---
 drivers/net/wan/cosa.c           |   20 +++++++++++++-------
 2 files changed, 15 insertions(+), 10 deletions(-)


diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
index 4e8722b..3d5f40c 100644
--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -40,8 +40,7 @@
 
 #define SG_TABLESIZE		30
 
-static int i2o_cfg_ioctl(struct inode *, struct file *, unsigned int,
-			 unsigned long);
+static long i2o_cfg_ioctl(struct file *, unsigned int, unsigned long);
 
 static spinlock_t i2o_config_lock;
 
@@ -1118,7 +1117,7 @@ static int cfg_release(struct inode *inode, struct file *file)
 static const struct file_operations config_fops = {
 	.owner = THIS_MODULE,
 	.llseek = no_llseek,
-	.ioctl = i2o_cfg_ioctl,
+	.unlocked_ioctl = i2o_cfg_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl = i2o_cfg_compat_ioctl,
 #endif
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index e2c33c0..d888390 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -297,8 +297,8 @@ static ssize_t cosa_write(struct file *file,
 static unsigned int cosa_poll(struct file *file, poll_table *poll);
 static int cosa_open(struct inode *inode, struct file *file);
 static int cosa_release(struct inode *inode, struct file *file);
-static int cosa_chardev_ioctl(struct inode *inode, struct file *file,
-	unsigned int cmd, unsigned long arg);
+static long cosa_chardev_ioctl(struct file *file, unsigned int cmd,
+				unsigned long arg);
 #ifdef COSA_FASYNC_WORKING
 static int cosa_fasync(struct inode *inode, struct file *file, int on);
 #endif
@@ -309,7 +309,7 @@ static const struct file_operations cosa_fops = {
 	.read		= cosa_read,
 	.write		= cosa_write,
 	.poll		= cosa_poll,
-	.ioctl		= cosa_chardev_ioctl,
+	.unlocked_ioctl	= cosa_chardev_ioctl,
 	.open		= cosa_open,
 	.release	= cosa_release,
 #ifdef COSA_FASYNC_WORKING
@@ -1204,12 +1204,18 @@ static int cosa_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 	return hdlc_ioctl(dev, ifr, cmd);
 }
 
-static int cosa_chardev_ioctl(struct inode *inode, struct file *file,
-	unsigned int cmd, unsigned long arg)
+static long cosa_chardev_ioctl(struct file *file, unsigned int cmd,
+							unsigned long arg)
 {
 	struct channel_data *channel = file->private_data;
-	struct cosa_data *cosa = channel->cosa;
-	return cosa_ioctl_common(cosa, channel, cmd, arg);
+	struct cosa_data *cosa;
+	long ret;
+	
+	lock_kernel();
+	cosa = channel->cosa;
+	ret = cosa_ioctl_common(cosa, channel, cmd, arg);
+	unlock_kernel();
+	return ret;
 }
 
 \f


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox