lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 30 Jan 2012 16:35:33 +0000 From: "Jan Beulich" <JBeulich@...e.com> To: "Wei Liu" <wei.liu2@...rix.com> Cc: <ian.campbell@...rix.com>, <xen-devel@...ts.xensource.com>, <konrad.wilk@...cle.com>, <netdev@...r.kernel.org> Subject: Re: [Xen-devel] [RFC PATCH V3 12/16] netback: multi-page ring support >>> On 30.01.12 at 15:45, Wei Liu <wei.liu2@...rix.com> wrote: > -int xenvif_map_frontend_rings(struct xenvif *vif, > - grant_ref_t tx_ring_ref, > - grant_ref_t rx_ring_ref) > +int xenvif_map_frontend_rings(struct xen_comms *comms, > + int domid, > + unsigned long ring_ref[], > + unsigned int ring_ref_count) > { > - void *addr; > - struct xen_netif_tx_sring *txs; > - struct xen_netif_rx_sring *rxs; > - > - int err = -ENOMEM; > + struct gnttab_map_grant_ref op[NETBK_MAX_RING_PAGES]; > + unsigned int i; > + int err = 0; > > - err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(vif), > - tx_ring_ref, &addr); Any reason why you don't just extend this function (in a prerequisite patch) rather than open coding a common utility function (twice) here, so that other backends (blkback!) can benefit later as well. Jan > - if (err) > - goto err; > + comms->ring_area = alloc_vm_area(PAGE_SIZE * ring_ref_count, NULL); > + if (comms->ring_area == NULL) > + return -ENOMEM; > > - txs = (struct xen_netif_tx_sring *)addr; > - BACK_RING_INIT(&vif->tx, txs, PAGE_SIZE); > + for (i = 0; i < ring_ref_count; i++) { > + unsigned long addr = (unsigned long)comms->ring_area->addr + > + (i * PAGE_SIZE); > + gnttab_set_map_op(&op[i], addr, GNTMAP_host_map, > + ring_ref[i], domid); > + } > > - err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(vif), > - rx_ring_ref, &addr); > - if (err) > - goto err; > + if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, > + &op, ring_ref_count)) > + BUG(); > > - rxs = (struct xen_netif_rx_sring *)addr; > - BACK_RING_INIT(&vif->rx, rxs, PAGE_SIZE); > + comms->nr_handles = ring_ref_count; > > - vif->rx_req_cons_peek = 0; > + for (i = 0; i < ring_ref_count; i++) { > + if (op[i].status != 0) { > + err = op[i].status; > + comms->shmem_handle[i] = INVALID_GRANT_HANDLE; > + continue; > + } > + comms->shmem_handle[i] = op[i].handle; > + } > > - return 0; > + if (err != 0) > + xenvif_unmap_frontend_rings(comms); > > -err: > - xenvif_unmap_frontend_rings(vif); > return err; > } > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists