aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/rndis.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-05-11 18:17:07 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-12 15:11:18 -0400
commit514911678fdcb35f7f69ebf96daf0e22cdae95ae (patch)
tree5cee6cd2efe05692076d2d202c6f1569af77eba9 /drivers/usb/gadget/rndis.c
parentc80174f3da2f0edec2b66afad673e1f854e8f0ee (diff)
usb/net: rndis: merge command codes
Switch the hyperv filter and rndis gadget driver to use the same command enumerators as the other drivers and delete the surplus command codes. Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/usb/gadget/rndis.c')
-rw-r--r--drivers/usb/gadget/rndis.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index d9086caab64b..d747e8912627 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -577,7 +577,7 @@ static int rndis_init_response(int configNr, rndis_init_msg_type *buf)
577 return -ENOMEM; 577 return -ENOMEM;
578 resp = (rndis_init_cmplt_type *)r->buf; 578 resp = (rndis_init_cmplt_type *)r->buf;
579 579
580 resp->MessageType = cpu_to_le32(REMOTE_NDIS_INITIALIZE_CMPLT); 580 resp->MessageType = cpu_to_le32(RNDIS_MSG_INIT_C);
581 resp->MessageLength = cpu_to_le32(52); 581 resp->MessageLength = cpu_to_le32(52);
582 resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ 582 resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
583 resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS); 583 resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS);
@@ -621,7 +621,7 @@ static int rndis_query_response(int configNr, rndis_query_msg_type *buf)
621 return -ENOMEM; 621 return -ENOMEM;
622 resp = (rndis_query_cmplt_type *)r->buf; 622 resp = (rndis_query_cmplt_type *)r->buf;
623 623
624 resp->MessageType = cpu_to_le32(REMOTE_NDIS_QUERY_CMPLT); 624 resp->MessageType = cpu_to_le32(RNDIS_MSG_QUERY_C);
625 resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ 625 resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
626 626
627 if (gen_ndis_query_resp(configNr, le32_to_cpu(buf->OID), 627 if (gen_ndis_query_resp(configNr, le32_to_cpu(buf->OID),
@@ -668,7 +668,7 @@ static int rndis_set_response(int configNr, rndis_set_msg_type *buf)
668 pr_debug("\n"); 668 pr_debug("\n");
669#endif 669#endif
670 670
671 resp->MessageType = cpu_to_le32(REMOTE_NDIS_SET_CMPLT); 671 resp->MessageType = cpu_to_le32(RNDIS_MSG_SET_C);
672 resp->MessageLength = cpu_to_le32(16); 672 resp->MessageLength = cpu_to_le32(16);
673 resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ 673 resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
674 if (gen_ndis_set_resp(configNr, le32_to_cpu(buf->OID), 674 if (gen_ndis_set_resp(configNr, le32_to_cpu(buf->OID),
@@ -692,7 +692,7 @@ static int rndis_reset_response(int configNr, rndis_reset_msg_type *buf)
692 return -ENOMEM; 692 return -ENOMEM;
693 resp = (rndis_reset_cmplt_type *)r->buf; 693 resp = (rndis_reset_cmplt_type *)r->buf;
694 694
695 resp->MessageType = cpu_to_le32(REMOTE_NDIS_RESET_CMPLT); 695 resp->MessageType = cpu_to_le32(RNDIS_MSG_RESET_C);
696 resp->MessageLength = cpu_to_le32(16); 696 resp->MessageLength = cpu_to_le32(16);
697 resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS); 697 resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS);
698 /* resent information */ 698 /* resent information */
@@ -716,8 +716,7 @@ static int rndis_keepalive_response(int configNr,
716 return -ENOMEM; 716 return -ENOMEM;
717 resp = (rndis_keepalive_cmplt_type *)r->buf; 717 resp = (rndis_keepalive_cmplt_type *)r->buf;
718 718
719 resp->MessageType = cpu_to_le32( 719 resp->MessageType = cpu_to_le32(RNDIS_MSG_KEEPALIVE_C);
720 REMOTE_NDIS_KEEPALIVE_CMPLT);
721 resp->MessageLength = cpu_to_le32(16); 720 resp->MessageLength = cpu_to_le32(16);
722 resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ 721 resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
723 resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS); 722 resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS);
@@ -745,7 +744,7 @@ static int rndis_indicate_status_msg(int configNr, u32 status)
745 return -ENOMEM; 744 return -ENOMEM;
746 resp = (rndis_indicate_status_msg_type *)r->buf; 745 resp = (rndis_indicate_status_msg_type *)r->buf;
747 746
748 resp->MessageType = cpu_to_le32(REMOTE_NDIS_INDICATE_STATUS_MSG); 747 resp->MessageType = cpu_to_le32(RNDIS_MSG_INDICATE);
749 resp->MessageLength = cpu_to_le32(20); 748 resp->MessageLength = cpu_to_le32(20);
750 resp->Status = cpu_to_le32(status); 749 resp->Status = cpu_to_le32(status);
751 resp->StatusBufferLength = cpu_to_le32(0); 750 resp->StatusBufferLength = cpu_to_le32(0);
@@ -817,15 +816,15 @@ int rndis_msg_parser(u8 configNr, u8 *buf)
817 816
818 /* For USB: responses may take up to 10 seconds */ 817 /* For USB: responses may take up to 10 seconds */
819 switch (MsgType) { 818 switch (MsgType) {
820 case REMOTE_NDIS_INITIALIZE_MSG: 819 case RNDIS_MSG_INIT:
821 pr_debug("%s: REMOTE_NDIS_INITIALIZE_MSG\n", 820 pr_debug("%s: RNDIS_MSG_INIT\n",
822 __func__); 821 __func__);
823 params->state = RNDIS_INITIALIZED; 822 params->state = RNDIS_INITIALIZED;
824 return rndis_init_response(configNr, 823 return rndis_init_response(configNr,
825 (rndis_init_msg_type *)buf); 824 (rndis_init_msg_type *)buf);
826 825
827 case REMOTE_NDIS_HALT_MSG: 826 case RNDIS_MSG_HALT:
828 pr_debug("%s: REMOTE_NDIS_HALT_MSG\n", 827 pr_debug("%s: RNDIS_MSG_HALT\n",
829 __func__); 828 __func__);
830 params->state = RNDIS_UNINITIALIZED; 829 params->state = RNDIS_UNINITIALIZED;
831 if (params->dev) { 830 if (params->dev) {
@@ -834,24 +833,24 @@ int rndis_msg_parser(u8 configNr, u8 *buf)
834 } 833 }
835 return 0; 834 return 0;
836 835
837 case REMOTE_NDIS_QUERY_MSG: 836 case RNDIS_MSG_QUERY:
838 return rndis_query_response(configNr, 837 return rndis_query_response(configNr,
839 (rndis_query_msg_type *)buf); 838 (rndis_query_msg_type *)buf);
840 839
841 case REMOTE_NDIS_SET_MSG: 840 case RNDIS_MSG_SET:
842 return rndis_set_response(configNr, 841 return rndis_set_response(configNr,
843 (rndis_set_msg_type *)buf); 842 (rndis_set_msg_type *)buf);
844 843
845 case REMOTE_NDIS_RESET_MSG: 844 case RNDIS_MSG_RESET:
846 pr_debug("%s: REMOTE_NDIS_RESET_MSG\n", 845 pr_debug("%s: RNDIS_MSG_RESET\n",
847 __func__); 846 __func__);
848 return rndis_reset_response(configNr, 847 return rndis_reset_response(configNr,
849 (rndis_reset_msg_type *)buf); 848 (rndis_reset_msg_type *)buf);
850 849
851 case REMOTE_NDIS_KEEPALIVE_MSG: 850 case RNDIS_MSG_KEEPALIVE:
852 /* For USB: host does this every 5 seconds */ 851 /* For USB: host does this every 5 seconds */
853 if (rndis_debug > 1) 852 if (rndis_debug > 1)
854 pr_debug("%s: REMOTE_NDIS_KEEPALIVE_MSG\n", 853 pr_debug("%s: RNDIS_MSG_KEEPALIVE\n",
855 __func__); 854 __func__);
856 return rndis_keepalive_response(configNr, 855 return rndis_keepalive_response(configNr,
857 (rndis_keepalive_msg_type *) 856 (rndis_keepalive_msg_type *)
@@ -963,7 +962,7 @@ void rndis_add_hdr(struct sk_buff *skb)
963 return; 962 return;
964 header = (void *)skb_push(skb, sizeof(*header)); 963 header = (void *)skb_push(skb, sizeof(*header));
965 memset(header, 0, sizeof *header); 964 memset(header, 0, sizeof *header);
966 header->MessageType = cpu_to_le32(REMOTE_NDIS_PACKET_MSG); 965 header->MessageType = cpu_to_le32(RNDIS_MSG_PACKET);
967 header->MessageLength = cpu_to_le32(skb->len); 966 header->MessageLength = cpu_to_le32(skb->len);
968 header->DataOffset = cpu_to_le32(36); 967 header->DataOffset = cpu_to_le32(36);
969 header->DataLength = cpu_to_le32(skb->len - sizeof(*header)); 968 header->DataLength = cpu_to_le32(skb->len - sizeof(*header));
@@ -1031,7 +1030,7 @@ int rndis_rm_hdr(struct gether *port,
1031 __le32 *tmp = (void *)skb->data; 1030 __le32 *tmp = (void *)skb->data;
1032 1031
1033 /* MessageType, MessageLength */ 1032 /* MessageType, MessageLength */
1034 if (cpu_to_le32(REMOTE_NDIS_PACKET_MSG) 1033 if (cpu_to_le32(RNDIS_MSG_PACKET)
1035 != get_unaligned(tmp++)) { 1034 != get_unaligned(tmp++)) {
1036 dev_kfree_skb_any(skb); 1035 dev_kfree_skb_any(skb);
1037 return -EINVAL; 1036 return -EINVAL;