|
@@ -367,6 +367,56 @@ static int rndis_initialise ( struct rndis_device *rndis ) {
|
367
|
367
|
return 0;
|
368
|
368
|
}
|
369
|
369
|
|
|
370
|
+/**
|
|
371
|
+ * Transmit halt message
|
|
372
|
+ *
|
|
373
|
+ * @v rndis RNDIS device
|
|
374
|
+ * @ret rc Return status code
|
|
375
|
+ */
|
|
376
|
+static int rndis_tx_halt ( struct rndis_device *rndis ) {
|
|
377
|
+ struct io_buffer *iobuf;
|
|
378
|
+ struct rndis_halt_message *msg;
|
|
379
|
+ int rc;
|
|
380
|
+
|
|
381
|
+ /* Allocate I/O buffer */
|
|
382
|
+ iobuf = rndis_alloc_iob ( sizeof ( *msg ) );
|
|
383
|
+ if ( ! iobuf ) {
|
|
384
|
+ rc = -ENOMEM;
|
|
385
|
+ goto err_alloc;
|
|
386
|
+ }
|
|
387
|
+
|
|
388
|
+ /* Construct message */
|
|
389
|
+ msg = iob_put ( iobuf, sizeof ( *msg ) );
|
|
390
|
+ memset ( msg, 0, sizeof ( *msg ) );
|
|
391
|
+
|
|
392
|
+ /* Transmit message */
|
|
393
|
+ if ( ( rc = rndis_tx_message ( rndis, iobuf, RNDIS_HALT_MSG ) ) != 0 )
|
|
394
|
+ goto err_tx;
|
|
395
|
+
|
|
396
|
+ return 0;
|
|
397
|
+
|
|
398
|
+ err_tx:
|
|
399
|
+ free_iob ( iobuf );
|
|
400
|
+ err_alloc:
|
|
401
|
+ return rc;
|
|
402
|
+}
|
|
403
|
+
|
|
404
|
+/**
|
|
405
|
+ * Halt RNDIS
|
|
406
|
+ *
|
|
407
|
+ * @v rndis RNDIS device
|
|
408
|
+ * @ret rc Return status code
|
|
409
|
+ */
|
|
410
|
+static int rndis_halt ( struct rndis_device *rndis ) {
|
|
411
|
+ int rc;
|
|
412
|
+
|
|
413
|
+ /* Transmit halt message */
|
|
414
|
+ if ( ( rc = rndis_tx_halt ( rndis ) ) != 0 )
|
|
415
|
+ return rc;
|
|
416
|
+
|
|
417
|
+ return 0;
|
|
418
|
+}
|
|
419
|
+
|
370
|
420
|
/**
|
371
|
421
|
* Transmit OID message
|
372
|
422
|
*
|
|
@@ -822,6 +872,7 @@ static int rndis_open ( struct net_device *netdev ) {
|
822
|
872
|
|
823
|
873
|
err_query_link:
|
824
|
874
|
err_set_filter:
|
|
875
|
+ rndis_halt ( rndis );
|
825
|
876
|
err_initialise:
|
826
|
877
|
rndis->op->close ( rndis );
|
827
|
878
|
err_open:
|
|
@@ -836,6 +887,9 @@ static int rndis_open ( struct net_device *netdev ) {
|
836
|
887
|
static void rndis_close ( struct net_device *netdev ) {
|
837
|
888
|
struct rndis_device *rndis = netdev->priv;
|
838
|
889
|
|
|
890
|
+ /* Halt RNDIS device */
|
|
891
|
+ rndis_halt ( rndis );
|
|
892
|
+
|
839
|
893
|
/* Close RNDIS device */
|
840
|
894
|
rndis->op->close ( rndis );
|
841
|
895
|
}
|
|
@@ -947,6 +1001,9 @@ int register_rndis ( struct rndis_device *rndis ) {
|
947
|
1001
|
NULL, 0 ) ) != 0 )
|
948
|
1002
|
goto err_query_link;
|
949
|
1003
|
|
|
1004
|
+ /* Halt RNDIS device */
|
|
1005
|
+ rndis_halt ( rndis );
|
|
1006
|
+
|
950
|
1007
|
/* Close RNDIS device */
|
951
|
1008
|
rndis->op->close ( rndis );
|
952
|
1009
|
|
|
@@ -955,6 +1012,7 @@ int register_rndis ( struct rndis_device *rndis ) {
|
955
|
1012
|
err_query_link:
|
956
|
1013
|
err_query_current:
|
957
|
1014
|
err_query_permanent:
|
|
1015
|
+ rndis_halt ( rndis );
|
958
|
1016
|
err_initialise:
|
959
|
1017
|
rndis->op->close ( rndis );
|
960
|
1018
|
err_open:
|