[BEST_CONNECTED] = "connected",
};
+#define DEBUG
#ifdef DEBUG
#define DPRINTK(fmt, args...) \
printk(KERN_ALERT "xen_net (%s:%d) " fmt, __FUNCTION__, __LINE__, ##args)
/* Send a connect message to xend to tell it to bring up the interface. */
static void send_interface_connect(struct net_private *np)
{
+ int err;
ctrl_msg_t cmsg = {
.type = CMSG_NETIF_FE,
.subtype = CMSG_NETIF_FE_INTERFACE_CONNECT,
msg->handle = np->handle;
msg->tx_shmem_frame = virt_to_mfn(np->tx);
#ifdef CONFIG_XEN_NETDEV_GRANT_TX
- msg->tx_shmem_ref = (u32)gnttab_claim_grant_reference(&gref_tx_head);
- if(msg->tx_shmem_ref < 0) {
- printk(KERN_ALERT "#### netfront can't claim tx_shmem reference\n");
+ err = gnttab_grant_foreign_access(rdomid, msg->tx_shmem_frame, 0);
+ if (err < 0) {
+ printk(KERN_ALERT "#### netfront can't grant access to tx_shmem\n");
BUG();
}
- gnttab_grant_foreign_access_ref (msg->tx_shmem_ref, rdomid,
- msg->tx_shmem_frame, 0);
+ msg->tx_shmem_ref = err;
#endif
msg->rx_shmem_frame = virt_to_mfn(np->rx);
#ifdef CONFIG_XEN_NETDEV_GRANT_RX
- msg->rx_shmem_ref = (u32)gnttab_claim_grant_reference(&gref_rx_head);
- if(msg->rx_shmem_ref < 0) {
- printk(KERN_ALERT "#### netfront can't claim rx_shmem reference\n");
+ err = gnttab_grant_foreign_access(rdomid, msg->rx_shmem_frame, 0);
+ if (err < 0) {
+ printk(KERN_ALERT "#### netfront can't grant access to rx_shmem\n");
BUG();
}
- gnttab_grant_foreign_access_ref (msg->rx_shmem_ref, rdomid,
- msg->rx_shmem_frame, 0);
+ msg->rx_shmem_ref = err;
#endif
ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE);
if (xen_start_info.flags & SIF_INITDOMAIN)
return 0;
#ifdef CONFIG_XEN_NETDEV_GRANT_TX
- /* A grant for every ring slot, plus one for the ring itself */
- if (gnttab_alloc_grant_references(NETIF_TX_RING_SIZE + 1,
+ /* A grant for every ring slot */
+ if (gnttab_alloc_grant_references(NETIF_TX_RING_SIZE,
&gref_tx_head) < 0) {
printk(KERN_ALERT "#### netfront can't alloc tx grant refs\n");
return 1;
printk(KERN_ALERT "Netdev frontend (TX) is using grant tables.\n");
#endif
#ifdef CONFIG_XEN_NETDEV_GRANT_RX
- /* A grant for every ring slot, plus one for the ring itself */
- if (gnttab_alloc_grant_references(NETIF_RX_RING_SIZE + 1,
+ /* A grant for every ring slot */
+ if (gnttab_alloc_grant_references(NETIF_RX_RING_SIZE,
&gref_rx_head) < 0) {
printk(KERN_ALERT "#### netfront can't alloc rx grant refs\n");
return 1;