Skip to content

Commit 7aceb47

Browse files
Zoltan Kissdavem330
authored andcommitted
xen-netback: Functional follow-up patch for grant mapping series
Ian made some late comments about the grant mapping series, I incorporated the functional outcomes into this patch: - use callback_param macro to shorten access to pending_tx_info in xenvif_fill_frags() and xenvif_tx_submit() - print an error message in xenvif_idx_unmap() before panic Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0e59a4a commit 7aceb47

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

drivers/net/xen-netback/netback.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ static inline unsigned long idx_to_kaddr(struct xenvif *vif,
9999
return (unsigned long)pfn_to_kaddr(idx_to_pfn(vif, idx));
100100
}
101101

102+
#define callback_param(vif, pending_idx) \
103+
(vif->pending_tx_info[pending_idx].callback_struct)
104+
102105
/* Find the containing VIF's structure from a pointer in pending_tx_info array
103106
*/
104107
static inline struct xenvif* ubuf_to_vif(struct ubuf_info *ubuf)
@@ -1020,12 +1023,12 @@ static void xenvif_fill_frags(struct xenvif *vif, struct sk_buff *skb)
10201023
/* If this is not the first frag, chain it to the previous*/
10211024
if (unlikely(prev_pending_idx == INVALID_PENDING_IDX))
10221025
skb_shinfo(skb)->destructor_arg =
1023-
&vif->pending_tx_info[pending_idx].callback_struct;
1026+
&callback_param(vif, pending_idx);
10241027
else if (likely(pending_idx != prev_pending_idx))
1025-
vif->pending_tx_info[prev_pending_idx].callback_struct.ctx =
1026-
&(vif->pending_tx_info[pending_idx].callback_struct);
1028+
callback_param(vif, prev_pending_idx).ctx =
1029+
&callback_param(vif, pending_idx);
10271030

1028-
vif->pending_tx_info[pending_idx].callback_struct.ctx = NULL;
1031+
callback_param(vif, pending_idx).ctx = NULL;
10291032
prev_pending_idx = pending_idx;
10301033

10311034
txp = &vif->pending_tx_info[pending_idx].req;
@@ -1395,13 +1398,13 @@ static int xenvif_tx_submit(struct xenvif *vif)
13951398
memcpy(skb->data,
13961399
(void *)(idx_to_kaddr(vif, pending_idx)|txp->offset),
13971400
data_len);
1398-
vif->pending_tx_info[pending_idx].callback_struct.ctx = NULL;
1401+
callback_param(vif, pending_idx).ctx = NULL;
13991402
if (data_len < txp->size) {
14001403
/* Append the packet payload as a fragment. */
14011404
txp->offset += data_len;
14021405
txp->size -= data_len;
14031406
skb_shinfo(skb)->destructor_arg =
1404-
&vif->pending_tx_info[pending_idx].callback_struct;
1407+
&callback_param(vif, pending_idx);
14051408
} else {
14061409
/* Schedule a response immediately. */
14071410
xenvif_idx_unmap(vif, pending_idx);
@@ -1681,7 +1684,16 @@ void xenvif_idx_unmap(struct xenvif *vif, u16 pending_idx)
16811684

16821685
ret = gnttab_unmap_refs(&tx_unmap_op, NULL,
16831686
&vif->mmap_pages[pending_idx], 1);
1684-
BUG_ON(ret);
1687+
if (ret) {
1688+
netdev_err(vif->dev,
1689+
"Unmap fail: ret: %d pending_idx: %d host_addr: %llx handle: %x status: %d\n",
1690+
ret,
1691+
pending_idx,
1692+
tx_unmap_op.host_addr,
1693+
tx_unmap_op.handle,
1694+
tx_unmap_op.status);
1695+
BUG();
1696+
}
16851697

16861698
xenvif_idx_release(vif, pending_idx, XEN_NETIF_RSP_OKAY);
16871699
}

0 commit comments

Comments
 (0)