#define XENVIF_TX_CB(skb) ((struct xenvif_tx_cb *)(skb)->cb)
+/* Selects host map only if on native Xen */
+#define GNTTAB_host_map (xen_shim_domain() ? 0 : GNTMAP_host_map)
+
static inline void xenvif_tx_create_map_op(struct xenvif_queue *queue,
u16 pending_idx,
struct xen_netif_tx_request *txp,
{
queue->pages_to_map[mop-queue->tx_map_ops] = queue->mmap_pages[pending_idx];
gnttab_set_map_op(mop, idx_to_kaddr(queue, pending_idx),
- GNTMAP_host_map | GNTMAP_readonly,
+ GNTTAB_host_map | GNTMAP_readonly,
txp->gref, queue->vif->domid);
+ if (xen_shim_domain())
+ mop->host_addr = 0;
+
memcpy(&queue->pending_tx_info[pending_idx].req, txp,
sizeof(*txp));
queue->pending_tx_info[pending_idx].extra_count = extra_count;
return gop;
}
+static inline void xenvif_grant_replace_page(struct xenvif_queue *queue,
+ u16 pending_idx, u32 mapping_idx)
+{
+ queue->mmap_pages[pending_idx] = queue->pages_to_map[mapping_idx];
+}
+
static inline void xenvif_grant_handle_set(struct xenvif_queue *queue,
u16 pending_idx,
grant_handle_t handle)
xenvif_grant_handle_set(queue,
pending_idx,
gop_map->handle);
+
+ if (!err && xen_shim_domain())
+ xenvif_grant_replace_page(queue, pending_idx,
+ gop_map - queue->tx_map_ops);
/* Had a previous error? Invalidate this fragment. */
if (unlikely(err)) {
xenvif_idx_unmap(queue, pending_idx);
queue->mmap_pages[pending_idx];
gnttab_set_unmap_op(gop,
idx_to_kaddr(queue, pending_idx),
- GNTMAP_host_map,
+ GNTTAB_host_map,
queue->grant_tx_handle[pending_idx]);
xenvif_grant_handle_reset(queue, pending_idx);
++gop;
gnttab_set_unmap_op(&tx_unmap_op,
idx_to_kaddr(queue, pending_idx),
- GNTMAP_host_map,
+ GNTTAB_host_map,
queue->grant_tx_handle[pending_idx]);
xenvif_grant_handle_reset(queue, pending_idx);
{
int rc = 0;
- if (!xen_domain())
+ if (!xen_domain() && !xen_shim_domain_get())
return -ENODEV;
/* Allow as many queues as there are CPUs but max. 8 if user has not
debugfs_remove_recursive(xen_netback_dbg_root);
#endif /* CONFIG_DEBUG_FS */
xenvif_xenbus_fini();
+ xen_shim_domain_put();
}
module_exit(netback_fini);