Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10ecd234 authored by Rahul Lakkireddy's avatar Rahul Lakkireddy Committed by Sasha Levin
Browse files

cxgb4: move handling L2T ARP failures to caller



[ Upstream commit 11d8cd5c9f3b46f397f889cefdb66795518aaebd ]

Move code handling L2T ARP failures to the only caller.

Fixes following sparse warning:
skbuff.h:2091:29: warning: context imbalance in
'handle_failed_resolution' - unexpected unlock

Fixes: 749cb5fe ("cxgb4: Replace arpq_head/arpq_tail with SKB double link-list code")
Signed-off-by: default avatarRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 34931cf6
Loading
Loading
Loading
Loading
+24 −28
Original line number Diff line number Diff line
@@ -507,41 +507,20 @@ u64 cxgb4_select_ntuple(struct net_device *dev,
}
EXPORT_SYMBOL(cxgb4_select_ntuple);

/*
 * Called when address resolution fails for an L2T entry to handle packets
 * on the arpq head.  If a packet specifies a failure handler it is invoked,
 * otherwise the packet is sent to the device.
 */
static void handle_failed_resolution(struct adapter *adap, struct l2t_entry *e)
{
	struct sk_buff *skb;

	while ((skb = __skb_dequeue(&e->arpq)) != NULL) {
		const struct l2t_skb_cb *cb = L2T_SKB_CB(skb);

		spin_unlock(&e->lock);
		if (cb->arp_err_handler)
			cb->arp_err_handler(cb->handle, skb);
		else
			t4_ofld_send(adap, skb);
		spin_lock(&e->lock);
	}
}

/*
 * Called when the host's neighbor layer makes a change to some entry that is
 * loaded into the HW L2 table.
 */
void t4_l2t_update(struct adapter *adap, struct neighbour *neigh)
{
	struct l2t_entry *e;
	struct sk_buff_head *arpq = NULL;
	struct l2t_data *d = adap->l2t;
	unsigned int addr_len = neigh->tbl->key_len;
	u32 *addr = (u32 *) neigh->primary_key;
	int ifidx = neigh->dev->ifindex;
	int hash = addr_hash(d, addr, addr_len, ifidx);
	int hash, ifidx = neigh->dev->ifindex;
	struct sk_buff_head *arpq = NULL;
	struct l2t_data *d = adap->l2t;
	struct l2t_entry *e;

	hash = addr_hash(d, addr, addr_len, ifidx);
	read_lock_bh(&d->lock);
	for (e = d->l2tab[hash].first; e; e = e->next)
		if (!addreq(e, addr) && e->ifindex == ifidx) {
@@ -574,8 +553,25 @@ void t4_l2t_update(struct adapter *adap, struct neighbour *neigh)
			write_l2e(adap, e, 0);
	}

	if (arpq)
		handle_failed_resolution(adap, e);
	if (arpq) {
		struct sk_buff *skb;

		/* Called when address resolution fails for an L2T
		 * entry to handle packets on the arpq head. If a
		 * packet specifies a failure handler it is invoked,
		 * otherwise the packet is sent to the device.
		 */
		while ((skb = __skb_dequeue(&e->arpq)) != NULL) {
			const struct l2t_skb_cb *cb = L2T_SKB_CB(skb);

			spin_unlock(&e->lock);
			if (cb->arp_err_handler)
				cb->arp_err_handler(cb->handle, skb);
			else
				t4_ofld_send(adap, skb);
			spin_lock(&e->lock);
		}
	}
	spin_unlock_bh(&e->lock);
}