xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: netdev@vger.kernel.org, xen-devel@lists.xensource.com,
	ian.campbell@citrix.com
Subject: Re: [Xen-devel] [RFC PATCH V3 13/16] netback: stub for multi receive protocol support.
Date: Mon, 30 Jan 2012 16:47:10 -0500	[thread overview]
Message-ID: <20120130214710.GC16261@phenom.dumpdata.com> (raw)
In-Reply-To: <1327934734-8908-14-git-send-email-wei.liu2@citrix.com>

On Mon, Jan 30, 2012 at 02:45:31PM +0000, Wei Liu wrote:
> Refactor netback, make stub for mutli receive protocols. Also stub

multi.

> existing code as protocol 0.

Why not 1?

Why do we need a new rework without anything using it besides
the existing framework? OR if you are, you should say which
patch is doing it...

> 
> Now the file layout becomes:
> 
>  - interface.c: xenvif interfaces
>  - xenbus.c: xenbus related functions
>  - netback.c: common functions for various protocols
> 
> For different protocols:
> 
>  - xenvif_rx_protocolX.h: header file for the protocol, including
>                           protocol structures and functions
>  - xenvif_rx_protocolX.c: implementations
> 
> To add a new protocol:
> 
>  - include protocol header in common.h
>  - modify XENVIF_MAX_RX_PROTOCOL in common.h
>  - add protocol structure in xenvif.rx union
>  - stub in xenbus.c
>  - modify Makefile
> 
> A protocol should define five functions:
> 
>  - setup: setup frontend / backend ring connections
>  - teardown: teardown frontend / backend ring connections
>  - start_xmit: host start xmit (i.e. guest need to do rx)
>  - event: rx completion event
>  - action: prepare host side data for guest rx
> 
.. snip..

> -
> -	return resp;
> -}
> -
>  static inline int rx_work_todo(struct xenvif *vif)
>  {
>  	return !skb_queue_empty(&vif->rx_queue);
> @@ -1507,8 +999,8 @@ int xenvif_kthread(void *data)
>  		if (kthread_should_stop())
>  			break;
>  
> -		if (rx_work_todo(vif))
> -			xenvif_rx_action(vif);
> +		if (rx_work_todo(vif) && vif->action)
> +			vif->action(vif);
>  	}
>  
>  	return 0;
> diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
> index 79499fc..4067286 100644
> --- a/drivers/net/xen-netback/xenbus.c
> +++ b/drivers/net/xen-netback/xenbus.c
> @@ -415,6 +415,7 @@ static int connect_rings(struct backend_info *be)
>  	unsigned long rx_ring_ref[NETBK_MAX_RING_PAGES];
>  	unsigned int  tx_ring_order;
>  	unsigned int  rx_ring_order;
> +	unsigned int  rx_protocol;
>  
>  	err = xenbus_gather(XBT_NIL, dev->otherend,
>  			    "event-channel", "%u", &evtchn, NULL);
> @@ -510,6 +511,11 @@ static int connect_rings(struct backend_info *be)
>  		}
>  	}
>  
> +	err = xenbus_scanf(XBT_NIL, dev->otherend, "rx-protocol",

feature-rx-protocol?

> +			   "%u", &rx_protocol);
> +	if (err < 0)
> +		rx_protocol = XENVIF_MIN_RX_PROTOCOL;
> +

You should check to see if the protocol is higher than what we can support.
The guest could be playing funny games and putting in 39432...


>  	err = xenbus_scanf(XBT_NIL, dev->otherend, "request-rx-copy", "%u",
>  			   &rx_copy);
>  	if (err == -ENOENT) {
> @@ -559,7 +565,7 @@ static int connect_rings(struct backend_info *be)
>  	err = xenvif_connect(vif,
>  			     tx_ring_ref, (1U << tx_ring_order),
>  			     rx_ring_ref, (1U << rx_ring_order),
> -			     evtchn);
> +			     evtchn, rx_protocol);
>  	if (err) {
>  		int i;
>  		xenbus_dev_fatal(dev, err,

  reply	other threads:[~2012-01-30 21:47 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-30 14:45 [RFC PATCH V3] Xen netback / netfront improvement Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 01/16] netback: page pool version 1 Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 02/16] netback: add module unload function Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 03/16] netback: switch to NAPI + kthread model Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 04/16] netback: switch to per-cpu scratch space Wei Liu
2012-01-30 16:49   ` Viral Mehta
2012-01-30 17:05     ` Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 05/16] netback: add module get/put operations along with vif connect/disconnect Wei Liu
2012-01-31 10:24   ` Ian Campbell
2012-01-31 10:39     ` Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 06/16] netback: melt xen_netbk into xenvif Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 07/16] netback: alter internal function/structure names Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 08/16] netback: remove unwanted notification generation during NAPI processing Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 09/16] netback: nuke xenvif_receive_skb Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 10/16] netback: rework of per-cpu scratch space Wei Liu
2012-01-30 21:53   ` Konrad Rzeszutek Wilk
2012-01-31 10:48     ` Wei Liu
2012-01-31  1:25   ` Eric Dumazet
2012-01-31 10:43     ` Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 11/16] netback: print alert and bail when scratch space is not available Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 12/16] netback: multi-page ring support Wei Liu
2012-01-30 16:35   ` [Xen-devel] " Jan Beulich
2012-01-30 17:10     ` Wei Liu
2012-01-31  9:01       ` Jan Beulich
2012-01-31 11:09         ` Wei Liu
2012-01-31 11:12           ` Ian Campbell
2012-01-31 13:24           ` Jan Beulich
2012-01-31 13:32             ` Wei Liu
2012-01-31 14:48               ` Konrad Rzeszutek Wilk
2012-01-30 14:45 ` [RFC PATCH V3 13/16] netback: stub for multi receive protocol support Wei Liu
2012-01-30 21:47   ` Konrad Rzeszutek Wilk [this message]
2012-01-31 11:03     ` [Xen-devel] " Wei Liu
2012-01-31 14:43       ` Konrad Rzeszutek Wilk
2012-01-30 14:45 ` [RFC PATCH V3 14/16] netback: split event channels support Wei Liu
2012-01-31 10:37   ` Ian Campbell
2012-01-31 11:57     ` Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 15/16] netfront: multi page ring support Wei Liu
2012-01-30 21:39   ` [Xen-devel] " Konrad Rzeszutek Wilk
2012-01-31  9:12     ` Ian Campbell
2012-01-31 11:17       ` Wei Liu
2012-01-31  9:53     ` Jan Beulich
2012-01-31 11:15       ` Wei Liu
2012-01-31 10:58     ` Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 16/16] netfront: split event channels support Wei Liu
2012-01-30 21:25   ` [Xen-devel] " Konrad Rzeszutek Wilk

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=20120130214710.GC16261@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=ian.campbell@citrix.com \
    --cc=netdev@vger.kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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).