diff options
author | Haiyang Zhang <haiyangz@microsoft.com> | 2018-04-17 18:31:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-18 21:20:44 -0400 |
commit | 0dcec221dd39d4d48fe6b22b4cacf2f49b95ffa0 (patch) | |
tree | f2778693557856e7ac8e87503f434a33d0fb9543 /drivers/net/hyperv | |
parent | 0fe554a46a0ff855376053c7e4204673b7879f05 (diff) |
hv_netvsc: Add NetVSP v6 and v6.1 into version negotiation
This patch adds the NetVSP v6 and 6.1 message structures, and includes
these versions into NetVSC/NetVSP version negotiation process.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv')
-rw-r--r-- | drivers/net/hyperv/hyperv_net.h | 164 | ||||
-rw-r--r-- | drivers/net/hyperv/netvsc.c | 3 |
2 files changed, 166 insertions, 1 deletions
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 960f06141472..6ebe39a3dde6 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h | |||
@@ -237,6 +237,8 @@ void netvsc_switch_datapath(struct net_device *nv_dev, bool vf); | |||
237 | #define NVSP_PROTOCOL_VERSION_2 0x30002 | 237 | #define NVSP_PROTOCOL_VERSION_2 0x30002 |
238 | #define NVSP_PROTOCOL_VERSION_4 0x40000 | 238 | #define NVSP_PROTOCOL_VERSION_4 0x40000 |
239 | #define NVSP_PROTOCOL_VERSION_5 0x50000 | 239 | #define NVSP_PROTOCOL_VERSION_5 0x50000 |
240 | #define NVSP_PROTOCOL_VERSION_6 0x60000 | ||
241 | #define NVSP_PROTOCOL_VERSION_61 0x60001 | ||
240 | 242 | ||
241 | enum { | 243 | enum { |
242 | NVSP_MSG_TYPE_NONE = 0, | 244 | NVSP_MSG_TYPE_NONE = 0, |
@@ -308,6 +310,12 @@ enum { | |||
308 | NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE, | 310 | NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE, |
309 | 311 | ||
310 | NVSP_MSG5_MAX = NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE, | 312 | NVSP_MSG5_MAX = NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE, |
313 | |||
314 | /* Version 6 messages */ | ||
315 | NVSP_MSG6_TYPE_PD_API, | ||
316 | NVSP_MSG6_TYPE_PD_POST_BATCH, | ||
317 | |||
318 | NVSP_MSG6_MAX = NVSP_MSG6_TYPE_PD_POST_BATCH | ||
311 | }; | 319 | }; |
312 | 320 | ||
313 | enum { | 321 | enum { |
@@ -619,12 +627,168 @@ union nvsp_5_message_uber { | |||
619 | struct nvsp_5_send_indirect_table send_table; | 627 | struct nvsp_5_send_indirect_table send_table; |
620 | } __packed; | 628 | } __packed; |
621 | 629 | ||
630 | enum nvsp_6_pd_api_op { | ||
631 | PD_API_OP_CONFIG = 1, | ||
632 | PD_API_OP_SW_DATAPATH, /* Switch Datapath */ | ||
633 | PD_API_OP_OPEN_PROVIDER, | ||
634 | PD_API_OP_CLOSE_PROVIDER, | ||
635 | PD_API_OP_CREATE_QUEUE, | ||
636 | PD_API_OP_FLUSH_QUEUE, | ||
637 | PD_API_OP_FREE_QUEUE, | ||
638 | PD_API_OP_ALLOC_COM_BUF, /* Allocate Common Buffer */ | ||
639 | PD_API_OP_FREE_COM_BUF, /* Free Common Buffer */ | ||
640 | PD_API_OP_MAX | ||
641 | }; | ||
642 | |||
643 | struct grp_affinity { | ||
644 | u64 mask; | ||
645 | u16 grp; | ||
646 | u16 reserved[3]; | ||
647 | } __packed; | ||
648 | |||
649 | struct nvsp_6_pd_api_req { | ||
650 | u32 op; | ||
651 | |||
652 | union { | ||
653 | /* MMIO information is sent from the VM to VSP */ | ||
654 | struct __packed { | ||
655 | u64 mmio_pa; /* MMIO Physical Address */ | ||
656 | u32 mmio_len; | ||
657 | |||
658 | /* Number of PD queues a VM can support */ | ||
659 | u16 num_subchn; | ||
660 | } config; | ||
661 | |||
662 | /* Switch Datapath */ | ||
663 | struct __packed { | ||
664 | /* Host Datapath Is PacketDirect */ | ||
665 | u8 host_dpath_is_pd; | ||
666 | |||
667 | /* Guest PacketDirect Is Enabled */ | ||
668 | u8 guest_pd_enabled; | ||
669 | } sw_dpath; | ||
670 | |||
671 | /* Open Provider*/ | ||
672 | struct __packed { | ||
673 | u32 prov_id; /* Provider id */ | ||
674 | u32 flag; | ||
675 | } open_prov; | ||
676 | |||
677 | /* Close Provider */ | ||
678 | struct __packed { | ||
679 | u32 prov_id; | ||
680 | } cls_prov; | ||
681 | |||
682 | /* Create Queue*/ | ||
683 | struct __packed { | ||
684 | u32 prov_id; | ||
685 | u16 q_id; | ||
686 | u16 q_size; | ||
687 | u8 is_recv_q; | ||
688 | u8 is_rss_q; | ||
689 | u32 recv_data_len; | ||
690 | struct grp_affinity affy; | ||
691 | } cr_q; | ||
692 | |||
693 | /* Delete Queue*/ | ||
694 | struct __packed { | ||
695 | u32 prov_id; | ||
696 | u16 q_id; | ||
697 | } del_q; | ||
698 | |||
699 | /* Flush Queue */ | ||
700 | struct __packed { | ||
701 | u32 prov_id; | ||
702 | u16 q_id; | ||
703 | } flush_q; | ||
704 | |||
705 | /* Allocate Common Buffer */ | ||
706 | struct __packed { | ||
707 | u32 len; | ||
708 | u32 pf_node; /* Preferred Node */ | ||
709 | u16 region_id; | ||
710 | } alloc_com_buf; | ||
711 | |||
712 | /* Free Common Buffer */ | ||
713 | struct __packed { | ||
714 | u32 len; | ||
715 | u64 pa; /* Physical Address */ | ||
716 | u32 pf_node; /* Preferred Node */ | ||
717 | u16 region_id; | ||
718 | u8 cache_type; | ||
719 | } free_com_buf; | ||
720 | } __packed; | ||
721 | } __packed; | ||
722 | |||
723 | struct nvsp_6_pd_api_comp { | ||
724 | u32 op; | ||
725 | u32 status; | ||
726 | |||
727 | union { | ||
728 | struct __packed { | ||
729 | /* actual number of PD queues allocated to the VM */ | ||
730 | u16 num_pd_q; | ||
731 | |||
732 | /* Num Receive Rss PD Queues */ | ||
733 | u8 num_rss_q; | ||
734 | |||
735 | u8 is_supported; /* Is supported by VSP */ | ||
736 | u8 is_enabled; /* Is enabled by VSP */ | ||
737 | } config; | ||
738 | |||
739 | /* Open Provider */ | ||
740 | struct __packed { | ||
741 | u32 prov_id; | ||
742 | } open_prov; | ||
743 | |||
744 | /* Create Queue */ | ||
745 | struct __packed { | ||
746 | u32 prov_id; | ||
747 | u16 q_id; | ||
748 | u16 q_size; | ||
749 | u32 recv_data_len; | ||
750 | struct grp_affinity affy; | ||
751 | } cr_q; | ||
752 | |||
753 | /* Allocate Common Buffer */ | ||
754 | struct __packed { | ||
755 | u64 pa; /* Physical Address */ | ||
756 | u32 len; | ||
757 | u32 pf_node; /* Preferred Node */ | ||
758 | u16 region_id; | ||
759 | u8 cache_type; | ||
760 | } alloc_com_buf; | ||
761 | } __packed; | ||
762 | } __packed; | ||
763 | |||
764 | struct nvsp_6_pd_buf { | ||
765 | u32 region_offset; | ||
766 | u16 region_id; | ||
767 | u16 is_partial:1; | ||
768 | u16 reserved:15; | ||
769 | } __packed; | ||
770 | |||
771 | struct nvsp_6_pd_batch_msg { | ||
772 | struct nvsp_message_header hdr; | ||
773 | u16 count; | ||
774 | u16 guest2host:1; | ||
775 | u16 is_recv:1; | ||
776 | u16 reserved:14; | ||
777 | struct nvsp_6_pd_buf pd_buf[0]; | ||
778 | } __packed; | ||
779 | |||
780 | union nvsp_6_message_uber { | ||
781 | struct nvsp_6_pd_api_req pd_req; | ||
782 | struct nvsp_6_pd_api_comp pd_comp; | ||
783 | } __packed; | ||
784 | |||
622 | union nvsp_all_messages { | 785 | union nvsp_all_messages { |
623 | union nvsp_message_init_uber init_msg; | 786 | union nvsp_message_init_uber init_msg; |
624 | union nvsp_1_message_uber v1_msg; | 787 | union nvsp_1_message_uber v1_msg; |
625 | union nvsp_2_message_uber v2_msg; | 788 | union nvsp_2_message_uber v2_msg; |
626 | union nvsp_4_message_uber v4_msg; | 789 | union nvsp_4_message_uber v4_msg; |
627 | union nvsp_5_message_uber v5_msg; | 790 | union nvsp_5_message_uber v5_msg; |
791 | union nvsp_6_message_uber v6_msg; | ||
628 | } __packed; | 792 | } __packed; |
629 | 793 | ||
630 | /* ALL Messages */ | 794 | /* ALL Messages */ |
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 04f611e6f678..e7308958b7a9 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
@@ -525,7 +525,8 @@ static int netvsc_connect_vsp(struct hv_device *device, | |||
525 | struct net_device *ndev = hv_get_drvdata(device); | 525 | struct net_device *ndev = hv_get_drvdata(device); |
526 | static const u32 ver_list[] = { | 526 | static const u32 ver_list[] = { |
527 | NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2, | 527 | NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2, |
528 | NVSP_PROTOCOL_VERSION_4, NVSP_PROTOCOL_VERSION_5 | 528 | NVSP_PROTOCOL_VERSION_4, NVSP_PROTOCOL_VERSION_5, |
529 | NVSP_PROTOCOL_VERSION_6, NVSP_PROTOCOL_VERSION_61 | ||
529 | }; | 530 | }; |
530 | struct nvsp_message *init_packet; | 531 | struct nvsp_message *init_packet; |
531 | int ndis_version, i, ret; | 532 | int ndis_version, i, ret; |