From: "Jan Beulich" Subject: [PATCH] linux-2.6.18/block backends: adjust protocol negotiation Date: Mon, 26 Mar 2012 15:06:04 +0100 Message-ID: <4F7093EC020000780007AED5@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartFCD2CEDC.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartFCD2CEDC.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline The changes in c/s 1168:8940ccd0a425 resulted in the native not getting selected anymore, resulting in more involved copying of individual requests. Adjust the negotiation code so that it'll pick the native one again if the frontend matches. The initialization code can be considerably shrunk by using a macro to abstract out the code common for all variants. Signed-off-by: Jan Beulich --- a/drivers/xen/blkback/xenbus.c +++ b/drivers/xen/blkback/xenbus.c @@ -497,10 +497,14 @@ static int connect_ring(struct backend_i protocol =3D xenbus_read(XBT_NIL, dev->otherend, "protocol", = NULL); if (IS_ERR(protocol)) protocol =3D NULL; +#ifndef CONFIG_X86_32 else if (0 =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_X86_32)) be->blkif->blk_protocol =3D BLKIF_PROTOCOL_X86_32; +#endif +#ifndef CONFIG_X86_64 else if (0 =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_X86_64)) be->blkif->blk_protocol =3D BLKIF_PROTOCOL_X86_64; +#endif else if (0 !=3D strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) { xenbus_dev_fatal(dev, err, "unknown fe protocol %s", = protocol); kfree(protocol); --- a/drivers/xen/blktap/xenbus.c +++ b/drivers/xen/blktap/xenbus.c @@ -450,10 +450,14 @@ static int connect_ring(struct backend_i protocol =3D xenbus_read(XBT_NIL, dev->otherend, "protocol", = NULL); if (IS_ERR(protocol)) protocol =3D NULL; +#ifndef CONFIG_X86_32 else if (0 =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_X86_32)) be->blkif->blk_protocol =3D BLKIF_PROTOCOL_X86_32; +#endif +#ifndef CONFIG_X86_64 else if (0 =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_X86_64)) be->blkif->blk_protocol =3D BLKIF_PROTOCOL_X86_64; +#endif else if (0 !=3D strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) { xenbus_dev_fatal(dev, err, "unknown fe protocol %s", = protocol); kfree(protocol); --=__PartFCD2CEDC.0__= Content-Type: text/plain; name="xen-blk-backends-protocol-adjust.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xen-blk-backends-protocol-adjust.patch" block backends: adjust protocol negotiation=0A=0AThe changes in c/s = 1168:8940ccd0a425 resulted in the native not getting=0Aselected anymore, = resulting in more involved copying of individual=0Arequests. Adjust the = negotiation code so that it'll pick the native one=0Aagain if the frontend = matches.=0A=0AThe initialization code can be considerably shrunk by using = a macro to=0Aabstract out the code common for all variants.=0A=0ASigned-off= -by: Jan Beulich =0A=0A--- a/drivers/xen/blkback/xenbus.= c=0A+++ b/drivers/xen/blkback/xenbus.c=0A@@ -497,10 +497,14 @@ static int = connect_ring(struct backend_i=0A protocol =3D xenbus_read(XBT_NIL, = dev->otherend, "protocol", NULL);=0A if (IS_ERR(protocol))=0A = protocol =3D NULL;=0A+#ifndef CONFIG_X86_32=0A else if (0 =3D=3D = strcmp(protocol, XEN_IO_PROTO_ABI_X86_32))=0A be->blkif->blk_prot= ocol =3D BLKIF_PROTOCOL_X86_32;=0A+#endif=0A+#ifndef CONFIG_X86_64=0A = else if (0 =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_X86_64))=0A = be->blkif->blk_protocol =3D BLKIF_PROTOCOL_X86_64;=0A+#endif=0A = else if (0 !=3D strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) {=0A = xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);=0A = kfree(protocol);=0A--- a/drivers/xen/blktap/xenbus.c=0A+++ b/drivers/xen/bl= ktap/xenbus.c=0A@@ -450,10 +450,14 @@ static int connect_ring(struct = backend_i=0A protocol =3D xenbus_read(XBT_NIL, dev->otherend, "protocol"= , NULL);=0A if (IS_ERR(protocol))=0A protocol =3D = NULL;=0A+#ifndef CONFIG_X86_32=0A else if (0 =3D=3D strcmp(protocol, = XEN_IO_PROTO_ABI_X86_32))=0A be->blkif->blk_protocol =3D = BLKIF_PROTOCOL_X86_32;=0A+#endif=0A+#ifndef CONFIG_X86_64=0A else if (0 = =3D=3D strcmp(protocol, XEN_IO_PROTO_ABI_X86_64))=0A be->blkif->= blk_protocol =3D BLKIF_PROTOCOL_X86_64;=0A+#endif=0A else if (0 !=3D = strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) {=0A xenbus_dev_= fatal(dev, err, "unknown fe protocol %s", protocol);=0A = kfree(protocol);=0A --=__PartFCD2CEDC.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartFCD2CEDC.0__=--