Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Haiyang Zhang and committed by
David S. Miller
0dcec221 0fe554a4

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