Subject: Re: [RFC][PATCH 1/3] NET_SCHED: PSPacer qdisc module

From: Eric Dumazet <[email-masked]>
Date: Wed, 21 Nov 2007 16:58:47 +0100

Ryousei Takano a écrit :
> This patch includes the PSPacer (Precise Software Pacer) qdisc
> module, which achieves precise transmission bandwidth control.
> You can find more information at the project web page
> (http://www.gridmpi.org/gridtcp.jsp).
> 
> Signed-off-by: Ryousei Takano <[email-masked]>

> +static struct sk_buff *alloc_gap_packet(struct Qdisc* sch, int size)
> +{
> +	struct sk_buff *skb;
> +	struct net_device *dev = sch->dev;
> +	unsigned char *pkt;
> +	int pause_time = 0;
> +	int pktsize = size + 2;
> +
> +	skb = alloc_skb(pktsize, GFP_ATOMIC);
> +	if (!skb)
> +		return NULL;
> +
> +	skb_reserve(skb, 2);

minor nit, but skb_reserve is not *needed* here.

skb_reserve() is used to align IP header on a 16 bytes boundary, and
we do it on rx side to speedup IP stack, at the cost of a possibly more
expensive DMA transfert.

Here you dont send an IP packet, do you ?

> +
> +	pkt = skb->data;
> +	memset(pkt, 0xff, pktsize);
> +	pkt[0] = 0x01; /* dst address: 01:80:c2:00:00:01 */
> +	pkt[1] = 0x80;
> +	pkt[2] = 0xc2;
> +	pkt[3] = 0x00;
> +	pkt[4] = 0x00;
> +	pkt[5] = 0x01;
> +	memcpy(pkt + 6, dev->dev_addr, ETH_ALEN /* dev->addr_len */);
> +
> +	pkt[12] = 0x88; /* MAC control:        88 08 */
> +	pkt[13] = 0x08;
> +	pkt[14] = 0;    /* MAC control opcode: 00 01 */
> +	pkt[15] = 1;
> +	pkt[16] = pause_time >> 8;
> +	pkt[17] = pause_time;
> +
> +	skb_put(skb, size);
> +
> +	skb->dev = sch->dev;