From: Zoltan Kiss <zoltan.kiss@citrix.com>
To: <ian.campbell@citrix.com>, <wei.liu2@citrix.com>,
<xen-devel@lists.xenproject.org>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <jonathan.davies@citrix.com>
Cc: Zoltan Kiss <zoltan.kiss@citrix.com>
Subject: [PATCH net-next RFC 4/5] xen-netback: Change RX path for mapped SKB fragments
Date: Wed, 30 Oct 2013 00:50:20 +0000 [thread overview]
Message-ID: <1383094220-14775-6-git-send-email-zoltan.kiss@citrix.com> (raw)
In-Reply-To: <1383094220-14775-1-git-send-email-zoltan.kiss@citrix.com>
RX path need to know if the SKB fragments are stored on pages from another
domain.
Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
---
drivers/net/xen-netback/netback.c | 46 +++++++++++++++++++++++++++++++++----
1 file changed, 41 insertions(+), 5 deletions(-)
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 204fa46..0ffa412 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -322,7 +322,9 @@ static struct xenvif_rx_meta *get_next_rx_buffer(struct xenvif *vif,
static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
struct netrx_pending_operations *npo,
struct page *page, unsigned long size,
- unsigned long offset, int *head)
+ unsigned long offset, int *head,
+ struct xenvif *foreign_vif,
+ grant_ref_t foreign_gref)
{
struct gnttab_copy *copy_gop;
struct xenvif_rx_meta *meta;
@@ -364,8 +366,15 @@ static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
copy_gop->flags = GNTCOPY_dest_gref;
copy_gop->len = bytes;
- copy_gop->source.domid = DOMID_SELF;
- copy_gop->source.u.gmfn = virt_to_mfn(page_address(page));
+ if (foreign_vif) {
+ copy_gop->source.domid = foreign_vif->domid;
+ copy_gop->source.u.ref = foreign_gref;
+ copy_gop->flags |= GNTCOPY_source_gref;
+ } else {
+ copy_gop->source.domid = DOMID_SELF;
+ copy_gop->source.u.gmfn =
+ virt_to_mfn(page_address(page));
+ }
copy_gop->source.offset = offset;
copy_gop->dest.domid = vif->domid;
@@ -426,6 +435,9 @@ static int xenvif_gop_skb(struct sk_buff *skb,
int old_meta_prod;
int gso_type;
int gso_size;
+ struct ubuf_info *ubuf = skb_shinfo(skb)->destructor_arg;
+ grant_ref_t foreign_grefs[MAX_SKB_FRAGS];
+ struct xenvif *foreign_vif = NULL;
old_meta_prod = npo->meta_prod;
@@ -466,6 +478,26 @@ static int xenvif_gop_skb(struct sk_buff *skb,
npo->copy_off = 0;
npo->copy_gref = req->gref;
+ if ((skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) &&
+ (ubuf->callback == &xenvif_zerocopy_callback)) {
+ u16 pending_idx = ubuf->desc;
+ int i = 0;
+ struct pending_tx_info *temp =
+ container_of(ubuf,
+ struct pending_tx_info,
+ callback_struct);
+ foreign_vif =
+ container_of(temp - pending_idx,
+ struct xenvif,
+ pending_tx_info[0]);
+ do {
+ pending_idx = ubuf->desc;
+ ubuf = (struct ubuf_info *) ubuf->ctx;
+ foreign_grefs[i++] =
+ foreign_vif->pending_tx_info[pending_idx].req.gref;
+ } while (ubuf);
+ }
+
data = skb->data;
while (data < skb_tail_pointer(skb)) {
unsigned int offset = offset_in_page(data);
@@ -475,7 +507,9 @@ static int xenvif_gop_skb(struct sk_buff *skb,
len = skb_tail_pointer(skb) - data;
xenvif_gop_frag_copy(vif, skb, npo,
- virt_to_page(data), len, offset, &head);
+ virt_to_page(data), len, offset, &head,
+ NULL,
+ 0);
data += len;
}
@@ -484,7 +518,9 @@ static int xenvif_gop_skb(struct sk_buff *skb,
skb_frag_page(&skb_shinfo(skb)->frags[i]),
skb_frag_size(&skb_shinfo(skb)->frags[i]),
skb_shinfo(skb)->frags[i].page_offset,
- &head);
+ &head,
+ foreign_vif,
+ foreign_grefs[i]);
}
return npo->meta_prod - old_meta_prod;
next prev parent reply other threads:[~2013-10-30 0:50 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-30 0:50 [PATCH net-next RFC 0/5] xen-netback: TX grant mapping instead of copy Zoltan Kiss
2013-10-30 0:50 ` [PATCH net-next RFC 1/5] xen-netback: Introduce TX grant map definitions Zoltan Kiss
2013-10-30 9:28 ` [Xen-devel] " Jan Beulich
2013-10-31 19:22 ` Zoltan Kiss
2013-10-31 19:33 ` Zoltan Kiss
2013-10-30 0:50 ` [PATCH net-next RFC 2/5] xen-netback: Change TX path from grant copy to mapping Zoltan Kiss
2013-10-30 9:11 ` [Xen-devel] " Paul Durrant
2013-10-30 21:10 ` Zoltan Kiss
2013-11-01 16:09 ` Zoltan Kiss
2013-10-30 0:50 ` [PATCH net-next RFC 3/5] xen-netback: Remove old TX grant copy definitons Zoltan Kiss
2013-10-30 9:39 ` [Xen-devel] " Jan Beulich
2013-10-31 19:46 ` Zoltan Kiss
2013-10-30 11:13 ` Wei Liu
2013-10-30 0:50 ` [PATCH net-next RFC 4/5] xen-netback: Fix indentations Zoltan Kiss
2013-10-30 11:13 ` Wei Liu
2013-10-31 19:48 ` Zoltan Kiss
2013-10-30 0:50 ` Zoltan Kiss [this message]
2013-10-30 19:16 ` [Xen-devel] [PATCH net-next RFC 0/5] xen-netback: TX grant mapping instead of copy Konrad Rzeszutek Wilk
2013-10-30 19:17 ` Konrad Rzeszutek Wilk
2013-10-30 21:14 ` Zoltan Kiss
2013-11-01 10:50 ` Ian Campbell
2013-11-01 19:00 ` Zoltan Kiss
2013-11-05 17:01 ` Zoltan Kiss
2013-11-07 10:52 ` Ian Campbell
2013-11-28 17:37 ` Zoltan Kiss
2013-11-28 17:43 ` Ian Campbell
2013-12-12 22:08 ` Zoltan Kiss
2013-12-16 10:14 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1383094220-14775-6-git-send-email-zoltan.kiss@citrix.com \
--to=zoltan.kiss@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=jonathan.davies@citrix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).