cxgb4: move handling L2T ARP failures to caller

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: 749cb5fe48 ("cxgb4: Replace arpq_head/arpq_tail with SKB double link-list code")
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Rahul Lakkireddy 2020-06-24 01:51:31 +05:30 committed by David S. Miller
parent 6199496be3
commit 11d8cd5c9f

View File

@ -502,41 +502,20 @@ u64 cxgb4_select_ntuple(struct net_device *dev,
} }
EXPORT_SYMBOL(cxgb4_select_ntuple); 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 * Called when the host's neighbor layer makes a change to some entry that is
* loaded into the HW L2 table. * loaded into the HW L2 table.
*/ */
void t4_l2t_update(struct adapter *adap, struct neighbour *neigh) 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; unsigned int addr_len = neigh->tbl->key_len;
u32 *addr = (u32 *) neigh->primary_key; u32 *addr = (u32 *) neigh->primary_key;
int ifidx = neigh->dev->ifindex; int hash, ifidx = neigh->dev->ifindex;
int hash = addr_hash(d, addr, addr_len, ifidx); 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); read_lock_bh(&d->lock);
for (e = d->l2tab[hash].first; e; e = e->next) for (e = d->l2tab[hash].first; e; e = e->next)
if (!addreq(e, addr) && e->ifindex == ifidx) { if (!addreq(e, addr) && e->ifindex == ifidx) {
@ -569,8 +548,25 @@ void t4_l2t_update(struct adapter *adap, struct neighbour *neigh)
write_l2e(adap, e, 0); write_l2e(adap, e, 0);
} }
if (arpq) if (arpq) {
handle_failed_resolution(adap, e); 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); spin_unlock_bh(&e->lock);
} }