ppp_generic.c severly whitespace damanged by 9c705260fe
I was just looking at ppp_generic, and noticed that it fairly recently
(as in the last year) got rather mangled with many spaces turned into tabs
in places they very much shouldn't have been. I tracked it down to commit
9c705260fe
(ppp: ppp_mp_explode() redesign).
I am amazed if that patch passed the patch checking script. I have no
idea what kind of weird editor setting did this, but it has to have been a
weird editor setting or a very unfortunate search and replace gone wrong.
I only found it trying to apply a patch I was playing with and wondering
why it wouldn't apply. Then I found there were tabs in the middle of
comments that used to be spaces.
Well here is a patch that should fix it up as far as I can tell.
Purely whitespace repair. No actual code changes.
Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2ae3111eaf
commit
fa44a73cc7
|
@ -167,7 +167,7 @@ struct channel {
|
||||||
u8 avail; /* flag used in multilink stuff */
|
u8 avail; /* flag used in multilink stuff */
|
||||||
u8 had_frag; /* >= 1 fragments have been sent */
|
u8 had_frag; /* >= 1 fragments have been sent */
|
||||||
u32 lastseq; /* MP: last sequence # received */
|
u32 lastseq; /* MP: last sequence # received */
|
||||||
int speed; /* speed of the corresponding ppp channel*/
|
int speed; /* speed of the corresponding ppp channel*/
|
||||||
#endif /* CONFIG_PPP_MULTILINK */
|
#endif /* CONFIG_PPP_MULTILINK */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1293,13 +1293,13 @@ ppp_push(struct ppp *ppp)
|
||||||
*/
|
*/
|
||||||
static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
|
static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
int len, totlen;
|
int len, totlen;
|
||||||
int i, bits, hdrlen, mtu;
|
int i, bits, hdrlen, mtu;
|
||||||
int flen;
|
int flen;
|
||||||
int navail, nfree, nzero;
|
int navail, nfree, nzero;
|
||||||
int nbigger;
|
int nbigger;
|
||||||
int totspeed;
|
int totspeed;
|
||||||
int totfree;
|
int totfree;
|
||||||
unsigned char *p, *q;
|
unsigned char *p, *q;
|
||||||
struct list_head *list;
|
struct list_head *list;
|
||||||
struct channel *pch;
|
struct channel *pch;
|
||||||
|
@ -1307,21 +1307,21 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
|
||||||
struct ppp_channel *chan;
|
struct ppp_channel *chan;
|
||||||
|
|
||||||
totspeed = 0; /*total bitrate of the bundle*/
|
totspeed = 0; /*total bitrate of the bundle*/
|
||||||
nfree = 0; /* # channels which have no packet already queued */
|
nfree = 0; /* # channels which have no packet already queued */
|
||||||
navail = 0; /* total # of usable channels (not deregistered) */
|
navail = 0; /* total # of usable channels (not deregistered) */
|
||||||
nzero = 0; /* number of channels with zero speed associated*/
|
nzero = 0; /* number of channels with zero speed associated*/
|
||||||
totfree = 0; /*total # of channels available and
|
totfree = 0; /*total # of channels available and
|
||||||
*having no queued packets before
|
*having no queued packets before
|
||||||
*starting the fragmentation*/
|
*starting the fragmentation*/
|
||||||
|
|
||||||
hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN;
|
hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN;
|
||||||
i = 0;
|
i = 0;
|
||||||
list_for_each_entry(pch, &ppp->channels, clist) {
|
list_for_each_entry(pch, &ppp->channels, clist) {
|
||||||
navail += pch->avail = (pch->chan != NULL);
|
navail += pch->avail = (pch->chan != NULL);
|
||||||
pch->speed = pch->chan->speed;
|
pch->speed = pch->chan->speed;
|
||||||
if (pch->avail) {
|
if (pch->avail) {
|
||||||
if (skb_queue_empty(&pch->file.xq) ||
|
if (skb_queue_empty(&pch->file.xq) ||
|
||||||
!pch->had_frag) {
|
!pch->had_frag) {
|
||||||
if (pch->speed == 0)
|
if (pch->speed == 0)
|
||||||
nzero++;
|
nzero++;
|
||||||
else
|
else
|
||||||
|
@ -1331,60 +1331,60 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
|
||||||
++nfree;
|
++nfree;
|
||||||
++totfree;
|
++totfree;
|
||||||
}
|
}
|
||||||
if (!pch->had_frag && i < ppp->nxchan)
|
if (!pch->had_frag && i < ppp->nxchan)
|
||||||
ppp->nxchan = i;
|
ppp->nxchan = i;
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Don't start sending this packet unless at least half of
|
* Don't start sending this packet unless at least half of
|
||||||
* the channels are free. This gives much better TCP
|
* the channels are free. This gives much better TCP
|
||||||
* performance if we have a lot of channels.
|
* performance if we have a lot of channels.
|
||||||
*/
|
*/
|
||||||
if (nfree == 0 || nfree < navail / 2)
|
if (nfree == 0 || nfree < navail / 2)
|
||||||
return 0; /* can't take now, leave it in xmit_pending */
|
return 0; /* can't take now, leave it in xmit_pending */
|
||||||
|
|
||||||
/* Do protocol field compression (XXX this should be optional) */
|
/* Do protocol field compression (XXX this should be optional) */
|
||||||
p = skb->data;
|
p = skb->data;
|
||||||
len = skb->len;
|
len = skb->len;
|
||||||
if (*p == 0) {
|
if (*p == 0) {
|
||||||
++p;
|
++p;
|
||||||
--len;
|
--len;
|
||||||
}
|
}
|
||||||
|
|
||||||
totlen = len;
|
totlen = len;
|
||||||
nbigger = len % nfree;
|
nbigger = len % nfree;
|
||||||
|
|
||||||
/* skip to the channel after the one we last used
|
/* skip to the channel after the one we last used
|
||||||
and start at that one */
|
and start at that one */
|
||||||
list = &ppp->channels;
|
list = &ppp->channels;
|
||||||
for (i = 0; i < ppp->nxchan; ++i) {
|
for (i = 0; i < ppp->nxchan; ++i) {
|
||||||
list = list->next;
|
list = list->next;
|
||||||
if (list == &ppp->channels) {
|
if (list == &ppp->channels) {
|
||||||
i = 0;
|
i = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a fragment for each channel */
|
/* create a fragment for each channel */
|
||||||
bits = B;
|
bits = B;
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
list = list->next;
|
list = list->next;
|
||||||
if (list == &ppp->channels) {
|
if (list == &ppp->channels) {
|
||||||
i = 0;
|
i = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pch = list_entry(list, struct channel, clist);
|
pch = list_entry(list, struct channel, clist);
|
||||||
++i;
|
++i;
|
||||||
if (!pch->avail)
|
if (!pch->avail)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip this channel if it has a fragment pending already and
|
* Skip this channel if it has a fragment pending already and
|
||||||
* we haven't given a fragment to all of the free channels.
|
* we haven't given a fragment to all of the free channels.
|
||||||
*/
|
*/
|
||||||
if (pch->avail == 1) {
|
if (pch->avail == 1) {
|
||||||
if (nfree > 0)
|
if (nfree > 0)
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
pch->avail = 1;
|
pch->avail = 1;
|
||||||
|
@ -1393,32 +1393,32 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
|
||||||
/* check the channel's mtu and whether it is still attached. */
|
/* check the channel's mtu and whether it is still attached. */
|
||||||
spin_lock_bh(&pch->downl);
|
spin_lock_bh(&pch->downl);
|
||||||
if (pch->chan == NULL) {
|
if (pch->chan == NULL) {
|
||||||
/* can't use this channel, it's being deregistered */
|
/* can't use this channel, it's being deregistered */
|
||||||
if (pch->speed == 0)
|
if (pch->speed == 0)
|
||||||
nzero--;
|
nzero--;
|
||||||
else
|
else
|
||||||
totspeed -= pch->speed;
|
totspeed -= pch->speed;
|
||||||
|
|
||||||
spin_unlock_bh(&pch->downl);
|
spin_unlock_bh(&pch->downl);
|
||||||
pch->avail = 0;
|
pch->avail = 0;
|
||||||
totlen = len;
|
totlen = len;
|
||||||
totfree--;
|
totfree--;
|
||||||
nfree--;
|
nfree--;
|
||||||
if (--navail == 0)
|
if (--navail == 0)
|
||||||
break;
|
break;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*if the channel speed is not set divide
|
*if the channel speed is not set divide
|
||||||
*the packet evenly among the free channels;
|
*the packet evenly among the free channels;
|
||||||
*otherwise divide it according to the speed
|
*otherwise divide it according to the speed
|
||||||
*of the channel we are going to transmit on
|
*of the channel we are going to transmit on
|
||||||
*/
|
*/
|
||||||
flen = len;
|
flen = len;
|
||||||
if (nfree > 0) {
|
if (nfree > 0) {
|
||||||
if (pch->speed == 0) {
|
if (pch->speed == 0) {
|
||||||
flen = totlen/nfree ;
|
flen = totlen/nfree;
|
||||||
if (nbigger > 0) {
|
if (nbigger > 0) {
|
||||||
flen++;
|
flen++;
|
||||||
nbigger--;
|
nbigger--;
|
||||||
|
@ -1436,8 +1436,8 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*check if we are on the last channel or
|
*check if we are on the last channel or
|
||||||
*we exceded the lenght of the data to
|
*we exceded the lenght of the data to
|
||||||
*fragment
|
*fragment
|
||||||
*/
|
*/
|
||||||
if ((nfree <= 0) || (flen > len))
|
if ((nfree <= 0) || (flen > len))
|
||||||
|
@ -1448,29 +1448,29 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
|
||||||
*above formula will be equal or less than zero.
|
*above formula will be equal or less than zero.
|
||||||
*Skip the channel in this case
|
*Skip the channel in this case
|
||||||
*/
|
*/
|
||||||
if (flen <= 0) {
|
if (flen <= 0) {
|
||||||
pch->avail = 2;
|
pch->avail = 2;
|
||||||
spin_unlock_bh(&pch->downl);
|
spin_unlock_bh(&pch->downl);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
mtu = pch->chan->mtu - hdrlen;
|
mtu = pch->chan->mtu - hdrlen;
|
||||||
if (mtu < 4)
|
if (mtu < 4)
|
||||||
mtu = 4;
|
mtu = 4;
|
||||||
if (flen > mtu)
|
if (flen > mtu)
|
||||||
flen = mtu;
|
flen = mtu;
|
||||||
if (flen == len)
|
if (flen == len)
|
||||||
bits |= E;
|
bits |= E;
|
||||||
frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC);
|
frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC);
|
||||||
if (!frag)
|
if (!frag)
|
||||||
goto noskb;
|
goto noskb;
|
||||||
q = skb_put(frag, flen + hdrlen);
|
q = skb_put(frag, flen + hdrlen);
|
||||||
|
|
||||||
/* make the MP header */
|
/* make the MP header */
|
||||||
q[0] = PPP_MP >> 8;
|
q[0] = PPP_MP >> 8;
|
||||||
q[1] = PPP_MP;
|
q[1] = PPP_MP;
|
||||||
if (ppp->flags & SC_MP_XSHORTSEQ) {
|
if (ppp->flags & SC_MP_XSHORTSEQ) {
|
||||||
q[2] = bits + ((ppp->nxseq >> 8) & 0xf);
|
q[2] = bits + ((ppp->nxseq >> 8) & 0xf);
|
||||||
q[3] = ppp->nxseq;
|
q[3] = ppp->nxseq;
|
||||||
} else {
|
} else {
|
||||||
q[2] = bits;
|
q[2] = bits;
|
||||||
|
@ -1483,24 +1483,24 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
|
||||||
|
|
||||||
/* try to send it down the channel */
|
/* try to send it down the channel */
|
||||||
chan = pch->chan;
|
chan = pch->chan;
|
||||||
if (!skb_queue_empty(&pch->file.xq) ||
|
if (!skb_queue_empty(&pch->file.xq) ||
|
||||||
!chan->ops->start_xmit(chan, frag))
|
!chan->ops->start_xmit(chan, frag))
|
||||||
skb_queue_tail(&pch->file.xq, frag);
|
skb_queue_tail(&pch->file.xq, frag);
|
||||||
pch->had_frag = 1;
|
pch->had_frag = 1;
|
||||||
p += flen;
|
p += flen;
|
||||||
len -= flen;
|
len -= flen;
|
||||||
++ppp->nxseq;
|
++ppp->nxseq;
|
||||||
bits = 0;
|
bits = 0;
|
||||||
spin_unlock_bh(&pch->downl);
|
spin_unlock_bh(&pch->downl);
|
||||||
}
|
}
|
||||||
ppp->nxchan = i;
|
ppp->nxchan = i;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
noskb:
|
noskb:
|
||||||
spin_unlock_bh(&pch->downl);
|
spin_unlock_bh(&pch->downl);
|
||||||
if (ppp->debug & 1)
|
if (ppp->debug & 1)
|
||||||
printk(KERN_ERR "PPP: no memory (fragment)\n");
|
printk(KERN_ERR "PPP: no memory (fragment)\n");
|
||||||
++ppp->dev->stats.tx_errors;
|
++ppp->dev->stats.tx_errors;
|
||||||
++ppp->nxseq;
|
++ppp->nxseq;
|
||||||
return 1; /* abandon the frame */
|
return 1; /* abandon the frame */
|
||||||
|
|
Loading…
Reference in a new issue