Author: sephe
Date: Thu Aug 25 04:52:50 2016
New Revision: 304784
URL: https://svnweb.freebsd.org/changeset/base/304784

Log:
  hyperv/hn: Add compat code for RNDIS reorganization phase.
  
  MFC after:    1 week
  Sponsored by: Microsoft
  Differential Revision:        https://reviews.freebsd.org/D7621

Modified:
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c        Thu Aug 25 04:40:51 
2016        (r304783)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c        Thu Aug 25 04:52:50 
2016        (r304784)
@@ -62,6 +62,9 @@ __FBSDID("$FreeBSD$");
         HV_RF_RECVINFO_HASHINF |       \
         HV_RF_RECVINFO_HASHVAL)
 
+#define HN_RNDIS_RID_COMPAT_MASK       0xffff
+#define HN_RNDIS_RID_COMPAT_MAX                HN_RNDIS_RID_COMPAT_MASK
+
 /*
  * Forward declarations
  */
@@ -202,9 +205,8 @@ hv_rndis_request(rndis_device *device, u
         * as a template.
         */
        set = &rndis_mesg->msg.set_request;
-       set->request_id = atomic_fetchadd_int(&device->new_request_id, 1);
-       /* Increment to get the new value (call above returns old value) */
-       set->request_id += 1;
+       set->request_id = atomic_fetchadd_int(&device->new_request_id, 1) &
+           HN_RNDIS_RID_COMPAT_MASK;
 
        /* Add to the request list */
        mtx_lock(&device->req_lock);
@@ -552,6 +554,7 @@ hv_rf_on_receive(struct hn_softc *sc, st
 {
        rndis_device *rndis_dev;
        const rndis_msg *rndis_hdr;
+       const struct rndis_comp_hdr *comp;
 
        rndis_dev = sc->rndis_dev;
        if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED)
@@ -569,7 +572,11 @@ hv_rf_on_receive(struct hn_softc *sc, st
        case REMOTE_NDIS_QUERY_CMPLT:
        case REMOTE_NDIS_SET_CMPLT:
        case REMOTE_NDIS_KEEPALIVE_CMPLT:
-               hv_rf_receive_response(rndis_dev, rndis_hdr);
+               comp = data;
+               if (comp->rm_rid <= HN_RNDIS_RID_COMPAT_MAX) {
+                       /* Transition time compat code */
+                       hv_rf_receive_response(rndis_dev, rndis_hdr);
+               }
                break;
 
        /* notification message */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to