win-pvdrivers

changeset 593:682273b8ce5b

Disable SG if it is not supported by the backend. At this stage though, xennet won't actually work without sg...
author James Harper <james.harper@bendigoit.com.au>
date Fri Jun 19 22:18:07 2009 +1000 (2009-06-19)
parents d1754b0e1ead
children 309e3de49a48
files xennet/xennet.c
line diff
     1.1 --- a/xennet/xennet.c	Fri Jun 19 22:15:47 2009 +1000
     1.2 +++ b/xennet/xennet.c	Fri Jun 19 22:18:07 2009 +1000
     1.3 @@ -124,6 +124,7 @@ XenNet_ConnectBackend(struct xennet_info
     1.4    UCHAR type;
     1.5    PCHAR setting, value, value2;
     1.6    UINT i;
     1.7 +  ULONG backend_sg = 0;
     1.8  
     1.9    FUNCTION_ENTER();
    1.10    
    1.11 @@ -151,9 +152,10 @@ XenNet_ConnectBackend(struct xennet_info
    1.12          xi->event_channel = PtrToUlong(value);
    1.13        }
    1.14        break;
    1.15 +    case XEN_INIT_TYPE_READ_STRING_FRONT:
    1.16 +      break;
    1.17      case XEN_INIT_TYPE_READ_STRING_BACK:
    1.18 -    case XEN_INIT_TYPE_READ_STRING_FRONT:
    1.19 -      //KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_READ_STRING - %s = %s\n", setting, value));
    1.20 +      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_READ_STRING - %s = %s\n", setting, value));
    1.21        if (strcmp(setting, "mac") == 0)
    1.22        {
    1.23          char *s, *e;
    1.24 @@ -171,6 +173,13 @@ XenNet_ConnectBackend(struct xennet_info
    1.25            memcpy(xi->curr_mac_addr, xi->perm_mac_addr, ETH_ALEN);
    1.26          }
    1.27        }
    1.28 +      else if (strcmp(setting, "feature-sg") == 0)
    1.29 +      {
    1.30 +        if (atoi(value))
    1.31 +        {
    1.32 +          backend_sg = 1;
    1.33 +        }
    1.34 +      }
    1.35        break;
    1.36      case XEN_INIT_TYPE_VECTORS:
    1.37        KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_VECTORS\n"));
    1.38 @@ -194,6 +203,10 @@ XenNet_ConnectBackend(struct xennet_info
    1.39        break;
    1.40      }
    1.41    }
    1.42 +  if (xi->config_sg && !backend_sg)
    1.43 +  {
    1.44 +    KdPrint((__DRIVER_NAME "     SG not supported by backend - disabling\n"));
    1.45 +  }
    1.46    FUNCTION_EXIT();
    1.47    
    1.48    return NDIS_STATUS_SUCCESS;
    1.49 @@ -608,9 +621,10 @@ XenNet_Init(
    1.50    #pragma warning(suppress:4054)
    1.51    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_EVENT_CHANNEL, "event-channel", (PVOID)XenNet_HandleEvent, xi);
    1.52    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_READ_STRING_BACK, "mac", NULL, NULL);
    1.53 -  RtlStringCbPrintfA(buf, ARRAY_SIZE(buf), "%d", !xi->config_csum);
    1.54 +  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_READ_STRING_BACK, "feature-sg", NULL, NULL);
    1.55    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_WRITE_STRING, "request-rx-copy", "1", NULL);
    1.56    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_WRITE_STRING, "feature-rx-notify", "1", NULL);
    1.57 +  RtlStringCbPrintfA(buf, ARRAY_SIZE(buf), "%d", !xi->config_csum);
    1.58    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_WRITE_STRING, "feature-no-csum-offload", buf, NULL);
    1.59    RtlStringCbPrintfA(buf, ARRAY_SIZE(buf), "%d", (int)xi->config_sg);
    1.60    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_WRITE_STRING, "feature-sg", buf, NULL);