[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [win-pv-devel] [PATCH 04/10] Create a transmitter/receiver ring per max-queue



> -----Original Message-----
> From: Owen Smith [mailto:owen.smith@xxxxxxxxxx]
> Sent: 12 November 2014 16:39
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Paul Durrant; Owen Smith
> Subject: [PATCH 04/10] Create a transmitter/receiver ring per max-queue
> 
> Reads "multi-queue-max-queues" from xenstore for frontend to report.
> Creates a transmitter and receiver ring per queue (queues above 0 are not
> used)
> 
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
> ---
>  src/xenvif/frontend.c    | 57
> ++++++++++++++++++++++++++++++++++++++----------
>  src/xenvif/frontend.h    |  5 +++++
>  src/xenvif/receiver.c    |  3 +--
>  src/xenvif/receiver.h    |  1 -
>  src/xenvif/transmitter.c |  3 +--
>  src/xenvif/transmitter.h |  1 -
>  6 files changed, 53 insertions(+), 17 deletions(-)
> 
> diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
> index 305faaf..9a6cbde 100644
> --- a/src/xenvif/frontend.c
> +++ b/src/xenvif/frontend.c
> @@ -64,6 +64,7 @@ struct _XENVIF_FRONTEND {
> 
>      PCHAR                       BackendPath;
>      USHORT                      BackendDomain;
> +    ULONG                       MultiQueueCount;

Just 'QueueCount'?

> 
>      PXENVIF_GRANTER             Granter;
>      PXENVIF_NOTIFIER            Notifier;
> @@ -203,6 +204,22 @@ FrontendGetBackendDomain(
>      return __FrontendGetBackendDomain(Frontend);
>  }
> 
> +static FORCEINLINE ULONG
> +__FrontendGetQueueCount(
> +    IN  PXENVIF_FRONTEND    Frontend
> +    )
> +{
> +    return Frontend->MultiQueueCount;
> +}
> +
> +ULONG
> +FrontendGetQueueCount(
> +    IN  PXENVIF_FRONTEND    Frontend
> +    )
> +{
> +    return __FrontendGetQueueCount(Frontend);
> +}
> +
>  #define DEFINE_FRONTEND_GET_FUNCTION(_Function, _Type)  \
>  static FORCEINLINE _Type                                \
>  __FrontendGet ## _Function(                             \
> @@ -1285,6 +1302,7 @@ __FrontendConnect(
>      PCHAR                   Path = __FrontendGetBackendPath(Frontend);
>      XenbusState             State;
>      ULONG                   Attempt;
> +    PCHAR                   Buffer;
>      NTSTATUS                status;
> 
>      Trace("====>\n");
> @@ -1302,6 +1320,21 @@ __FrontendConnect(
>      if (!NT_SUCCESS(status))
>          goto fail2;
> 
> +    status = XENBUS_STORE(Read,
> +                          &Frontend->StoreInterface,
> +                          NULL,
> +                          __FrontendGetBackendPath(Frontend),
> +                          "multi-queue-max-queues",
> +                          &Buffer);
> +    if (NT_SUCCESS(status)) {
> +        Frontend->MultiQueueCount = (ULONG)strtol(Buffer, NULL, 10);
> +        XENBUS_STORE(Free,
> +                     &Frontend->StoreInterface,
> +                     Buffer);
> +    } else {
> +        Frontend->MultiQueueCount = 1;
> +    }
> +
>      status = GranterConnect(__FrontendGetGranter(Frontend));
>      if (!NT_SUCCESS(status))
>          goto fail3;
> @@ -1458,6 +1491,8 @@ __FrontendDisconnect(
>      MacDisconnect(__FrontendGetMac(Frontend));
>      GranterDisconnect(__FrontendGetGranter(Frontend));
> 
> +    Frontend->MultiQueueCount = 0;
> +
>      XENBUS_DEBUG(Deregister,
>                   &Frontend->DebugInterface,
>                   Frontend->DebugCallback);
> @@ -1894,19 +1929,19 @@ FrontendInitialize(
>      if (!NT_SUCCESS(status))
>          goto fail6;
> 
> -    status = NotifierInitialize(*Frontend, &(*Frontend)->Notifier);
> +    status = MacInitialize(*Frontend, &(*Frontend)->Mac);
>      if (!NT_SUCCESS(status))
>          goto fail7;
> 
> -    status = MacInitialize(*Frontend, &(*Frontend)->Mac);
> +    status = NotifierInitialize(*Frontend, &(*Frontend)->Notifier);

As previously discussed, I think it would be a lot cleaner to precede this 
series with something that drops the notifier object altogether.

  Paul

>      if (!NT_SUCCESS(status))
>          goto fail8;
> 
> -    status = ReceiverInitialize(*Frontend, 1, &(*Frontend)->Receiver);
> +    status = ReceiverInitialize(*Frontend, &(*Frontend)->Receiver);
>      if (!NT_SUCCESS(status))
>          goto fail9;
> 
> -    status = TransmitterInitialize(*Frontend, 1, &(*Frontend)->Transmitter);
> +    status = TransmitterInitialize(*Frontend, &(*Frontend)->Transmitter);
>      if (!NT_SUCCESS(status))
>          goto fail10;
> 
> @@ -1944,14 +1979,14 @@ fail10:
>  fail9:
>      Error("fail9\n");
> 
> -    MacTeardown(__FrontendGetMac(*Frontend));
> -    (*Frontend)->Mac = NULL;
> +    NotifierTeardown(__FrontendGetNotifier(*Frontend));
> +    (*Frontend)->Notifier = NULL;
> 
>  fail8:
>      Error("fail8\n");
> 
> -    NotifierTeardown(__FrontendGetNotifier(*Frontend));
> -    (*Frontend)->Notifier = NULL;
> +    MacTeardown(__FrontendGetMac(*Frontend));
> +    (*Frontend)->Mac = NULL;
> 
>  fail7:
>      Error("fail7\n");
> @@ -2040,12 +2075,12 @@ FrontendTeardown(
>      ReceiverTeardown(__FrontendGetReceiver(Frontend));
>      Frontend->Receiver = NULL;
> 
> -    MacTeardown(__FrontendGetMac(Frontend));
> -    Frontend->Mac = NULL;
> -
>      NotifierTeardown(__FrontendGetNotifier(Frontend));
>      Frontend->Notifier = NULL;
> 
> +    MacTeardown(__FrontendGetMac(Frontend));
> +    Frontend->Mac = NULL;
> +
>      GranterTeardown(__FrontendGetGranter(Frontend));
>      Frontend->Granter = NULL;
> 
> diff --git a/src/xenvif/frontend.h b/src/xenvif/frontend.h
> index 60c085a..20cd390 100644
> --- a/src/xenvif/frontend.h
> +++ b/src/xenvif/frontend.h
> @@ -112,6 +112,11 @@ FrontendGetBackendDomain(
>      IN  PXENVIF_FRONTEND    Frontend
>      );
> 
> +extern ULONG
> +FrontendGetQueueCount(
> +    IN  PXENVIF_FRONTEND    Frontend
> +    );
> +
>  #include "granter.h"
> 
>  extern PXENVIF_GRANTER
> diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c
> index 88ee07c..626feed 100644
> --- a/src/xenvif/receiver.c
> +++ b/src/xenvif/receiver.c
> @@ -2298,7 +2298,6 @@ ReceiverDebugCallback(
>  NTSTATUS
>  ReceiverInitialize(
>      IN  PXENVIF_FRONTEND    Frontend,
> -    IN  ULONG               Count,
>      OUT PXENVIF_RECEIVER    *Receiver
>      )
>  {
> @@ -2385,7 +2384,7 @@ ReceiverInitialize(
>          goto fail2;
> 
>      Index = 0;
> -    while (Index < Count) {
> +    while (Index < DriverGetQueueMax()) {
>          PXENVIF_RECEIVER_RING   Ring;
> 
>          status = __ReceiverRingInitialize(*Receiver, Index, &Ring);
> diff --git a/src/xenvif/receiver.h b/src/xenvif/receiver.h
> index 0497c5b..8009858 100644
> --- a/src/xenvif/receiver.h
> +++ b/src/xenvif/receiver.h
> @@ -43,7 +43,6 @@ typedef struct _XENVIF_RECEIVER XENVIF_RECEIVER,
> *PXENVIF_RECEIVER;
>  extern NTSTATUS
>  ReceiverInitialize(
>      IN  PXENVIF_FRONTEND    Frontend,
> -    IN  ULONG               Count,
>      OUT PXENVIF_RECEIVER    *Receiver
>      );
> 
> diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c
> index 6fd542e..bea46f1 100644
> --- a/src/xenvif/transmitter.c
> +++ b/src/xenvif/transmitter.c
> @@ -3308,7 +3308,6 @@ TransmitterDebugCallback(
>  NTSTATUS
>  TransmitterInitialize(
>      IN  PXENVIF_FRONTEND    Frontend,
> -    IN  ULONG               Count,
>      OUT PXENVIF_TRANSMITTER *Transmitter
>      )
>  {
> @@ -3391,7 +3390,7 @@ TransmitterInitialize(
>          goto fail4;
> 
>      Index = 0;
> -    while (Index < Count) {
> +    while (Index < DriverGetQueueMax()) {
>          PXENVIF_TRANSMITTER_RING    Ring;
> 
>          status = __TransmitterRingInitialize(*Transmitter, Index, &Ring);
> diff --git a/src/xenvif/transmitter.h b/src/xenvif/transmitter.h
> index c359c20..7e10603 100644
> --- a/src/xenvif/transmitter.h
> +++ b/src/xenvif/transmitter.h
> @@ -43,7 +43,6 @@ typedef struct _XENVIF_TRANSMITTER
> XENVIF_TRANSMITTER, *PXENVIF_TRANSMITTER;
>  extern NTSTATUS
>  TransmitterInitialize(
>      IN  PXENVIF_FRONTEND    Frontend,
> -    IN  ULONG               Count,
>      OUT PXENVIF_TRANSMITTER *Transmitter
>      );
> 
> --
> 1.9.4.msysgit.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.