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

net: Add and use skb_mark_not_on_list().



An SKB is not on a list if skb->next is NULL.

Codify this convention into a helper function and use it
where we are dequeueing an SKB and need to mark it as such.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 776f07ee
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1339,6 +1339,11 @@ static inline void skb_zcopy_abort(struct sk_buff *skb)
	}
}

static inline void skb_mark_not_on_list(struct sk_buff *skb)
{
	skb->next = NULL;
}

/**
 *	skb_queue_empty - check if a queue is empty
 *	@list: queue head
+4 −4
Original line number Diff line number Diff line
@@ -3231,7 +3231,7 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *first, struct net_device *de
	while (skb) {
		struct sk_buff *next = skb->next;

		skb->next = NULL;
		skb_mark_not_on_list(skb);
		rc = xmit_one(skb, dev, txq, next != NULL);
		if (unlikely(!dev_xmit_complete(rc))) {
			skb->next = next;
@@ -3331,7 +3331,7 @@ struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *d

	for (; skb != NULL; skb = next) {
		next = skb->next;
		skb->next = NULL;
		skb_mark_not_on_list(skb);

		/* in case skb wont be segmented, point to itself */
		skb->prev = skb;
@@ -5296,7 +5296,7 @@ static void __napi_gro_flush_chain(struct napi_struct *napi, u32 index,
		if (flush_old && NAPI_GRO_CB(skb)->age == jiffies)
			return;
		list_del(&skb->list);
		skb->next = NULL;
		skb_mark_not_on_list(skb);
		napi_gro_complete(skb);
		napi->gro_hash[index].count--;
	}
@@ -5482,7 +5482,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff

	if (pp) {
		list_del(&pp->list);
		pp->next = NULL;
		skb_mark_not_on_list(pp);
		napi_gro_complete(pp);
		napi->gro_hash[hash].count--;
	}
+1 −1
Original line number Diff line number Diff line
@@ -2332,7 +2332,7 @@ static void __release_sock(struct sock *sk)
			next = skb->next;
			prefetch(next);
			WARN_ON_ONCE(skb_dst_is_noref(skb));
			skb->next = NULL;
			skb_mark_not_on_list(skb);
			sk_backlog_rcv(sk, skb);

			cond_resched();
+1 −1
Original line number Diff line number Diff line
@@ -260,7 +260,7 @@ static int lowpan_frag_reasm(struct lowpan_frag_queue *fq, struct sk_buff *prev,
	}
	sub_frag_mem_limit(fq->q.net, sum_truesize);

	head->next = NULL;
	skb_mark_not_on_list(head);
	head->dev = ldev;
	head->tstamp = fq->q.stamp;

+1 −1
Original line number Diff line number Diff line
@@ -623,7 +623,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *skb,
	sub_frag_mem_limit(qp->q.net, head->truesize);

	*nextp = NULL;
	head->next = NULL;
	skb_mark_not_on_list(head);
	head->prev = NULL;
	head->dev = dev;
	head->tstamp = qp->q.stamp;
Loading