Commit fd2b803f authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'skb_list_cleanups'



David Miller says:

====================
SKB list handling cleanups

This is a preparatory patch series which cleans up various forms of
sloppy SKB list handling, and makes certain semantics explicit.

We are trying to eliminate code that directly accesses the SKB
list and SKB queue head next/prev members in any way.  It is
impossible to convert SKB queue head over the struct list_head
while such code exists.

This patch series does not eliminate all such code, only the simplest
cases.  A latter series will tackle the complicated ones.

A helper is added to make the "skb->next == NULL means not on a list"
rule explicit, and another is added to combine this with list_del().
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0153167a 8b9db0d0
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -198,9 +198,9 @@ static struct sk_buff *nes_get_next_skb(struct nes_device *nesdev, struct nes_qp

	if (skb) {
		/* Continue processing fpdu */
		if (skb->next == (struct sk_buff *)&nesqp->pau_list)
		skb = skb_peek_next(skb, &nesqp->pau_list);
		if (!skb)
			goto out;
		skb = skb->next;
		processacks = false;
	} else {
		/* Starting a new one */
@@ -553,12 +553,10 @@ static void queue_fpdus(struct sk_buff *skb, struct nes_vnic *nesvnic, struct ne
	if (skb_queue_len(&nesqp->pau_list) == 0) {
		skb_queue_head(&nesqp->pau_list, skb);
	} else {
		tmpskb = nesqp->pau_list.next;
		while (tmpskb != (struct sk_buff *)&nesqp->pau_list) {
		skb_queue_walk(&nesqp->pau_list, tmpskb) {
			cb = (struct nes_rskb_cb *)&tmpskb->cb[0];
			if (before(seqnum, cb->seqnum))
				break;
			tmpskb = tmpskb->next;
		}
		skb_insert(tmpskb, skb, &nesqp->pau_list);
	}
+5 −3
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ static int can_rx_offload_napi_poll(struct napi_struct *napi, int quota)
static inline void __skb_queue_add_sort(struct sk_buff_head *head, struct sk_buff *new,
					int (*compare)(struct sk_buff *a, struct sk_buff *b))
{
	struct sk_buff *pos, *insert = (struct sk_buff *)head;
	struct sk_buff *pos, *insert = NULL;

	skb_queue_reverse_walk(head, pos) {
		const struct can_rx_offload_cb *cb_pos, *cb_new;
@@ -99,7 +99,9 @@ static inline void __skb_queue_add_sort(struct sk_buff_head *head, struct sk_buf
		insert = pos;
		break;
	}

	if (!insert)
		__skb_queue_head(head, new);
	else
		__skb_queue_after(head, insert, new);
}

+1 −1
Original line number Diff line number Diff line
@@ -2400,7 +2400,7 @@ ppp_mp_reconstruct(struct ppp *ppp)

	if (ppp->mrru == 0)	/* do nothing until mrru is set */
		return NULL;
	head = list->next;
	head = __skb_peek(list);
	tail = NULL;
	skb_queue_walk_safe(list, p, tmp) {
	again:
+2 −2
Original line number Diff line number Diff line
@@ -3340,9 +3340,9 @@ static void lan78xx_tx_bh(struct lan78xx_net *dev)
	count = 0;
	length = 0;
	spin_lock_irqsave(&tqp->lock, flags);
	for (skb = tqp->next; pkt_cnt < tqp->qlen; skb = skb->next) {
	skb_queue_walk(tqp, skb) {
		if (skb_is_gso(skb)) {
			if (pkt_cnt) {
			if (!skb_queue_is_first(tqp, skb)) {
				/* handle previous packets first */
				break;
			}
+1 −1
Original line number Diff line number Diff line
@@ -576,7 +576,7 @@ int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev,

	if (pktq->qlen == 1)
		err = brcmf_sdiod_skbuff_read(sdiodev, sdiodev->func2, addr,
					      pktq->next);
					      __skb_peek(pktq));
	else if (!sdiodev->sg_support) {
		glom_skb = brcmu_pkt_buf_get_skb(totlen);
		if (!glom_skb)
Loading