RE: [PATCH net-next, v2] hyperv: Add handling of IP header with option field in netvsc_set_hash()
-Original Message- From: Haiyang Zhang [mailto:haiya...@microsoft.com] Sent: Tuesday, October 14, 2014 4:05 PM To: da...@davemloft.net; net...@vger.kernel.org Cc: Haiyang Zhang; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org Subject: [PATCH net-next,v2] hyperv: Add handling of IP header with option field in netvsc_set_hash() This is a duplicate of a patch submitted earlier today. Please ignore. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next, v2] hyperv: Add handling of IP header with option field in netvsc_set_hash()
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Tuesday, October 14, 2014 5:37 PM To: Haiyang Zhang Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next,v2] hyperv: Add handling of IP header with option field in netvsc_set_hash() From: Haiyang Zhang haiya...@microsoft.com Date: Tue, 14 Oct 2014 15:16:28 -0700 In case that the IP header has optional field at the end, this patch will get the port numbers after that field, and compute the hash. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com Instead of adding hack after hack after hack to your internal header parser, just use the generic flow dissector we already have in the kernel to fetch out the values you need. __skb_flow_get_ports() etc. Thanks. I will update the patch. - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next, v3] hyperv: Add handling of IP header with option field in netvsc_set_hash()
In case that the IP header has optional field at the end, this patch will get the port numbers after that field, and compute the hash. The general parser skb_flow_dissect() is used here. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/netvsc_drv.c | 26 ++ 1 files changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 0fcb5e7..9e17d1a 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -162,7 +162,7 @@ union sub_key { * data: network byte order * return: host byte order */ -static u32 comp_hash(u8 *key, int klen, u8 *data, int dlen) +static u32 comp_hash(u8 *key, int klen, void *data, int dlen) { union sub_key subk; int k_next = 4; @@ -176,7 +176,7 @@ static u32 comp_hash(u8 *key, int klen, u8 *data, int dlen) for (i = 0; i dlen; i++) { subk.kb = key[k_next]; k_next = (k_next + 1) % klen; - dt = data[i]; + dt = ((u8 *)data)[i]; for (j = 0; j 8; j++) { if (dt 0x80) ret ^= subk.ka; @@ -190,26 +190,20 @@ static u32 comp_hash(u8 *key, int klen, u8 *data, int dlen) static bool netvsc_set_hash(u32 *hash, struct sk_buff *skb) { - struct iphdr *iphdr; + struct flow_keys flow; int data_len; - bool ret = false; - if (eth_hdr(skb)-h_proto != htons(ETH_P_IP)) + if (!skb_flow_dissect(skb, flow) || flow.n_proto != htons(ETH_P_IP)) return false; - iphdr = ip_hdr(skb); + if (flow.ip_proto == IPPROTO_TCP) + data_len = 12; + else + data_len = 8; - if (iphdr-version == 4) { - if (iphdr-protocol == IPPROTO_TCP) - data_len = 12; - else - data_len = 8; - *hash = comp_hash(netvsc_hash_key, HASH_KEYLEN, - (u8 *)iphdr-saddr, data_len); - ret = true; - } + *hash = comp_hash(netvsc_hash_key, HASH_KEYLEN, flow, data_len); - return ret; + return true; } static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb, -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net 1/1] hyperv: Fix a bug in netvsc_send()
-Original Message- From: Sitsofe Wheeler [mailto:sits...@gmail.com] Sent: Tuesday, October 21, 2014 5:16 PM To: Long Li Cc: David Miller; o...@aepfle.de; net...@vger.kernel.org; jasow...@redhat.com; linux-ker...@vger.kernel.org; a...@canonical.com; de...@linuxdriverproject.org; Haiyang Zhang Subject: Re: [PATCH net 1/1] hyperv: Fix a bug in netvsc_send() On 21 October 2014 18:13, Long Li lon...@microsoft.com wrote: Thanks Sitsofe. This should have been fixed by this patch: http://git.kernel.org/cgit/linux/kernel/git/next/linux- next.git/commit/?id=f88e67149f97d73c704d6fe6f492edde97463025 Can you give it a try? Ah this one went mainline a few days ago so I've already been trying it. Yes it resolves my problem (that system is no longer oopsing on startup). I'd have added my Tested-by but it's already been committed :-) Thank you for the test! - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net] hyperv: Fix the total_data_buflen in send path
total_data_buflen is used by netvsc_send() to decide if a packet can be put into send buffer. It should also include the size of RNDIS message before the Ethernet frame. Otherwise, a messge with total size bigger than send_section_size may be copied into the send buffer, and cause data corruption. [Request to include this patch to the Stable branches] Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/netvsc_drv.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 9e17d1a..78ec33f 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -550,6 +550,7 @@ do_lso: do_send: /* Start filling in the page buffers with the rndis hdr */ rndis_msg-msg_len += rndis_msg_size; + packet-total_data_buflen = rndis_msg-msg_len; packet-page_buf_cnt = init_page_array(rndis_msg, rndis_msg_size, skb, packet-page_buf[0]); -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next] hyperv: Add IPv6 into the hash computation for vRSS
This will allow the workload spreading via vRSS for IPv6. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/netvsc_drv.c |4 +++- drivers/net/hyperv/rndis_filter.c |3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 78ec33f..3295e4e 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -193,7 +193,9 @@ static bool netvsc_set_hash(u32 *hash, struct sk_buff *skb) struct flow_keys flow; int data_len; - if (!skb_flow_dissect(skb, flow) || flow.n_proto != htons(ETH_P_IP)) + if (!skb_flow_dissect(skb, flow) || + !(flow.n_proto == htons(ETH_P_IP) || + flow.n_proto == htons(ETH_P_IPV6))) return false; if (flow.ip_proto == IPPROTO_TCP) diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 2b86f0b..ccce6f2 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -728,7 +728,8 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev, int num_queue) rssp-hdr.size = sizeof(struct ndis_recv_scale_param); rssp-flag = 0; rssp-hashinfo = NDIS_HASH_FUNC_TOEPLITZ | NDIS_HASH_IPV4 | -NDIS_HASH_TCP_IPV4; +NDIS_HASH_TCP_IPV4 | NDIS_HASH_IPV6 | +NDIS_HASH_TCP_IPV6; rssp-indirect_tabsize = 4*ITAB_NUM; rssp-indirect_taboffset = sizeof(struct ndis_recv_scale_param); rssp-hashkey_size = HASH_KEYLEN; -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next] hyperv: Add processing of MTU reduced by the host
If the host uses packet encapsulation feature, the MTU may be reduced by the host due to headroom reservation for encapsulation. This patch handles this new MTU value. Signed-off-by: Haiyang Zhang haiya...@microsoft.com --- drivers/net/hyperv/netvsc.c |3 ++- drivers/net/hyperv/netvsc_drv.c |4 ++-- drivers/net/hyperv/rndis_filter.c |9 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 7d76c95..6b46311 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -440,7 +440,8 @@ static int negotiate_nvsp_ver(struct hv_device *device, /* NVSPv2 only: Send NDIS config */ memset(init_packet, 0, sizeof(struct nvsp_message)); init_packet-hdr.msg_type = NVSP_MSG2_TYPE_SEND_NDIS_CONFIG; - init_packet-msg.v2_msg.send_ndis_config.mtu = net_device-ndev-mtu; + init_packet-msg.v2_msg.send_ndis_config.mtu = net_device-ndev-mtu + + ETH_HLEN; init_packet-msg.v2_msg.send_ndis_config.capability.ieee8021q = 1; ret = vmbus_sendpacket(device-channel, init_packet, diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 3295e4e..b689f96 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -699,9 +699,9 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) return -ENODEV; if (nvdev-nvsp_version = NVSP_PROTOCOL_VERSION_2) - limit = NETVSC_MTU; + limit = NETVSC_MTU - ETH_HLEN; - if (mtu 68 || mtu limit) + if (mtu ETH_DATA_LEN || mtu limit) return -EINVAL; nvdev-start_remove = true; diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index ccce6f2..7b2c5d1 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -998,6 +998,7 @@ int rndis_filter_device_add(struct hv_device *dev, int t; struct ndis_recv_scale_cap rsscap; u32 rsscap_size = sizeof(struct ndis_recv_scale_cap); + u32 mtu, size; rndis_device = get_rndis_device(); if (!rndis_device) @@ -1029,6 +1030,14 @@ int rndis_filter_device_add(struct hv_device *dev, return ret; } + /* Get the MTU from the host */ + size = sizeof(u32); + ret = rndis_filter_query_device(rndis_device, + RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE, + mtu, size); + if (ret == 0 size == sizeof(u32)) + net_device-ndev-mtu = mtu; + /* Get the mac address */ ret = rndis_filter_query_device_mac(rndis_device); if (ret != 0) { -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next, v2] hyperv: Add processing of MTU reduced by the host
If the host uses packet encapsulation feature, the MTU may be reduced by the host due to headroom reservation for encapsulation. This patch handles this new MTU value. Signed-off-by: Haiyang Zhang haiya...@microsoft.com --- drivers/net/hyperv/netvsc.c |3 ++- drivers/net/hyperv/netvsc_drv.c |5 +++-- drivers/net/hyperv/rndis_filter.c |9 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 7d76c95..6b46311 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -440,7 +440,8 @@ static int negotiate_nvsp_ver(struct hv_device *device, /* NVSPv2 only: Send NDIS config */ memset(init_packet, 0, sizeof(struct nvsp_message)); init_packet-hdr.msg_type = NVSP_MSG2_TYPE_SEND_NDIS_CONFIG; - init_packet-msg.v2_msg.send_ndis_config.mtu = net_device-ndev-mtu; + init_packet-msg.v2_msg.send_ndis_config.mtu = net_device-ndev-mtu + + ETH_HLEN; init_packet-msg.v2_msg.send_ndis_config.capability.ieee8021q = 1; ret = vmbus_sendpacket(device-channel, init_packet, diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 3295e4e..15d82ed 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -699,9 +699,10 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) return -ENODEV; if (nvdev-nvsp_version = NVSP_PROTOCOL_VERSION_2) - limit = NETVSC_MTU; + limit = NETVSC_MTU - ETH_HLEN; - if (mtu 68 || mtu limit) + /* Hyper-V hosts don't support MTU ETH_DATA_LEN (1500) */ + if (mtu ETH_DATA_LEN || mtu limit) return -EINVAL; nvdev-start_remove = true; diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index ccce6f2..7b2c5d1 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -998,6 +998,7 @@ int rndis_filter_device_add(struct hv_device *dev, int t; struct ndis_recv_scale_cap rsscap; u32 rsscap_size = sizeof(struct ndis_recv_scale_cap); + u32 mtu, size; rndis_device = get_rndis_device(); if (!rndis_device) @@ -1029,6 +1030,14 @@ int rndis_filter_device_add(struct hv_device *dev, return ret; } + /* Get the MTU from the host */ + size = sizeof(u32); + ret = rndis_filter_query_device(rndis_device, + RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE, + mtu, size); + if (ret == 0 size == sizeof(u32)) + net_device-ndev-mtu = mtu; + /* Get the mac address */ ret = rndis_filter_query_device_mac(rndis_device); if (ret != 0) { -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add processing of MTU reduced by the host
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Wednesday, November 12, 2014 3:04 PM To: Haiyang Zhang Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Add processing of MTU reduced by the host From: Haiyang Zhang haiya...@microsoft.com Date: Wed, 12 Nov 2014 20:02:11 + The Hyper-V host doesn't support MTU below 1500. If we try setting MTU to a value 1500, the host will use 1500 automatically and return 1500 in the RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE query and guest will also use it. That's why I set the lower limit to ETH_DATA_LEN. Are you suggesting that we keep the 68 as the lower limit, and let the host auto-reset it to 1500 when we trying to set an MTU 1500? Then you need to add a comment, because without any information or context that change looks wrong. I will add a comment. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add processing of MTU reduced by the host
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Wednesday, November 12, 2014 2:47 PM To: Haiyang Zhang Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Add processing of MTU reduced by the host From: Haiyang Zhang haiya...@microsoft.com Date: Tue, 11 Nov 2014 15:27:52 -0800 - if (mtu 68 || mtu limit) + if (mtu ETH_DATA_LEN || mtu limit) return -EINVAL; This is not correct. The test is against the minimally supported MTU, which should be 68 not ETH_DATA_LEN which is 1500. The Hyper-V host doesn't support MTU below 1500. If we try setting MTU to a value 1500, the host will use 1500 automatically and return 1500 in the RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE query and guest will also use it. That's why I set the lower limit to ETH_DATA_LEN. Are you suggesting that we keep the 68 as the lower limit, and let the host auto-reset it to 1500 when we trying to set an MTU 1500? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 1/1] net: Hyper-V: Deletion of an unnecessary check before the function call vfree
-Original Message- From: SF Markus Elfring [mailto:elfr...@users.sourceforge.net] Sent: Thursday, November 20, 2014 9:25 AM To: Haiyang Zhang; KY Srinivasan; de...@linuxdriverproject.org; net...@vger.kernel.org Cc: LKML; kernel-janit...@vger.kernel.org; Julia Lawall Subject: [PATCH 1/1] net: Hyper-V: Deletion of an unnecessary check before the function call vfree From: Markus Elfring elfr...@users.sourceforge.net Date: Thu, 20 Nov 2014 15:15:21 +0100 The vfree() function performs also input parameter validation. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring elfr...@users.sourceforge.net Signed-off-by: Haiyang Zhang haiya...@microsoft.com Thanks! ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next] hyperv: Add support for vNIC hot removal
This patch adds proper handling of the vNIC hot removal event, which includes a rescind-channel-offer message from the host side that triggers vNIC close and removal. In this case, the notices to the host during close and removal is not necessary because the channel is rescinded. This patch blocks these unnecessary messages, and lets vNIC removal process complete normally. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/hv/channel_mgmt.c |2 ++ drivers/net/hyperv/netvsc.c |3 +++ drivers/net/hyperv/rndis_filter.c |3 +++ include/linux/hyperv.h|2 ++ 4 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index a2d1a96..191a6a3 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -517,6 +517,8 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr) /* Just return here, no channel found */ return; + channel-rescind = true; + /* work is initialized for vmbus_process_rescind_offer() from * vmbus_process_offer() where the channel got created */ queue_work(channel-controlwq, channel-work); diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 6fc834e..dd867e6 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -764,6 +764,9 @@ int netvsc_send(struct hv_device *device, out_channel = device-channel; packet-channel = out_channel; + if (out_channel-rescind) + return -ENODEV; + if (packet-page_buf_cnt) { ret = vmbus_sendpacket_pagebuffer(out_channel, packet-page_buf, diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 7b2c5d1..ec0c40a 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -958,6 +958,9 @@ static int rndis_filter_close_device(struct rndis_device *dev) return 0; ret = rndis_filter_set_packet_filter(dev, 0); + if (ret == -ENODEV) + ret = 0; + if (ret == 0) dev-state = RNDIS_DEV_INITIALIZED; diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 08cfaff..476c685 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -650,6 +650,8 @@ struct vmbus_channel { u8 monitor_grp; u8 monitor_bit; + bool rescind; /* got rescind msg */ + u32 ringbuffer_gpadlhandle; /* Allocated memory for ring buffer */ -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net] netvsc: don't flush peers notifying work during setting mtu
-Original Message- From: Jason Wang [mailto:jasow...@redhat.com] Sent: Friday, December 13, 2013 4:21 AM To: KY Srinivasan; Haiyang Zhang; de...@linuxdriverproject.org; net...@vger.kernel.org; linux-ker...@vger.kernel.org Cc: Jason Wang Subject: [PATCH net] netvsc: don't flush peers notifying work during setting mtu There's a possible deadlock if we flush the peers notifying work during setting mtu: [ 22.991149] == [ 22.991173] [ INFO: possible circular locking dependency detected ] [ 22.991198] 3.10.0-54.0.1.el7.x86_64.debug #1 Not tainted [ 22.991219] --- [ 22.991243] ip/974 is trying to acquire lock: [ 22.991261] (((net_device_ctx-dwork)-work)){+.+.+.}, at: [8108af95] flush_work+0x5/0x2e0 [ 22.991307] but task is already holding lock: [ 22.991330] (rtnl_mutex){+.+.+.}, at: [81539deb] rtnetlink_rcv+0x1b/0x40 [ 22.991367] which lock already depends on the new lock. [ 22.991398] the existing dependency chain (in reverse order) is: [ 22.991426] - #1 (rtnl_mutex){+.+.+.}: [ 22.991449][810dfdd9] __lock_acquire+0xb19/0x1260 [ 22.991477][810e0d12] lock_acquire+0xa2/0x1f0 [ 22.991501][81673659] mutex_lock_nested+0x89/0x4f0 [ 22.991529][815392b7] rtnl_lock+0x17/0x20 [ 22.991552][815230b2] netdev_notify_peers+0x12/0x30 [ 22.991579][a0340212] netvsc_send_garp+0x22/0x30 [hv_netvsc] [ 22.991610][8108d251] process_one_work+0x211/0x6e0 [ 22.991637][8108d83b] worker_thread+0x11b/0x3a0 [ 22.991663][81095e5d] kthread+0xed/0x100 [ 22.991686][81681c6c] ret_from_fork+0x7c/0xb0 [ 22.991715] - #0 (((net_device_ctx-dwork)-work)){+.+.+.}: [ 22.991715][810de817] check_prevs_add+0x967/0x970 [ 22.991715][810dfdd9] __lock_acquire+0xb19/0x1260 [ 22.991715][810e0d12] lock_acquire+0xa2/0x1f0 [ 22.991715][8108afde] flush_work+0x4e/0x2e0 [ 22.991715][8108e1b5] __cancel_work_timer+0x95/0x130 [ 22.991715][8108e303] cancel_delayed_work_sync+0x13/0x20 [ 22.991715][a03404e4] netvsc_change_mtu+0x84/0x200 [hv_netvsc] [ 22.991715][815233d4] dev_set_mtu+0x34/0x80 [ 22.991715][8153bc2a] do_setlink+0x23a/0xa00 [ 22.991715][8153d054] rtnl_newlink+0x394/0x5e0 [ 22.991715][81539eac] rtnetlink_rcv_msg+0x9c/0x260 [ 22.991715][8155cdd9] netlink_rcv_skb+0xa9/0xc0 [ 22.991715][81539dfa] rtnetlink_rcv+0x2a/0x40 [ 22.991715][8155c41d] netlink_unicast+0xdd/0x190 [ 22.991715][8155c807] netlink_sendmsg+0x337/0x750 [ 22.991715][8150d219] sock_sendmsg+0x99/0xd0 [ 22.991715][8150d63e] ___sys_sendmsg+0x39e/0x3b0 [ 22.991715][8150eba2] __sys_sendmsg+0x42/0x80 [ 22.991715][8150ebf2] SyS_sendmsg+0x12/0x20 [ 22.991715][81681d19] system_call_fastpath+0x16/0x1b This is because we hold the rtnl_lock() before ndo_change_mtu() and try to flush the work in netvsc_change_mtu(), in the mean time, netdev_notify_peers() may be called from worker and also trying to hold the rtnl_lock. This will lead the flush won't succeed forever. Solve this by not canceling and flushing the work, this is safe because the transmission done by NETDEV_NOTIFY_PEERS was synchronized with the netif_tx_disable() called by netvsc_change_mtu(). Reported-by: Yaju Cao ya...@redhat.com Tested-by: Yaju Cao ya...@redhat.com Cc: K. Y. Srinivasan k...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Signed-off-by: Jason Wang jasow...@redhat.com Acked-by: Haiyang Zhang haiya...@microsoft.com ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add support for Virtual Receive Side Scaling (vRSS)
-Original Message- From: Daniel Borkmann [mailto:dbork...@redhat.com] Sent: Thursday, December 19, 2013 1:45 PM To: Haiyang Zhang Cc: Ben Hutchings; da...@davemloft.net; net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux- ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Add support for Virtual Receive Side Scaling (vRSS) On 12/19/2013 07:36 PM, Haiyang Zhang wrote: Thank you for the suggestions! I will re-write the send queue selection, enhance the hash calculation, also fix the initialization sequence. Btw, Toeplitz hash function should either go into lib/hash.c as well or include/linux/hash.h to avoid ending up w/ various implementations in multiple places. Will do. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add support for Virtual Receive Side Scaling (vRSS)
-Original Message- From: Ben Hutchings [mailto:bhutchi...@solarflare.com] Sent: Thursday, December 19, 2013 12:46 PM To: Haiyang Zhang Cc: da...@davemloft.net; net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Add support for Virtual Receive Side Scaling (vRSS) On Wed, 2013-12-18 at 14:21 -0800, Haiyang Zhang wrote: This feature allows multiple channels to be used by each virtual NIC. It is available on Hyper-V host 2012 R2. } else if (ret == -EAGAIN) { - netif_stop_queue(ndev); + netif_tx_stop_all_queues(ndev); if (atomic_read(net_device-num_outstanding_sends) 1) { - netif_wake_queue(ndev); + netif_tx_wake_all_queues(ndev); ret = -ENOSPC; } } else { This doesn't makes any sense to me. How can you safely share the same channels between all TX queues? I think you need to associate TX queues and channels 1-1. If you are required to map packets to TX queues using the Toeplitz hash, you should implement ndo_select_queue and do the mapping there. Then in netvsc_send() you would use the queue number from the skb to find which channel to use and which queue may need to be stopped/woken. [...] --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c [...] +/* Toeplitz hash function + * data: network byte order + * return: host byte order + */ This looks incredibly slow. I've seen software implementations that are likely to be more efficient, e.g. http://thread.gmane.org/gmane.linux.network/284612/ [...] int netvsc_probe(struct hv_device *dev, return ret; } memcpy(net-dev_addr, device_info.mac_adr, ETH_ALEN); + nvdev = hv_get_drvdata(dev); + rtnl_lock(); + netif_set_real_num_tx_queues(net, nvdev-num_chn); + netif_set_real_num_rx_queues(net, nvdev-num_chn); [...] These functions can fail if called after registering the net device, so you should either call them with the final values earlier or handle failure here. Also, I notice that dev_addr is only set after registering; that should be fixed. Thank you for the suggestions! I will re-write the send queue selection, enhance the hash calculation, also fix the initialization sequence. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add support for Virtual Receive Side Scaling (vRSS)
-Original Message- From: Tom Herbert [mailto:therb...@google.com] Sent: Thursday, December 19, 2013 4:43 PM To: Haiyang Zhang Cc: Daniel Borkmann; Ben Hutchings; da...@davemloft.net; net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Add support for Virtual Receive Side Scaling (vRSS) Patch is below. This version did most pre-computation of the variants I built, but results in largest table (40*256*4 bytes), This gives performance roughly comparable with jhash (roughly same as jhash for IPv4, about 30% more cycles for IPv6). I have the simpler less memory intensive versions also if you're interested, these are 10x worse cycles so I wouldn't want those in critical path. Thank you for the code. We like the fast implementation even it uses a bit more memory. Are you going to address the comments and re-submit the code soon? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add support for Virtual Receive Side Scaling (vRSS)
-Original Message- From: Tom Herbert [mailto:therb...@google.com] Sent: Thursday, December 19, 2013 2:59 PM To: Haiyang Zhang Cc: Daniel Borkmann; Ben Hutchings; da...@davemloft.net; net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Add support for Virtual Receive Side Scaling (vRSS) I posted an implementation of library functions for Toeplitz (see [PATCH 1/2] net: Toeplitz library functions). This includes some pre-computation of the table to get reasonable performance in the host. Please take a look. On the other hand, if you're computing a hash in the host, do you really need Toeplitz, flow_dissector already supports a good hash computation and can parse many more packets than just plain UDP/TCP. We probably only should be doing Toeplitz in the host if we need to match HW computed values. The Hyper-V host requires the guest to select channel based on Toeplitz hash, so we need to compute it on the guest. Regarding the Toeplitz function, do you mean this patch? http://patchwork.ozlabs.org/patch/277344/ This doesn't contain the implementation. Could you point me to the actual code? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net] hyperv: Fix race between probe and open calls
Moving the register_netdev to the end of probe to prevent possible open call happens before NetVSP is connected. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/netvsc_drv.c | 20 1 files changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index f813572..71baeb3 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -261,9 +261,7 @@ int netvsc_recv_callback(struct hv_device *device_obj, struct sk_buff *skb; net = ((struct netvsc_device *)hv_get_drvdata(device_obj))-ndev; - if (!net) { - netdev_err(net, got receive callback but net device -not initialized yet\n); + if (!net || net-reg_state != NETREG_REGISTERED) { packet-status = NVSP_STAT_FAIL; return 0; } @@ -435,19 +433,11 @@ static int netvsc_probe(struct hv_device *dev, SET_ETHTOOL_OPS(net, ethtool_ops); SET_NETDEV_DEV(net, dev-device); - ret = register_netdev(net); - if (ret != 0) { - pr_err(Unable to register netdev.\n); - free_netdev(net); - goto out; - } - /* Notify the netvsc driver of the new device */ device_info.ring_size = ring_size; ret = rndis_filter_device_add(dev, device_info); if (ret != 0) { netdev_err(net, unable to add netvsc device (ret %d)\n, ret); - unregister_netdev(net); free_netdev(net); hv_set_drvdata(dev, NULL); return ret; @@ -456,7 +446,13 @@ static int netvsc_probe(struct hv_device *dev, netif_carrier_on(net); -out: + ret = register_netdev(net); + if (ret != 0) { + pr_err(Unable to register netdev.\n); + rndis_filter_device_remove(dev); + free_netdev(net); + } + return ret; } -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next] hyperv: Add support for physically discontinuous receive buffer
This will allow us to use bigger receive buffer, and prevent allocation failure due to fragmented memory. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/hv/channel.c| 14 -- drivers/net/hyperv/hyperv_net.h |2 +- drivers/net/hyperv/netvsc.c |7 ++- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index cea623c..69ea36f 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -209,7 +209,6 @@ static int create_gpadl_header(void *kbuffer, u32 size, { int i; int pagecount; - unsigned long long pfn; struct vmbus_channel_gpadl_header *gpadl_header; struct vmbus_channel_gpadl_body *gpadl_body; struct vmbus_channel_msginfo *msgheader; @@ -219,7 +218,6 @@ static int create_gpadl_header(void *kbuffer, u32 size, int pfnsum, pfncount, pfnleft, pfncurr, pfnsize; pagecount = size PAGE_SHIFT; - pfn = virt_to_phys(kbuffer) PAGE_SHIFT; /* do we need a gpadl body msg */ pfnsize = MAX_SIZE_CHANNEL_MESSAGE - @@ -248,7 +246,8 @@ static int create_gpadl_header(void *kbuffer, u32 size, gpadl_header-range[0].byte_offset = 0; gpadl_header-range[0].byte_count = size; for (i = 0; i pfncount; i++) - gpadl_header-range[0].pfn_array[i] = pfn+i; + gpadl_header-range[0].pfn_array[i] = slow_virt_to_phys( + kbuffer + PAGE_SIZE * i) PAGE_SHIFT; *msginfo = msgheader; *messagecount = 1; @@ -301,7 +300,9 @@ static int create_gpadl_header(void *kbuffer, u32 size, * so the hypervisor gurantees that this is ok. */ for (i = 0; i pfncurr; i++) - gpadl_body-pfn[i] = pfn + pfnsum + i; + gpadl_body-pfn[i] = slow_virt_to_phys( + kbuffer + PAGE_SIZE * (pfnsum + i)) + PAGE_SHIFT; /* add to msg header */ list_add_tail(msgbody-msglistentry, @@ -327,7 +328,8 @@ static int create_gpadl_header(void *kbuffer, u32 size, gpadl_header-range[0].byte_offset = 0; gpadl_header-range[0].byte_count = size; for (i = 0; i pagecount; i++) - gpadl_header-range[0].pfn_array[i] = pfn+i; + gpadl_header-range[0].pfn_array[i] = slow_virt_to_phys( + kbuffer + PAGE_SIZE * i) PAGE_SHIFT; *msginfo = msgheader; *messagecount = 1; @@ -344,7 +346,7 @@ nomem: * vmbus_establish_gpadl - Estabish a GPADL for the specified buffer * * @channel: a channel - * @kbuffer: from kmalloc + * @kbuffer: from kmalloc or vmalloc * @size: page-size multiple * @gpadl_handle: some funky thing */ diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index a26eecb..7b594ce 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -462,7 +462,7 @@ struct nvsp_message { #define NETVSC_MTU 65536 -#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*2) /* 2MB */ +#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */ #define NETVSC_RECEIVE_BUFFER_ID 0xcafe diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 93b485b..03a2c6e 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -136,8 +136,7 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device) if (net_device-recv_buf) { /* Free up the receive buffer */ - free_pages((unsigned long)net_device-recv_buf, - get_order(net_device-recv_buf_size)); + vfree(net_device-recv_buf); net_device-recv_buf = NULL; } @@ -163,9 +162,7 @@ static int netvsc_init_recv_buf(struct hv_device *device) return -ENODEV; ndev = net_device-ndev; - net_device-recv_buf = - (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, - get_order(net_device-recv_buf_size)); + net_device-recv_buf = vzalloc(net_device-recv_buf_size); if (!net_device-recv_buf) { netdev_err(ndev, unable to allocate receive buffer of size %d\n, net_device-recv_buf_size); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] hyperv_fb: Add screen refresh after pause/resume operation
This is necessary because after VM is pause/resumed, some portion of the screen may need refresh. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/video/hyperv_fb.c | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c index 130708f..bbcc8c0 100644 --- a/drivers/video/hyperv_fb.c +++ b/drivers/video/hyperv_fb.c @@ -218,6 +218,7 @@ struct hvfb_par { struct delayed_work dwork; bool update; + bool xrefresh; u32 pseudo_palette[16]; u8 init_buf[MAX_VMBUS_PKT_SIZE]; @@ -369,7 +370,7 @@ static void synthvid_recv_sub(struct hv_device *hdev) synthvid_send_situ(hdev); } - par-update = msg-feature_chg.is_dirt_needed; + par-xrefresh = par-update = msg-feature_chg.is_dirt_needed; if (par-update) schedule_delayed_work(par-dwork, HVFB_UPDATE_DELAY); } @@ -522,6 +523,13 @@ static void hvfb_update_work(struct work_struct *w) { struct hvfb_par *par = container_of(w, struct hvfb_par, dwork.work); struct fb_info *info = par-info; + char *argv[] = {/usr/bin/xrefresh, -display, :0.0, NULL}; + char *envp[] = {HOME=/, PATH=/sbin:/usr/sbin:/bin:/usr/bin, NULL }; + + if (par-xrefresh) { + par-xrefresh = false; + call_usermodehelper(argv[0], argv, envp, UMH_NO_WAIT); + } if (par-fb_ready) synthvid_update(info); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add support for physically discontinuous receive buffer
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Tuesday, January 14, 2014 5:32 PM To: Haiyang Zhang Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Add support for physically discontinuous receive buffer From: Haiyang Zhang haiya...@microsoft.com Date: Thu, 9 Jan 2014 14:24:47 -0800 This will allow us to use bigger receive buffer, and prevent allocation failure due to fragmented memory. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com Not until you start using paged SKBs in netvsc_recv_callback. Whatever fragmention you think you're avoiding in the hyperv layer, you're still going to get from the: skb = netdev_alloc_skb_ip_align(net, packet-total_data_buflen); call there. This change makes no sense in isolation, therefore I'm not applying it until you also include the appropriate changes to avoid the same exact fragmentation issue in netvsc_drv.c as stated above. The receive buffer currently requires multiple MB of physically continuous memory, and may fail to be allocated when memory is fragmented. The patch is created for this issue. The SKB buffer is usually less than 1500 bytes or up to several KB with jumbo frame, so it's much less sensitive to fragmented memory. I will work on another patch to use SKB buffer with discontinuous pages. Could you accept this patch separately? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net] net: hyperv: initialize link status correctly
-Original Message- From: Jason Wang [mailto:jasow...@redhat.com] Sent: Monday, January 27, 2014 2:31 AM To: KY Srinivasan; Haiyang Zhang; de...@linuxdriverproject.org; net...@vger.kernel.org; linux-ker...@vger.kernel.org Cc: Jason Wang Subject: [PATCH net] net: hyperv: initialize link status correctly Call netif_carrier_on() after register_device(). Otherwise it won't work since the device was still in NETREG_UNINITIALIZED state. Fixes a68f9614614749727286f675d15f1e09d13cb54a (hyperv: Fix race between probe and open calls) Cc: Haiyang Zhang haiya...@microsoft.com Cc: K. Y. Srinivasan k...@microsoft.com Reported-by: Di Nie d...@redhat.com Tested-by: Di Nie d...@redhat.com Signed-off-by: Jason Wang jasow...@redhat.com --- I'm working on a fix for this, and will submit it soon. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add support for physically discontinuous receive buffer
-Original Message- From: KY Srinivasan Sent: Monday, January 20, 2014 5:11 PM To: Haiyang Zhang; David Miller Cc: net...@vger.kernel.org; o...@aepfle.de; jasow...@redhat.com; linux- ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org Subject: RE: [PATCH net-next] hyperv: Add support for physically discontinuous receive buffer -Original Message- From: Haiyang Zhang Sent: Monday, January 20, 2014 2:06 PM To: David Miller Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: RE: [PATCH net-next] hyperv: Add support for physically discontinuous receive buffer -Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Tuesday, January 14, 2014 5:32 PM To: Haiyang Zhang Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Add support for physically discontinuous receive buffer From: Haiyang Zhang haiya...@microsoft.com Date: Thu, 9 Jan 2014 14:24:47 -0800 This will allow us to use bigger receive buffer, and prevent allocation failure due to fragmented memory. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com Not until you start using paged SKBs in netvsc_recv_callback. Whatever fragmention you think you're avoiding in the hyperv layer, you're still going to get from the: skb = netdev_alloc_skb_ip_align(net, packet-total_data_buflen); call there. This change makes no sense in isolation, therefore I'm not applying it until you also include the appropriate changes to avoid the same exact fragmentation issue in netvsc_drv.c as stated above. The receive buffer currently requires multiple MB of physically continuous memory, and may fail to be allocated when memory is fragmented. The patch is created for this issue. The SKB buffer is usually less than 1500 bytes or up to several KB with jumbo frame, so it's much less sensitive to fragmented memory. I will work on another patch to use SKB buffer with discontinuous pages. Could you accept this patch separately? Today, if we try to unload and load the network driver, the load may fail because we may not be able to allocate the receive buffers if memory is fragmented. This patch specifically addresses this problem. Regards, K. Y Dave, So, could this patch be taken first? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add support for physically discontinuous receive buffer
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Monday, January 27, 2014 4:51 PM To: Haiyang Zhang Cc: KY Srinivasan; net...@vger.kernel.org; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Add support for physically discontinuous receive buffer From: Haiyang Zhang haiya...@microsoft.com Date: Mon, 27 Jan 2014 21:47:43 + So, could this patch be taken first? You always need to resend patches that I've originally rejected and you've made arguments for. Sure, I will re-send it now. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next] hyperv: Add support for physically discontinuous receive buffer
This will allow us to use bigger receive buffer, and prevent allocation failure due to fragmented memory. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/hv/channel.c| 14 -- drivers/net/hyperv/hyperv_net.h |2 +- drivers/net/hyperv/netvsc.c |7 ++- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index cea623c..69ea36f 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -209,7 +209,6 @@ static int create_gpadl_header(void *kbuffer, u32 size, { int i; int pagecount; - unsigned long long pfn; struct vmbus_channel_gpadl_header *gpadl_header; struct vmbus_channel_gpadl_body *gpadl_body; struct vmbus_channel_msginfo *msgheader; @@ -219,7 +218,6 @@ static int create_gpadl_header(void *kbuffer, u32 size, int pfnsum, pfncount, pfnleft, pfncurr, pfnsize; pagecount = size PAGE_SHIFT; - pfn = virt_to_phys(kbuffer) PAGE_SHIFT; /* do we need a gpadl body msg */ pfnsize = MAX_SIZE_CHANNEL_MESSAGE - @@ -248,7 +246,8 @@ static int create_gpadl_header(void *kbuffer, u32 size, gpadl_header-range[0].byte_offset = 0; gpadl_header-range[0].byte_count = size; for (i = 0; i pfncount; i++) - gpadl_header-range[0].pfn_array[i] = pfn+i; + gpadl_header-range[0].pfn_array[i] = slow_virt_to_phys( + kbuffer + PAGE_SIZE * i) PAGE_SHIFT; *msginfo = msgheader; *messagecount = 1; @@ -301,7 +300,9 @@ static int create_gpadl_header(void *kbuffer, u32 size, * so the hypervisor gurantees that this is ok. */ for (i = 0; i pfncurr; i++) - gpadl_body-pfn[i] = pfn + pfnsum + i; + gpadl_body-pfn[i] = slow_virt_to_phys( + kbuffer + PAGE_SIZE * (pfnsum + i)) + PAGE_SHIFT; /* add to msg header */ list_add_tail(msgbody-msglistentry, @@ -327,7 +328,8 @@ static int create_gpadl_header(void *kbuffer, u32 size, gpadl_header-range[0].byte_offset = 0; gpadl_header-range[0].byte_count = size; for (i = 0; i pagecount; i++) - gpadl_header-range[0].pfn_array[i] = pfn+i; + gpadl_header-range[0].pfn_array[i] = slow_virt_to_phys( + kbuffer + PAGE_SIZE * i) PAGE_SHIFT; *msginfo = msgheader; *messagecount = 1; @@ -344,7 +346,7 @@ nomem: * vmbus_establish_gpadl - Estabish a GPADL for the specified buffer * * @channel: a channel - * @kbuffer: from kmalloc + * @kbuffer: from kmalloc or vmalloc * @size: page-size multiple * @gpadl_handle: some funky thing */ diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index a26eecb..7b594ce 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -462,7 +462,7 @@ struct nvsp_message { #define NETVSC_MTU 65536 -#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*2) /* 2MB */ +#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */ #define NETVSC_RECEIVE_BUFFER_ID 0xcafe diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 93b485b..03a2c6e 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -136,8 +136,7 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device) if (net_device-recv_buf) { /* Free up the receive buffer */ - free_pages((unsigned long)net_device-recv_buf, - get_order(net_device-recv_buf_size)); + vfree(net_device-recv_buf); net_device-recv_buf = NULL; } @@ -163,9 +162,7 @@ static int netvsc_init_recv_buf(struct hv_device *device) return -ENODEV; ndev = net_device-ndev; - net_device-recv_buf = - (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, - get_order(net_device-recv_buf_size)); + net_device-recv_buf = vzalloc(net_device-recv_buf_size); if (!net_device-recv_buf) { netdev_err(ndev, unable to allocate receive buffer of size %d\n, net_device-recv_buf_size); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] hyperv_fb: Add support for Gen2 VM
This patch enables Hyper-V FB driver to run on Gen2 VM. The Gen2 VM provides MMIO area for synthetic video from ACPI module, which is exported by vmbus. The generic video is provided by UEFI. PCI video in Gen1 is no longer available. To support synthetic video on Hyper-V Gen2 VM, this patch updated code related to the changes above. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/video/hyperv_fb.c | 60 ++-- 1 files changed, 41 insertions(+), 19 deletions(-) diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c index bbcc8c0..5db1f20 100644 --- a/drivers/video/hyperv_fb.c +++ b/drivers/video/hyperv_fb.c @@ -42,6 +42,7 @@ #include linux/completion.h #include linux/fb.h #include linux/pci.h +#include linux/efi.h #include linux/hyperv.h @@ -461,13 +462,13 @@ static int synthvid_connect_vsp(struct hv_device *hdev) goto error; } - if (par-synthvid_version == SYNTHVID_VERSION_WIN7) { + if (par-synthvid_version == SYNTHVID_VERSION_WIN7) screen_depth = SYNTHVID_DEPTH_WIN7; - screen_fb_size = SYNTHVID_FB_SIZE_WIN7; - } else { + else screen_depth = SYNTHVID_DEPTH_WIN8; - screen_fb_size = SYNTHVID_FB_SIZE_WIN8; - } + + screen_fb_size = hdev-channel-offermsg.offer. + mmio_megabytes * 1024 * 1024; return 0; @@ -635,22 +636,33 @@ static void hvfb_get_option(struct fb_info *info) /* Get framebuffer memory from Hyper-V video pci space */ static int hvfb_getmem(struct fb_info *info) { - struct pci_dev *pdev; + struct pci_dev *pdev = NULL; ulong fb_phys; void __iomem *fb_virt; + bool gen2vm = efi_enabled(EFI_BOOT); - pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, + if (gen2vm) { + if (!hyperv_mmio_start || hyperv_mmio_size screen_fb_size) { + pr_err(Unable to find ACPI MMIO area\n); + return -ENODEV; + } + + fb_phys = hyperv_mmio_start; + } else { + pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, PCI_DEVICE_ID_HYPERV_VIDEO, NULL); - if (!pdev) { - pr_err(Unable to find PCI Hyper-V video\n); - return -ENODEV; - } + if (!pdev) { + pr_err(Unable to find PCI Hyper-V video\n); + return -ENODEV; + } - if (!(pci_resource_flags(pdev, 0) IORESOURCE_MEM) || - pci_resource_len(pdev, 0) screen_fb_size) - goto err1; + if (!(pci_resource_flags(pdev, 0) IORESOURCE_MEM) || + pci_resource_len(pdev, 0) screen_fb_size) + goto err1; + + fb_phys = pci_resource_end(pdev, 0) - screen_fb_size + 1; + } - fb_phys = pci_resource_end(pdev, 0) - screen_fb_size + 1; if (!request_mem_region(fb_phys, screen_fb_size, KBUILD_MODNAME)) goto err1; @@ -662,14 +674,22 @@ static int hvfb_getmem(struct fb_info *info) if (!info-apertures) goto err3; - info-apertures-ranges[0].base = pci_resource_start(pdev, 0); - info-apertures-ranges[0].size = pci_resource_len(pdev, 0); + if (gen2vm) { + info-apertures-ranges[0].base = screen_info.lfb_base; + info-apertures-ranges[0].size = screen_info.lfb_size; + } else { + info-apertures-ranges[0].base = pci_resource_start(pdev, 0); + info-apertures-ranges[0].size = pci_resource_len(pdev, 0); + } + info-fix.smem_start = fb_phys; info-fix.smem_len = screen_fb_size; info-screen_base = fb_virt; info-screen_size = screen_fb_size; - pci_dev_put(pdev); + if (!gen2vm) + pci_dev_put(pdev); + return 0; err3: @@ -677,7 +697,9 @@ err3: err2: release_mem_region(fb_phys, screen_fb_size); err1: - pci_dev_put(pdev); + if (!gen2vm) + pci_dev_put(pdev); + return -ENOMEM; } -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net,v2] hyperv: Fix the carrier status setting
Without this patch, the cat /sys/class/net/ethN/operstate shows unknown, and ethtool ethN shows Link detected: yes, when VM boots up with or without vNIC connected. This patch fixed the problem. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/netvsc_drv.c | 24 +++- 1 files changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 7756118..18916f7 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -88,8 +88,12 @@ static int netvsc_open(struct net_device *net) { struct net_device_context *net_device_ctx = netdev_priv(net); struct hv_device *device_obj = net_device_ctx-device_ctx; + struct netvsc_device *nvdev; + struct rndis_device *rdev; int ret = 0; + netif_carrier_off(net); + /* Open up the device */ ret = rndis_filter_open(device_obj); if (ret != 0) { @@ -99,6 +103,11 @@ static int netvsc_open(struct net_device *net) netif_start_queue(net); + nvdev = hv_get_drvdata(device_obj); + rdev = nvdev-extension; + if (!rdev-link_state) + netif_carrier_on(net); + return ret; } @@ -229,15 +238,17 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, struct net_device *net; struct net_device_context *ndev_ctx; struct netvsc_device *net_device; + struct rndis_device *rdev; net_device = hv_get_drvdata(device_obj); + rdev = net_device-extension; + + rdev-link_state = status != 1; + net = net_device-ndev; - if (!net) { - netdev_err(net, got link status but net device - not initialized yet\n); + if (!net || net-reg_state != NETREG_REGISTERED) return; - } if (status == 1) { netif_carrier_on(net); @@ -414,9 +425,6 @@ static int netvsc_probe(struct hv_device *dev, if (!net) return -ENOMEM; - /* Set initial state */ - netif_carrier_off(net); - net_device_ctx = netdev_priv(net); net_device_ctx-device_ctx = dev; hv_set_drvdata(dev, net); @@ -443,8 +451,6 @@ static int netvsc_probe(struct hv_device *dev, } memcpy(net-dev_addr, device_info.mac_adr, ETH_ALEN); - netif_carrier_on(net); - ret = register_netdev(net); if (ret != 0) { pr_err(Unable to register netdev.\n); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net] hyperv: Fix the carrier status setting
-Original Message- From: Sergei Shtylyov [mailto:sergei.shtyl...@cogentembedded.com] Sent: Monday, February 10, 2014 8:29 AM To: Haiyang Zhang; da...@davemloft.net; net...@vger.kernel.org Cc: KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux- ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org Subject: Re: [PATCH net] hyperv: Fix the carrier status setting Hello. On 10-02-2014 5:07, Haiyang Zhang wrote: Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/netvsc_drv.c | 24 +++- 1 files changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 7756118..836211c 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c [...] @@ -229,15 +238,17 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, struct net_device *net; struct net_device_context *ndev_ctx; struct netvsc_device *net_device; + struct rndis_device *rdev; net_device = hv_get_drvdata(device_obj); + rdev = net_device-extension; + + rdev-link_state = !(status == 1); Why not just 'status != 1'? I will simplify it. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] hyperv_fb: Add screen refresh after pause/resume operation
-Original Message- From: Haiyang Zhang [mailto:haiya...@microsoft.com] Sent: Monday, January 13, 2014 7:21 PM To: florianschandi...@gmx.de; a...@linux-foundation.org; linux- fb...@vger.kernel.org Cc: Haiyang Zhang; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org Subject: [PATCH] hyperv_fb: Add screen refresh after pause/resume operation This is necessary because after VM is pause/resumed, some portion of the screen may need refresh. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- This was submitted before the tree re-opened. Is it still being considered? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net,v3] hyperv: Fix the carrier status setting
Without this patch, the cat /sys/class/net/ethN/operstate shows unknown, and ethtool ethN shows Link detected: yes, when VM boots up with or without vNIC connected. This patch fixed the problem. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/netvsc_drv.c | 53 --- 1 files changed, 38 insertions(+), 15 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 7756118..7141a19 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -88,8 +88,12 @@ static int netvsc_open(struct net_device *net) { struct net_device_context *net_device_ctx = netdev_priv(net); struct hv_device *device_obj = net_device_ctx-device_ctx; + struct netvsc_device *nvdev; + struct rndis_device *rdev; int ret = 0; + netif_carrier_off(net); + /* Open up the device */ ret = rndis_filter_open(device_obj); if (ret != 0) { @@ -99,6 +103,11 @@ static int netvsc_open(struct net_device *net) netif_start_queue(net); + nvdev = hv_get_drvdata(device_obj); + rdev = nvdev-extension; + if (!rdev-link_state) + netif_carrier_on(net); + return ret; } @@ -229,23 +238,24 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, struct net_device *net; struct net_device_context *ndev_ctx; struct netvsc_device *net_device; + struct rndis_device *rdev; net_device = hv_get_drvdata(device_obj); + rdev = net_device-extension; + + rdev-link_state = status != 1; + net = net_device-ndev; - if (!net) { - netdev_err(net, got link status but net device - not initialized yet\n); + if (!net || net-reg_state != NETREG_REGISTERED) return; - } + ndev_ctx = netdev_priv(net); if (status == 1) { - netif_carrier_on(net); - ndev_ctx = netdev_priv(net); schedule_delayed_work(ndev_ctx-dwork, 0); schedule_delayed_work(ndev_ctx-dwork, msecs_to_jiffies(20)); } else { - netif_carrier_off(net); + schedule_delayed_work(ndev_ctx-dwork, 0); } } @@ -388,17 +398,35 @@ static const struct net_device_ops device_ops = { * current context when receiving RNDIS_STATUS_MEDIA_CONNECT event. So, add * another netif_notify_peers() into a delayed work, otherwise GARP packet * will not be sent after quick migration, and cause network disconnection. + * Also, we update the carrier status here. */ -static void netvsc_send_garp(struct work_struct *w) +static void netvsc_link_change(struct work_struct *w) { struct net_device_context *ndev_ctx; struct net_device *net; struct netvsc_device *net_device; + struct rndis_device *rdev; + bool notify; + + rtnl_lock(); ndev_ctx = container_of(w, struct net_device_context, dwork.work); net_device = hv_get_drvdata(ndev_ctx-device_ctx); + rdev = net_device-extension; net = net_device-ndev; - netdev_notify_peers(net); + + if (rdev-link_state) { + netif_carrier_off(net); + notify = false; + } else { + netif_carrier_on(net); + notify = true; + } + + rtnl_unlock(); + + if (notify) + netdev_notify_peers(net); } @@ -414,13 +442,10 @@ static int netvsc_probe(struct hv_device *dev, if (!net) return -ENOMEM; - /* Set initial state */ - netif_carrier_off(net); - net_device_ctx = netdev_priv(net); net_device_ctx-device_ctx = dev; hv_set_drvdata(dev, net); - INIT_DELAYED_WORK(net_device_ctx-dwork, netvsc_send_garp); + INIT_DELAYED_WORK(net_device_ctx-dwork, netvsc_link_change); INIT_WORK(net_device_ctx-work, do_set_multicast); net-netdev_ops = device_ops; @@ -443,8 +468,6 @@ static int netvsc_probe(struct hv_device *dev, } memcpy(net-dev_addr, device_info.mac_adr, ETH_ALEN); - netif_carrier_on(net); - ret = register_netdev(net); if (ret != 0) { pr_err(Unable to register netdev.\n); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net,v2] hyperv: Fix the carrier status setting
-Original Message- From: Jason Wang [mailto:jasow...@redhat.com] Sent: Tuesday, February 11, 2014 4:51 AM To: Haiyang Zhang; da...@davemloft.net; net...@vger.kernel.org Cc: KY Srinivasan; o...@aepfle.de; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net,v2] hyperv: Fix the carrier status setting On 02/11/2014 02:15 AM, Haiyang Zhang wrote: Without this patch, the cat /sys/class/net/ethN/operstate shows unknown, and ethtool ethN shows Link detected: yes, when VM boots up with or without vNIC connected. This patch fixed the problem. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/netvsc_drv.c | 24 +++- 1 files changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 7756118..18916f7 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -88,8 +88,12 @@ static int netvsc_open(struct net_device *net) { struct net_device_context *net_device_ctx = netdev_priv(net); struct hv_device *device_obj = net_device_ctx-device_ctx; + struct netvsc_device *nvdev; + struct rndis_device *rdev; int ret = 0; + netif_carrier_off(net); + /* Open up the device */ ret = rndis_filter_open(device_obj); if (ret != 0) { @@ -99,6 +103,11 @@ static int netvsc_open(struct net_device *net) netif_start_queue(net); + nvdev = hv_get_drvdata(device_obj); + rdev = nvdev-extension; + if (!rdev-link_state) What if the link status interrupt comes here at this time? Thank you for pointing this out. I have submitted an updated patch. - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net,v3] hyperv: Fix the carrier status setting
-Original Message- From: Jason Wang [mailto:jasow...@redhat.com] Sent: Wednesday, February 12, 2014 10:52 PM To: Haiyang Zhang; da...@davemloft.net; net...@vger.kernel.org Cc: KY Srinivasan; o...@aepfle.de; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net,v3] hyperv: Fix the carrier status setting On 02/13/2014 08:54 AM, Haiyang Zhang wrote: Without this patch, the cat /sys/class/net/ethN/operstate shows unknown, and ethtool ethN shows Link detected: yes, when VM boots up with or without vNIC connected. This patch fixed the problem. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/netvsc_drv.c | 53 --- 1 files changed, 38 insertions(+), 15 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 7756118..7141a19 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -88,8 +88,12 @@ static int netvsc_open(struct net_device *net) { struct net_device_context *net_device_ctx = netdev_priv(net); struct hv_device *device_obj = net_device_ctx-device_ctx; + struct netvsc_device *nvdev; + struct rndis_device *rdev; int ret = 0; + netif_carrier_off(net); + /* Open up the device */ ret = rndis_filter_open(device_obj); if (ret != 0) { @@ -99,6 +103,11 @@ static int netvsc_open(struct net_device *net) netif_start_queue(net); + nvdev = hv_get_drvdata(device_obj); + rdev = nvdev-extension; + if (!rdev-link_state) + netif_carrier_on(net); + Maybe you can just schedule the work here and then you can drop the rtnl_lock in netvsc_link_change() ? The rtnl_lock will still be necessary in the netvsc_link_change(), because we want to prevent it getting wrong rdev pointer when netvsc_change_mtu is removing/adding rndis device. + + if (notify) + netdev_notify_peers(net); } Looks like this forces arp_notify here. Is it expected? Yes, this is expected. It's required after live migration. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] hyperv_fb: Add screen refresh after pause/resume operation
-Original Message- From: Haiyang Zhang [mailto:haiya...@microsoft.com] Sent: Monday, January 13, 2014 7:21 PM To: florianschandi...@gmx.de; a...@linux-foundation.org; linux- fb...@vger.kernel.org Cc: Haiyang Zhang; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org Subject: [PATCH] hyperv_fb: Add screen refresh after pause/resume operation This is necessary because after VM is pause/resumed, some portion of the screen may need refresh. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- Hi Tomi and Andrew, This patch has been submitted for a while. Do I need to re-submit it, or make any changes? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] hyperv_fb: Add support for Gen2 VM
-Original Message- From: linux-fbdev-ow...@vger.kernel.org [mailto:linux-fbdev- ow...@vger.kernel.org] On Behalf Of Haiyang Zhang Sent: Saturday, February 8, 2014 12:26 PM To: florianschandi...@gmx.de; a...@linux-foundation.org; linux- fb...@vger.kernel.org Cc: Haiyang Zhang; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: [PATCH] hyperv_fb: Add support for Gen2 VM This patch enables Hyper-V FB driver to run on Gen2 VM. The Gen2 VM provides MMIO area for synthetic video from ACPI module, which is exported by vmbus. The generic video is provided by UEFI. PCI video in Gen1 is no longer available. To support synthetic video on Hyper-V Gen2 VM, this patch updated code related to the changes above. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- Hi Tomi and Andrew, This patch has been submitted for a while. Do I need to re-submit it, or make any changes? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next] hyperv: Add latest NetVSP versions to auto negotiation
It auto negotiates the highest NetVSP version supported by both guest and host. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h | 53 +++ drivers/net/hyperv/netvsc.c | 26 -- drivers/net/hyperv/netvsc_drv.c |2 +- 3 files changed, 71 insertions(+), 10 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 01a16ea..39fc230 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -139,6 +139,8 @@ int rndis_filter_set_device_mac(struct hv_device *hdev, char *mac); #define NVSP_PROTOCOL_VERSION_12 #define NVSP_PROTOCOL_VERSION_20x30002 +#define NVSP_PROTOCOL_VERSION_40x4 +#define NVSP_PROTOCOL_VERSION_50x5 enum { NVSP_MSG_TYPE_NONE = 0, @@ -193,6 +195,23 @@ enum { NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE, NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE_COMP, + + NVSP_MSG2_MAX = NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE_COMP, + + /* Version 4 messages */ + NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION, + NVSP_MSG4_TYPE_SWITCH_DATA_PATH, + NVSP_MSG4_TYPE_UPLINK_CONNECT_STATE_DEPRECATED, + + NVSP_MSG4_MAX = NVSP_MSG4_TYPE_UPLINK_CONNECT_STATE_DEPRECATED, + + /* Version 5 messages */ + NVSP_MSG5_TYPE_OID_QUERY_EX, + NVSP_MSG5_TYPE_OID_QUERY_EX_COMP, + NVSP_MSG5_TYPE_SUBCHANNEL, + NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE, + + NVSP_MSG5_MAX = NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE, }; enum { @@ -447,10 +466,44 @@ union nvsp_2_message_uber { struct nvsp_2_free_rxbuf free_rxbuf; } __packed; +enum nvsp_subchannel_operation { + NVSP_SUBCHANNEL_NONE = 0, + NVSP_SUBCHANNEL_ALLOCATE, + NVSP_SUBCHANNEL_MAX +}; + +struct nvsp_5_subchannel_request { + u32 op; + u32 num_subchannels; +} __packed; + +struct nvsp_5_subchannel_complete { + u32 status; + u32 num_subchannels; /* Actual number of subchannels allocated */ +} __packed; + +struct nvsp_5_send_indirect_table { + /* The number of entries in the send indirection table */ + u32 count; + + /* The offset of the send indireciton table from top of this struct. +* The send indirection table tells which channel to put the send +* traffic on. Each entry is a channel number. +*/ + u32 offset; +} __packed; + +union nvsp_5_message_uber { + struct nvsp_5_subchannel_request subchn_req; + struct nvsp_5_subchannel_complete subchn_comp; + struct nvsp_5_send_indirect_table send_table; +} __packed; + union nvsp_all_messages { union nvsp_message_init_uber init_msg; union nvsp_1_message_uber v1_msg; union nvsp_2_message_uber v2_msg; + union nvsp_5_message_uber v5_msg; } __packed; /* ALL Messages */ diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 9a0e9c6..fc2941c 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -290,7 +290,7 @@ static int negotiate_nvsp_ver(struct hv_device *device, NVSP_STAT_SUCCESS) return -EINVAL; - if (nvsp_ver != NVSP_PROTOCOL_VERSION_2) + if (nvsp_ver == NVSP_PROTOCOL_VERSION_1) return 0; /* NVSPv2 only: Send NDIS config */ @@ -314,6 +314,10 @@ static int netvsc_connect_vsp(struct hv_device *device) struct nvsp_message *init_packet; int ndis_version; struct net_device *ndev; + u32 ver_list[] = {NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2, + NVSP_PROTOCOL_VERSION_4, NVSP_PROTOCOL_VERSION_5}; + int i, num_ver = 4; /* number of different NVSP versions */ + net_device = get_outbound_net_device(device); if (!net_device) @@ -323,13 +327,14 @@ static int netvsc_connect_vsp(struct hv_device *device) init_packet = net_device-channel_init_pkt; /* Negotiate the latest NVSP protocol supported */ - if (negotiate_nvsp_ver(device, net_device, init_packet, - NVSP_PROTOCOL_VERSION_2) == 0) { - net_device-nvsp_version = NVSP_PROTOCOL_VERSION_2; - } else if (negotiate_nvsp_ver(device, net_device, init_packet, - NVSP_PROTOCOL_VERSION_1) == 0) { - net_device-nvsp_version = NVSP_PROTOCOL_VERSION_1; - } else { + for (i = num_ver - 1; i = 0; i--) + if (negotiate_nvsp_ver(device, net_device, init_packet, + ver_list[i]) == 0) { + net_device-nvsp_version = ver_list[i]; + break; + } + + if (i 0) { ret = -EPROTO; goto cleanup; } @@ -339,7 +344,10 @@ static int netvsc_connect_vsp(struct hv_device *device
[PATCH 0/2] Re-sending two patches for hyperv_fb
They were sent out during tree closing, I'm re-sending them now. Haiyang Zhang (2): hyperv_fb: Add screen refresh after pause/resume operation hyperv_fb: Add support for Gen2 VM drivers/video/hyperv_fb.c | 70 - 1 files changed, 50 insertions(+), 20 deletions(-) -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] hyperv_fb: Add screen refresh after pause/resume operation
This is necessary because after VM is pause/resumed, some portion of the screen may need refresh. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/video/hyperv_fb.c | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c index 130708f..bbcc8c0 100644 --- a/drivers/video/hyperv_fb.c +++ b/drivers/video/hyperv_fb.c @@ -218,6 +218,7 @@ struct hvfb_par { struct delayed_work dwork; bool update; + bool xrefresh; u32 pseudo_palette[16]; u8 init_buf[MAX_VMBUS_PKT_SIZE]; @@ -369,7 +370,7 @@ static void synthvid_recv_sub(struct hv_device *hdev) synthvid_send_situ(hdev); } - par-update = msg-feature_chg.is_dirt_needed; + par-xrefresh = par-update = msg-feature_chg.is_dirt_needed; if (par-update) schedule_delayed_work(par-dwork, HVFB_UPDATE_DELAY); } @@ -522,6 +523,13 @@ static void hvfb_update_work(struct work_struct *w) { struct hvfb_par *par = container_of(w, struct hvfb_par, dwork.work); struct fb_info *info = par-info; + char *argv[] = {/usr/bin/xrefresh, -display, :0.0, NULL}; + char *envp[] = {HOME=/, PATH=/sbin:/usr/sbin:/bin:/usr/bin, NULL }; + + if (par-xrefresh) { + par-xrefresh = false; + call_usermodehelper(argv[0], argv, envp, UMH_NO_WAIT); + } if (par-fb_ready) synthvid_update(info); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next, v2] hyperv: Add latest NetVSP versions to auto negotiation
It auto negotiates the highest NetVSP version supported by both guest and host. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h | 53 +++ drivers/net/hyperv/netvsc.c | 25 +++-- drivers/net/hyperv/netvsc_drv.c |2 +- 3 files changed, 70 insertions(+), 10 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 01a16ea..39fc230 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -139,6 +139,8 @@ int rndis_filter_set_device_mac(struct hv_device *hdev, char *mac); #define NVSP_PROTOCOL_VERSION_12 #define NVSP_PROTOCOL_VERSION_20x30002 +#define NVSP_PROTOCOL_VERSION_40x4 +#define NVSP_PROTOCOL_VERSION_50x5 enum { NVSP_MSG_TYPE_NONE = 0, @@ -193,6 +195,23 @@ enum { NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE, NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE_COMP, + + NVSP_MSG2_MAX = NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE_COMP, + + /* Version 4 messages */ + NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION, + NVSP_MSG4_TYPE_SWITCH_DATA_PATH, + NVSP_MSG4_TYPE_UPLINK_CONNECT_STATE_DEPRECATED, + + NVSP_MSG4_MAX = NVSP_MSG4_TYPE_UPLINK_CONNECT_STATE_DEPRECATED, + + /* Version 5 messages */ + NVSP_MSG5_TYPE_OID_QUERY_EX, + NVSP_MSG5_TYPE_OID_QUERY_EX_COMP, + NVSP_MSG5_TYPE_SUBCHANNEL, + NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE, + + NVSP_MSG5_MAX = NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE, }; enum { @@ -447,10 +466,44 @@ union nvsp_2_message_uber { struct nvsp_2_free_rxbuf free_rxbuf; } __packed; +enum nvsp_subchannel_operation { + NVSP_SUBCHANNEL_NONE = 0, + NVSP_SUBCHANNEL_ALLOCATE, + NVSP_SUBCHANNEL_MAX +}; + +struct nvsp_5_subchannel_request { + u32 op; + u32 num_subchannels; +} __packed; + +struct nvsp_5_subchannel_complete { + u32 status; + u32 num_subchannels; /* Actual number of subchannels allocated */ +} __packed; + +struct nvsp_5_send_indirect_table { + /* The number of entries in the send indirection table */ + u32 count; + + /* The offset of the send indireciton table from top of this struct. +* The send indirection table tells which channel to put the send +* traffic on. Each entry is a channel number. +*/ + u32 offset; +} __packed; + +union nvsp_5_message_uber { + struct nvsp_5_subchannel_request subchn_req; + struct nvsp_5_subchannel_complete subchn_comp; + struct nvsp_5_send_indirect_table send_table; +} __packed; + union nvsp_all_messages { union nvsp_message_init_uber init_msg; union nvsp_1_message_uber v1_msg; union nvsp_2_message_uber v2_msg; + union nvsp_5_message_uber v5_msg; } __packed; /* ALL Messages */ diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 9a0e9c6..1a0280d 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -290,7 +290,7 @@ static int negotiate_nvsp_ver(struct hv_device *device, NVSP_STAT_SUCCESS) return -EINVAL; - if (nvsp_ver != NVSP_PROTOCOL_VERSION_2) + if (nvsp_ver == NVSP_PROTOCOL_VERSION_1) return 0; /* NVSPv2 only: Send NDIS config */ @@ -314,6 +314,9 @@ static int netvsc_connect_vsp(struct hv_device *device) struct nvsp_message *init_packet; int ndis_version; struct net_device *ndev; + u32 ver_list[] = { NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2, + NVSP_PROTOCOL_VERSION_4, NVSP_PROTOCOL_VERSION_5 }; + int i, num_ver = 4; /* number of different NVSP versions */ net_device = get_outbound_net_device(device); if (!net_device) @@ -323,13 +326,14 @@ static int netvsc_connect_vsp(struct hv_device *device) init_packet = net_device-channel_init_pkt; /* Negotiate the latest NVSP protocol supported */ - if (negotiate_nvsp_ver(device, net_device, init_packet, - NVSP_PROTOCOL_VERSION_2) == 0) { - net_device-nvsp_version = NVSP_PROTOCOL_VERSION_2; - } else if (negotiate_nvsp_ver(device, net_device, init_packet, - NVSP_PROTOCOL_VERSION_1) == 0) { - net_device-nvsp_version = NVSP_PROTOCOL_VERSION_1; - } else { + for (i = num_ver - 1; i = 0; i--) + if (negotiate_nvsp_ver(device, net_device, init_packet, + ver_list[i]) == 0) { + net_device-nvsp_version = ver_list[i]; + break; + } + + if (i 0) { ret = -EPROTO; goto cleanup; } @@ -339,7 +343,10 @@ static int netvsc_connect_vsp(struct hv_device *device
RE: [PATCH net-next] hyperv: Add latest NetVSP versions to auto negotiation
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Wednesday, February 19, 2014 4:23 PM To: Haiyang Zhang Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Add latest NetVSP versions to auto negotiation From: Haiyang Zhang haiya...@microsoft.com Date: Tue, 18 Feb 2014 12:28:54 -0800 + u32 ver_list[] = {NVSP_PROTOCOL_VERSION_1, NVSP_PROTOCOL_VERSION_2, + NVSP_PROTOCOL_VERSION_4, NVSP_PROTOCOL_VERSION_5}; Please put a space after { and before }. + int i, num_ver = 4; /* number of different NVSP versions */ + net_device = get_outbound_net_device(device); Please delete the extraneous empty line. + for (i = num_ver - 1; i = 0; i--) + if (negotiate_nvsp_ver(device, net_device, init_packet, + ver_list[i]) == 0) { This is not indented properly, ver_list[i]) should begin precisely after the openning parenthesis of the negotiate_nvsp_ver() function call. I have sent out a new patch with the suggested updates. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2,0/2] Re-sending two patches for hyperv_fb
They were sent out during tree closing, I'm re-sending them now. --- v2: Updated the variable type gen2vm to int, because efi_enabled() returns int. Haiyang Zhang (2): hyperv_fb: Add screen refresh after pause/resume operation hyperv_fb: Add support for Gen2 VM drivers/video/hyperv_fb.c | 70 - 1 files changed, 50 insertions(+), 20 deletions(-) -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2,2/2] hyperv_fb: Add support for Gen2 VM
This patch enables Hyper-V FB driver to run on Gen2 VM. The Gen2 VM provides MMIO area for synthetic video from ACPI module, which is exported by vmbus. The generic video is provided by UEFI. PCI video in Gen1 is no longer available. To support synthetic video on Hyper-V Gen2 VM, this patch updated code related to the changes above. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/video/hyperv_fb.c | 60 ++-- 1 files changed, 41 insertions(+), 19 deletions(-) diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c index bbcc8c0..5db1f20 100644 --- a/drivers/video/hyperv_fb.c +++ b/drivers/video/hyperv_fb.c @@ -42,6 +42,7 @@ #include linux/completion.h #include linux/fb.h #include linux/pci.h +#include linux/efi.h #include linux/hyperv.h @@ -461,13 +462,13 @@ static int synthvid_connect_vsp(struct hv_device *hdev) goto error; } - if (par-synthvid_version == SYNTHVID_VERSION_WIN7) { + if (par-synthvid_version == SYNTHVID_VERSION_WIN7) screen_depth = SYNTHVID_DEPTH_WIN7; - screen_fb_size = SYNTHVID_FB_SIZE_WIN7; - } else { + else screen_depth = SYNTHVID_DEPTH_WIN8; - screen_fb_size = SYNTHVID_FB_SIZE_WIN8; - } + + screen_fb_size = hdev-channel-offermsg.offer. + mmio_megabytes * 1024 * 1024; return 0; @@ -635,22 +636,33 @@ static void hvfb_get_option(struct fb_info *info) /* Get framebuffer memory from Hyper-V video pci space */ static int hvfb_getmem(struct fb_info *info) { - struct pci_dev *pdev; + struct pci_dev *pdev = NULL; ulong fb_phys; void __iomem *fb_virt; + int gen2vm = efi_enabled(EFI_BOOT); - pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, + if (gen2vm) { + if (!hyperv_mmio_start || hyperv_mmio_size screen_fb_size) { + pr_err(Unable to find ACPI MMIO area\n); + return -ENODEV; + } + + fb_phys = hyperv_mmio_start; + } else { + pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, PCI_DEVICE_ID_HYPERV_VIDEO, NULL); - if (!pdev) { - pr_err(Unable to find PCI Hyper-V video\n); - return -ENODEV; - } + if (!pdev) { + pr_err(Unable to find PCI Hyper-V video\n); + return -ENODEV; + } - if (!(pci_resource_flags(pdev, 0) IORESOURCE_MEM) || - pci_resource_len(pdev, 0) screen_fb_size) - goto err1; + if (!(pci_resource_flags(pdev, 0) IORESOURCE_MEM) || + pci_resource_len(pdev, 0) screen_fb_size) + goto err1; + + fb_phys = pci_resource_end(pdev, 0) - screen_fb_size + 1; + } - fb_phys = pci_resource_end(pdev, 0) - screen_fb_size + 1; if (!request_mem_region(fb_phys, screen_fb_size, KBUILD_MODNAME)) goto err1; @@ -662,14 +674,22 @@ static int hvfb_getmem(struct fb_info *info) if (!info-apertures) goto err3; - info-apertures-ranges[0].base = pci_resource_start(pdev, 0); - info-apertures-ranges[0].size = pci_resource_len(pdev, 0); + if (gen2vm) { + info-apertures-ranges[0].base = screen_info.lfb_base; + info-apertures-ranges[0].size = screen_info.lfb_size; + } else { + info-apertures-ranges[0].base = pci_resource_start(pdev, 0); + info-apertures-ranges[0].size = pci_resource_len(pdev, 0); + } + info-fix.smem_start = fb_phys; info-fix.smem_len = screen_fb_size; info-screen_base = fb_virt; info-screen_size = screen_fb_size; - pci_dev_put(pdev); + if (!gen2vm) + pci_dev_put(pdev); + return 0; err3: @@ -677,7 +697,9 @@ err3: err2: release_mem_region(fb_phys, screen_fb_size); err1: - pci_dev_put(pdev); + if (!gen2vm) + pci_dev_put(pdev); + return -ENOMEM; } -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2, 1/2] hyperv_fb: Add screen refresh after pause/resume operation
This is necessary because after VM is pause/resumed, some portion of the screen may need refresh. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/video/hyperv_fb.c | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c index 130708f..bbcc8c0 100644 --- a/drivers/video/hyperv_fb.c +++ b/drivers/video/hyperv_fb.c @@ -218,6 +218,7 @@ struct hvfb_par { struct delayed_work dwork; bool update; + bool xrefresh; u32 pseudo_palette[16]; u8 init_buf[MAX_VMBUS_PKT_SIZE]; @@ -369,7 +370,7 @@ static void synthvid_recv_sub(struct hv_device *hdev) synthvid_send_situ(hdev); } - par-update = msg-feature_chg.is_dirt_needed; + par-xrefresh = par-update = msg-feature_chg.is_dirt_needed; if (par-update) schedule_delayed_work(par-dwork, HVFB_UPDATE_DELAY); } @@ -522,6 +523,13 @@ static void hvfb_update_work(struct work_struct *w) { struct hvfb_par *par = container_of(w, struct hvfb_par, dwork.work); struct fb_info *info = par-info; + char *argv[] = {/usr/bin/xrefresh, -display, :0.0, NULL}; + char *envp[] = {HOME=/, PATH=/sbin:/usr/sbin:/bin:/usr/bin, NULL }; + + if (par-xrefresh) { + par-xrefresh = false; + call_usermodehelper(argv[0], argv, envp, UMH_NO_WAIT); + } if (par-fb_ready) synthvid_update(info); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v3 4/4] hyperv-fb: kick off efifb early
-Original Message- From: Gerd Hoffmann [mailto:kra...@redhat.com] Sent: Monday, February 24, 2014 8:17 AM To: linux-fb...@vger.kernel.org Cc: linux-ker...@vger.kernel.org; gre...@linuxfoundation.org; KY Srinivasan; Abhishek Gupta (LIS); Haiyang Zhang; jasow...@redhat.com; tomi.valkei...@ti.com; de...@linuxdriverproject.org; Gerd Hoffmann; Jean- Christophe Plagniol-Villard Subject: [PATCH v3 4/4] hyperv-fb: kick off efifb early Remove firmware framebuffer before initializing hyperv-fb. Needed on gen2 virtual machines. Letting register_framebuffer handle the switchover results in efifb still being active while hyperv graphics are initialized, which in turn can make the linux kernel hang. Signed-off-by: Gerd Hoffmann kra...@redhat.com --- drivers/video/hyperv_fb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c index 135d8cd..a570836 100644 --- a/drivers/video/hyperv_fb.c +++ b/drivers/video/hyperv_fb.c @@ -683,6 +683,7 @@ static int hvfb_getmem(struct fb_info *info) info-apertures-ranges[0].base = pci_resource_start(pdev, 0); info-apertures-ranges[0].size = pci_resource_len(pdev, 0); } + remove_conflicting_framebuffers(info-apertures, hyperv-fb, false); Please use KBUILD_MODNAME, so that the naming is consistent. Thanks, - Haiyang info-fix.smem_start = par-mem.start; info-fix.smem_len = screen_fb_size; -- 1.8.3.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v3 3/4] hyperv-fb: add support for generation 2 virtual machines.
-Original Message- From: Gerd Hoffmann [mailto:kra...@redhat.com] Sent: Monday, February 24, 2014 8:17 AM To: linux-fb...@vger.kernel.org Cc: linux-ker...@vger.kernel.org; gre...@linuxfoundation.org; KY Srinivasan; Abhishek Gupta (LIS); Haiyang Zhang; jasow...@redhat.com; tomi.valkei...@ti.com; de...@linuxdriverproject.org; Gerd Hoffmann; Jean- Christophe Plagniol-Villard Subject: [PATCH v3 3/4] hyperv-fb: add support for generation 2 virtual machines. UEFI-based generation 2 virtual machines support vmbus devices only. There is no pci bus. Thus they use a different mechanism for the graphics framebuffer: Instead of using the vga pci bar a chunk of memory muct be allocated from the hyperv mmio region declared using APCI. This patch implements support for it. Based on a patch by Haiyang Zhang haiya...@microsoft.com Signed-off-by: Gerd Hoffmann kra...@redhat.com --- drivers/video/hyperv_fb.c | 86 +- - 1 file changed, 60 insertions(+), 26 deletions(-) diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c index 130708f..135d8cd 100644 --- a/drivers/video/hyperv_fb.c +++ b/drivers/video/hyperv_fb.c @@ -42,6 +42,7 @@ #include linux/completion.h #include linux/fb.h #include linux/pci.h +#include linux/efi.h #include linux/hyperv.h @@ -212,6 +213,7 @@ struct synthvid_msg { struct hvfb_par { struct fb_info *info; + struct resource mem; bool fb_ready; /* fb device is ready */ struct completion wait; u32 synthvid_version; @@ -460,13 +462,13 @@ static int synthvid_connect_vsp(struct hv_device *hdev) goto error; } - if (par-synthvid_version == SYNTHVID_VERSION_WIN7) { + if (par-synthvid_version == SYNTHVID_VERSION_WIN7) screen_depth = SYNTHVID_DEPTH_WIN7; - screen_fb_size = SYNTHVID_FB_SIZE_WIN7; - } else { + else screen_depth = SYNTHVID_DEPTH_WIN8; - screen_fb_size = SYNTHVID_FB_SIZE_WIN8; - } + + screen_fb_size = hdev-channel-offermsg.offer. + mmio_megabytes * 1024 * 1024; return 0; @@ -627,26 +629,46 @@ static void hvfb_get_option(struct fb_info *info) /* Get framebuffer memory from Hyper-V video pci space */ static int hvfb_getmem(struct fb_info *info) { - struct pci_dev *pdev; - ulong fb_phys; + struct hvfb_par *par = info-par; + struct pci_dev *pdev = NULL; void __iomem *fb_virt; + int gen2vm = efi_enabled(EFI_BOOT); + int ret; - pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, + par-mem.name = hyperv_fb; Please use KBUILD_MODNAME, so that the naming is consistent. Thanks, - Haiyang + par-mem.flags = IORESOURCE_MEM | IORESOURCE_BUSY; + if (gen2vm) { + ret = allocate_resource(hyperv_mmio, par-mem, + screen_fb_size, + 0, -1, + screen_fb_size, + NULL, NULL); + if (ret != 0) { + pr_err(Unable to allocate framebuffer memory\n); + return -ENODEV; + } + } else { + pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, PCI_DEVICE_ID_HYPERV_VIDEO, NULL); - if (!pdev) { - pr_err(Unable to find PCI Hyper-V video\n); - return -ENODEV; - } + if (!pdev) { + pr_err(Unable to find PCI Hyper-V video\n); + return -ENODEV; + } - if (!(pci_resource_flags(pdev, 0) IORESOURCE_MEM) || - pci_resource_len(pdev, 0) screen_fb_size) - goto err1; + if (!(pci_resource_flags(pdev, 0) IORESOURCE_MEM) || + pci_resource_len(pdev, 0) screen_fb_size) + goto err1; - fb_phys = pci_resource_end(pdev, 0) - screen_fb_size + 1; - if (!request_mem_region(fb_phys, screen_fb_size, KBUILD_MODNAME)) - goto err1; + par-mem.end = pci_resource_end(pdev, 0); + par-mem.start = par-mem.end - screen_fb_size + 1; + ret = request_resource(pdev-resource[0], par-mem); + if (ret != 0) { + pr_err(Unable to request framebuffer memory\n); + goto err1; + } + } - fb_virt = ioremap(fb_phys, screen_fb_size); + fb_virt = ioremap(par-mem.start, screen_fb_size); if (!fb_virt) goto err2; @@ -654,30 +676,42 @@ static int hvfb_getmem(struct fb_info *info) if (!info-apertures) goto err3; - info-apertures-ranges[0].base = pci_resource_start(pdev, 0); - info-apertures-ranges[0].size = pci_resource_len(pdev, 0); - info-fix.smem_start = fb_phys
RE: [PATCH v4 2/2] hyperv-fb: kick off efifb early
-Original Message- From: Gerd Hoffmann [mailto:kra...@redhat.com] Sent: Tuesday, February 25, 2014 7:29 AM To: linux-fb...@vger.kernel.org Cc: linux-ker...@vger.kernel.org; gre...@linuxfoundation.org; KY Srinivasan; Abhishek Gupta (LIS); Haiyang Zhang; jasow...@redhat.com; tomi.valkei...@ti.com; de...@linuxdriverproject.org; Gerd Hoffmann; Jean- Christophe Plagniol-Villard Subject: [PATCH v4 2/2] hyperv-fb: kick off efifb early Remove firmware framebuffer before initializing hyperv-fb. Needed on gen2 virtual machines. Letting register_framebuffer handle the switchover results in efifb still being active while hyperv graphics are initialized, which in turn can make the linux kernel hang. Signed-off-by: Gerd Hoffmann kra...@redhat.com --- drivers/video/hyperv_fb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c index b7b3dd0..1b11886 100644 --- a/drivers/video/hyperv_fb.c +++ b/drivers/video/hyperv_fb.c @@ -683,6 +683,7 @@ static int hvfb_getmem(struct fb_info *info) info-apertures-ranges[0].base = pci_resource_start(pdev, 0); info-apertures-ranges[0].size = pci_resource_len(pdev, 0); } + remove_conflicting_framebuffers(info-apertures, KBUILD_MODNAME, +false); Thanks for the updates. I'm concerned about, after removing efifb, if synthvid_send_config(hdev) fails, then there will be no video driver available. Is there a way to bring the generic driver back if synthvid_send_config(hdev) fails? If no way to recover the generic driver, please limit the early remove_conflicting_framebuffers() to Gen2 VM only. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v5 2/2] hyperv-fb: kick off efifb early
-Original Message- From: Gerd Hoffmann [mailto:kra...@redhat.com] Sent: Wednesday, February 26, 2014 5:51 AM To: linux-fb...@vger.kernel.org Cc: linux-ker...@vger.kernel.org; gre...@linuxfoundation.org; KY Srinivasan; Abhishek Gupta (LIS); Haiyang Zhang; jasow...@redhat.com; tomi.valkei...@ti.com; de...@linuxdriverproject.org; Gerd Hoffmann; Jean- Christophe Plagniol-Villard Subject: [PATCH v5 2/2] hyperv-fb: kick off efifb early Remove firmware framebuffer before initializing hyperv-fb. Needed on gen2 virtual machines. Letting register_framebuffer handle the switchover results in efifb still being active while hyperv graphics are initialized, which in turn can make the linux kernel hang. Signed-off-by: Gerd Hoffmann kra...@redhat.com Thank you! Signed-off-by: Haiyang Zhang haiya...@microsoft.com ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next] hyperv: Move state setting for link query
It moves the state setting for query into rndis_filter_receive_response(). All callbacks including query-complete and status-callback are synchronized by channel-inbound_lock. This prevents pentential race between them. Signed-off-by: Haiyang Zhang haiya...@microsoft.com --- drivers/net/hyperv/rndis_filter.c | 21 - 1 files changed, 20 insertions(+), 1 deletions(-) diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index f0cc8ef..6a9f602 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -240,6 +240,22 @@ static int rndis_filter_send_request(struct rndis_device *dev, return ret; } +static void rndis_set_link_state(struct rndis_device *rdev, +struct rndis_request *request) +{ + u32 link_status; + struct rndis_query_complete *query_complete; + + query_complete = request-response_msg.msg.query_complete; + + if (query_complete-status == RNDIS_STATUS_SUCCESS + query_complete-info_buflen == sizeof(u32)) { + memcpy(link_status, (void *)((unsigned long)query_complete + + query_complete-info_buf_offset), sizeof(u32)); + rdev-link_state = link_status != 0; + } +} + static void rndis_filter_receive_response(struct rndis_device *dev, struct rndis_message *resp) { @@ -269,6 +285,10 @@ static void rndis_filter_receive_response(struct rndis_device *dev, sizeof(struct rndis_message) + RNDIS_EXT_LEN) { memcpy(request-response_msg, resp, resp-msg_len); + if (request-request_msg.ndis_msg_type == + RNDIS_MSG_QUERY request-request_msg.msg. + query_req.oid == RNDIS_OID_GEN_MEDIA_CONNECT_STATUS) + rndis_set_link_state(dev, request); } else { netdev_err(ndev, rndis response buffer overflow @@ -617,7 +637,6 @@ static int rndis_filter_query_device_link_status(struct rndis_device *dev) ret = rndis_filter_query_device(dev, RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, link_status, size); - dev-link_state = (link_status != 0) ? true : false; return ret; } -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Move state setting for link query
-Original Message- From: Jason Wang [mailto:jasow...@redhat.com] Sent: Monday, March 3, 2014 10:10 PM To: Haiyang Zhang; da...@davemloft.net; net...@vger.kernel.org Cc: KY Srinivasan; o...@aepfle.de; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Move state setting for link query On 03/04/2014 07:54 AM, Haiyang Zhang wrote: It moves the state setting for query into rndis_filter_receive_response(). All callbacks including query-complete and status-callback are synchronized by channel-inbound_lock. This prevents pentential race between them. This still looks racy to me. The problem is workqueue is not synchronized with those here. Consider the following case in netvsc_link_change(): if (rdev-link_state) { ... receive interrupt ... rndis_filter_receice_response() which changes rdev-link_state ... netif_carrier_off() } And also it need to schedule a work otherwise the link status is out of sync. The rndis_filter_query_device_link_status() makes the query and wait for the complete message, including set state, before returning. The rndis_filter_query_device_link_status() is called from rndis_filter_device_add(), which is called from either netvsc_change_mtu() or netvsc_probe(). The change_mtu() and netvsc_link_change() are synchronized by rtnl_lock(). In netvsc_probe(), the status query complete happens before register_netdev(), and the netvsc_linkstatus_callback() schedules the work only after netdevice is registered. So, there are no race in either case. The carrier_on/off work will be scheduled when netvsc_open() is called. Then, the status will be updated based on the latest link_state. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Move state setting for link query
-Original Message- From: Jason Wang [mailto:jasow...@redhat.com] Sent: Monday, March 3, 2014 10:10 PM To: Haiyang Zhang; da...@davemloft.net; net...@vger.kernel.org Cc: KY Srinivasan; o...@aepfle.de; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Move state setting for link query On 03/04/2014 07:54 AM, Haiyang Zhang wrote: It moves the state setting for query into rndis_filter_receive_response(). All callbacks including query-complete and status-callback are synchronized by channel-inbound_lock. This prevents pentential race between them. This still looks racy to me. The problem is workqueue is not synchronized with those here. Consider the following case in netvsc_link_change(): if (rdev-link_state) { ... receive interrupt ... rndis_filter_receice_response() which changes rdev-link_state ... netif_carrier_off() } And also it need to schedule a work otherwise the link status is out of sync. I will update this patch to schedule a work by the end of probe function. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next,v2] hyperv: Move state setting for link query
It moves the state setting for query into rndis_filter_receive_response(). All callbacks including query-complete and status-callback are synchronized by channel-inbound_lock. This prevents pentential race between them. Signed-off-by: Haiyang Zhang haiya...@microsoft.com --- drivers/net/hyperv/netvsc_drv.c |4 drivers/net/hyperv/rndis_filter.c | 21 - 2 files changed, 24 insertions(+), 1 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 9ef6be9..bb27b3e 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -442,6 +442,8 @@ static int netvsc_probe(struct hv_device *dev, if (!net) return -ENOMEM; + netif_carrier_off(net); + net_device_ctx = netdev_priv(net); net_device_ctx-device_ctx = dev; hv_set_drvdata(dev, net); @@ -473,6 +475,8 @@ static int netvsc_probe(struct hv_device *dev, pr_err(Unable to register netdev.\n); rndis_filter_device_remove(dev); free_netdev(net); + } else { + schedule_delayed_work(net_device_ctx-dwork, 0); } return ret; diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index f0cc8ef..6a9f602 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -240,6 +240,22 @@ static int rndis_filter_send_request(struct rndis_device *dev, return ret; } +static void rndis_set_link_state(struct rndis_device *rdev, +struct rndis_request *request) +{ + u32 link_status; + struct rndis_query_complete *query_complete; + + query_complete = request-response_msg.msg.query_complete; + + if (query_complete-status == RNDIS_STATUS_SUCCESS + query_complete-info_buflen == sizeof(u32)) { + memcpy(link_status, (void *)((unsigned long)query_complete + + query_complete-info_buf_offset), sizeof(u32)); + rdev-link_state = link_status != 0; + } +} + static void rndis_filter_receive_response(struct rndis_device *dev, struct rndis_message *resp) { @@ -269,6 +285,10 @@ static void rndis_filter_receive_response(struct rndis_device *dev, sizeof(struct rndis_message) + RNDIS_EXT_LEN) { memcpy(request-response_msg, resp, resp-msg_len); + if (request-request_msg.ndis_msg_type == + RNDIS_MSG_QUERY request-request_msg.msg. + query_req.oid == RNDIS_OID_GEN_MEDIA_CONNECT_STATUS) + rndis_set_link_state(dev, request); } else { netdev_err(ndev, rndis response buffer overflow @@ -617,7 +637,6 @@ static int rndis_filter_query_device_link_status(struct rndis_device *dev) ret = rndis_filter_query_device(dev, RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, link_status, size); - dev-link_state = (link_status != 0) ? true : false; return ret; } -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Move state setting for link query
-Original Message- From: Jason Wang [mailto:jasow...@redhat.com] Sent: Wednesday, March 5, 2014 12:57 AM To: Haiyang Zhang; da...@davemloft.net; net...@vger.kernel.org Cc: KY Srinivasan; o...@aepfle.de; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Move state setting for link query On 03/05/2014 12:57 AM, Haiyang Zhang wrote: -Original Message- From: Jason Wang [mailto:jasow...@redhat.com] Sent: Monday, March 3, 2014 10:10 PM To: Haiyang Zhang; da...@davemloft.net; net...@vger.kernel.org Cc: KY Srinivasan; o...@aepfle.de; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next] hyperv: Move state setting for link query On 03/04/2014 07:54 AM, Haiyang Zhang wrote: It moves the state setting for query into rndis_filter_receive_response(). All callbacks including query-complete and status-callback are synchronized by channel-inbound_lock. This prevents pentential race between them. This still looks racy to me. The problem is workqueue is not synchronized with those here. Consider the following case in netvsc_link_change(): if (rdev-link_state) { ... receive interrupt ... rndis_filter_receice_response() which changes rdev-link_state ... netif_carrier_off() } And also it need to schedule a work otherwise the link status is out of sync. The rndis_filter_query_device_link_status() makes the query and wait for the complete message, including set state, before returning. The rndis_filter_query_device_link_status() is called from rndis_filter_device_add(), which is called from either netvsc_change_mtu() or netvsc_probe(). The change_mtu() and netvsc_link_change() are synchronized by rtnl_lock(). In netvsc_probe(), the status query complete happens before register_netdev(), and the netvsc_linkstatus_callback() schedules the work only after netdevice is registered. So, there are no race in either case. The carrier_on/off work will be scheduled when netvsc_open() is called. Then, the status will be updated based on the latest link_state. Thanks, - Haiyang I see. Then if the link status is changing during mtu changing in guest. Looks like we may miss a link status updating? When changing mtu, rndis_filter_device_add() is called, and host will send a link status call back immediately after connect-to-netvsp, no matter the link is changing or not. This will schedule a work to update the status. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: conflict of hyperv_fb and the generic video driver?
-Original Message- From: David Herrmann [mailto:dh.herrm...@gmail.com] Sent: Friday, August 16, 2013 3:11 PM To: Haiyang Zhang Cc: linux-fb...@vger.kernel.org; driverdev-devel@linuxdriverproject.org; Tomi Valkeinen; Jean-Christophe Plagniol-Villard; akpm@linux- foundation.org; KY Srinivasan Subject: Re: conflict of hyperv_fb and the generic video driver? Hi (hint: your mail header seems to drop Reference-to/Reply-to headers and breaks thread-info) On Fri, Aug 16, 2013 at 8:45 PM, Haiyang Zhang haiya...@microsoft.com wrote: -Original Message- From: David Herrmann [mailto:dh.herrm...@gmail.com] Sent: Friday, August 16, 2013 9:46 AM To: Haiyang Zhang Cc: linux-fb...@vger.kernel.org; driverdev-devel@linuxdriverproject.org; Tomi Valkeinen; Jean-Christophe Plagniol-Villard; akpm@linux- foundation.org; KY Srinivasan Subject: Re: source code file for the generic vga driver? Hi On Mon, Aug 5, 2013 at 9:12 PM, Haiyang Zhang haiya...@microsoft.com wrote: Hi folks, I'm working on an issue of HyperV synthetic frame buffer driver, which seems to have a conflict with the generic vga driver (not the vesa driver). I hope to read and trace into the source code for the generic vga driver... Can anyone point me to the source code file for the generic vga driver in the kernel tree? Everything lives in ./drivers/video/. The drivers you're probably interested in are vesafb.c or vga16fb.c. There is also the vgacon driver in ./drivers/video/console/vgacon.c. I am not sure which one you are talking about. You might also want to have a look at the x86 sysfb infrastructure which isn't merged, yet: http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/log/?h=x86/fb It provides proper platform-devices so drivers no longer conflict on the vga/vesa/efi.. framebuffer resources. It's x86 only as all the relevant drivers only work on x86. If you give some more information on what you are trying to do, I can point you to the relevant resources. My guess is that you want to have a look at remove_conflicting_framebuffers() in ./drivers/video/fbmem.c. Thank you for the detailed reply! I'm looking at a problem of Hyper-V synthetic fb driver (hyperv_fb) which seems to have conflict with some kind of generic video driver. I'm not sure which driver is this. On Suse, the vesafb is removed automatically by remove_conflicting_framebuffers() when hyperv_fb is loaded. We don't have any problem here. On some other Distros, like RHEL, CentOS, Ubuntu, the generic driver seems not to be vesafb -- I can't see any /dev/fb* there. And, the generic video driver seems not be removed when hyperv_fb is loaded. This generic video driver is not vesafb or vga16fb or vgacon, because it supports x-window GUI, and it's still here after I un- configured vesafb and vga16fb. Could point out what is the generic video driver used by RHEL, Ubuntu by default? And, how to let it exit automatically when our FB driver (hyperv_fb) is loaded? I have no idea what RHEL or Ubuntu use, sorry. But your description sounds odd. The kernel has 3 different places that could use VGA resources: - fbdev drivers (/dev/fbX or /sys/class/graphics) - DRM drivers (/dev/dri/cardX or /sys/class/drm) - vgacon Could you check whether these directories are empty? (/sys/class/graphics/ and /sys/class/drm/ on a running machine) If these are empty, this doesn't look like a kernel thing. Are you sure it's a kernel driver that accesses your VGA resources? The xserver used to have some pretty huge vga/vesa/.. user-space drivers. Could you tell me whether the linux-console actually works? That is, do you get some console output if xserver is not running? To find out the default driver, I manually removed my hyperv_fb driver. The vesafb is unconfigured: # CONFIG_FB_BOOT_VESA_SUPPORT is not set # CONFIG_FB_UVESA is not set # CONFIG_FB_VESA is not set But I saw VESA VBE in the x log. Seems it's the default driver: /var/log/Xorg.0.log: [12.340] (II) VESA(0): Primary V_BIOS segment is: 0xc000 [12.341] (II) VESA(0): VESA BIOS detected [12.341] (II) VESA(0): VESA VBE Version 2.0 [12.341] (II) VESA(0): VESA VBE Total Mem: 4096 kB [12.341] (II) VESA(0): VESA VBE OEM: IBM SVGA BIOS, (C) 1993 International Business Machines [12.341] (II) VESA(0): VESA VBE OEM Software Rev: 0.0 [12.365] (II) VESA(0): Creating default Display subsection in Screen section Default Screen Section for depth/fbbpp 24/32 [12.365] (==) VESA(0): Depth 24, (--) framebuffer bpp 32 [12.365] (==) VESA(0): RGB weight 888 [12.365] (==) VESA(0): Default visual is TrueColor [12.365] (==) VESA(0): Using gamma correction (1.0, 1.0, 1.0) There is no /dev/fb*, /dev/dri/, /sys/class/drm I see /sys/class/graphics/fbcon is here. But console output is not working. Seems that the VESA VBE is causing
RE: conflict of hyperv_fb and the generic video driver?
-Original Message- From: David Herrmann [mailto:dh.herrm...@gmail.com] Sent: Friday, August 16, 2013 4:40 PM To: Haiyang Zhang Cc: linux-fb...@vger.kernel.org; driverdev-devel@linuxdriverproject.org; Tomi Valkeinen; Jean-Christophe Plagniol-Villard; akpm@linux- foundation.org; KY Srinivasan Subject: Re: conflict of hyperv_fb and the generic video driver? Hi On Fri, Aug 16, 2013 at 10:27 PM, Haiyang Zhang haiya...@microsoft.com wrote: -Original Message- From: David Herrmann [mailto:dh.herrm...@gmail.com] Sent: Friday, August 16, 2013 3:11 PM To: Haiyang Zhang Cc: linux-fb...@vger.kernel.org; driverdev-devel@linuxdriverproject.org; Tomi Valkeinen; Jean-Christophe Plagniol-Villard; akpm@linux- foundation.org; KY Srinivasan Subject: Re: conflict of hyperv_fb and the generic video driver? Hi (hint: your mail header seems to drop Reference-to/Reply-to headers and breaks thread-info) On Fri, Aug 16, 2013 at 8:45 PM, Haiyang Zhang haiya...@microsoft.com wrote: -Original Message- From: David Herrmann [mailto:dh.herrm...@gmail.com] Sent: Friday, August 16, 2013 9:46 AM To: Haiyang Zhang Cc: linux-fb...@vger.kernel.org; driverdev-devel@linuxdriverproject.org; Tomi Valkeinen; Jean-Christophe Plagniol-Villard; akpm@linux- foundation.org; KY Srinivasan Subject: Re: source code file for the generic vga driver? Hi On Mon, Aug 5, 2013 at 9:12 PM, Haiyang Zhang haiya...@microsoft.com wrote: Hi folks, I'm working on an issue of HyperV synthetic frame buffer driver, which seems to have a conflict with the generic vga driver (not the vesa driver). I hope to read and trace into the source code for the generic vga driver... Can anyone point me to the source code file for the generic vga driver in the kernel tree? Everything lives in ./drivers/video/. The drivers you're probably interested in are vesafb.c or vga16fb.c. There is also the vgacon driver in ./drivers/video/console/vgacon.c. I am not sure which one you are talking about. You might also want to have a look at the x86 sysfb infrastructure which isn't merged, yet: http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/log/?h=x86 /fb It provides proper platform-devices so drivers no longer conflict on the vga/vesa/efi.. framebuffer resources. It's x86 only as all the relevant drivers only work on x86. If you give some more information on what you are trying to do, I can point you to the relevant resources. My guess is that you want to have a look at remove_conflicting_framebuffers() in ./drivers/video/fbmem.c. Thank you for the detailed reply! I'm looking at a problem of Hyper-V synthetic fb driver (hyperv_fb) which seems to have conflict with some kind of generic video driver. I'm not sure which driver is this. On Suse, the vesafb is removed automatically by remove_conflicting_framebuffers() when hyperv_fb is loaded. We don't have any problem here. On some other Distros, like RHEL, CentOS, Ubuntu, the generic driver seems not to be vesafb -- I can't see any /dev/fb* there. And, the generic video driver seems not be removed when hyperv_fb is loaded. This generic video driver is not vesafb or vga16fb or vgacon, because it supports x-window GUI, and it's still here after I un- configured vesafb and vga16fb. Could point out what is the generic video driver used by RHEL, Ubuntu by default? And, how to let it exit automatically when our FB driver (hyperv_fb) is loaded? I have no idea what RHEL or Ubuntu use, sorry. But your description sounds odd. The kernel has 3 different places that could use VGA resources: - fbdev drivers (/dev/fbX or /sys/class/graphics) - DRM drivers (/dev/dri/cardX or /sys/class/drm) - vgacon Could you check whether these directories are empty? (/sys/class/graphics/ and /sys/class/drm/ on a running machine) If these are empty, this doesn't look like a kernel thing. Are you sure it's a kernel driver that accesses your VGA resources? The xserver used to have some pretty huge vga/vesa/.. user-space drivers. Could you tell me whether the linux-console actually works? That is, do you get some console output if xserver is not running? To find out the default driver, I manually removed my hyperv_fb driver. The vesafb is unconfigured: # CONFIG_FB_BOOT_VESA_SUPPORT is not set # CONFIG_FB_UVESA is not set # CONFIG_FB_VESA is not set But I saw VESA VBE in the x log. Seems it's the default driver: /var/log/Xorg.0.log: [12.340] (II) VESA(0): Primary V_BIOS segment is: 0xc000 [12.341] (II) VESA(0): VESA BIOS detected [12.341] (II) VESA(0): VESA VBE Version 2.0 [12.341] (II) VESA(0): VESA VBE Total Mem: 4096 kB [12.341] (II) VESA(0): VESA VBE OEM
RE: [PATCH 1/2] hyperv-fb: add pci stub
-Original Message- From: linux-fbdev-ow...@vger.kernel.org [mailto:linux-fbdev- ow...@vger.kernel.org] On Behalf Of Gerd Hoffmann Sent: Wednesday, October 2, 2013 7:55 AM Cc: Gerd Hoffmann; KY Srinivasan; Haiyang Zhang; Jean-Christophe Plagniol- Villard; Tomi Valkeinen; open list:Hyper-V CORE AND...; open list:FRAMEBUFFER LAYER; open list Subject: [PATCH 1/2] hyperv-fb: add pci stub This patch adds a pci stub driver to hyper-fb. The hyperv framebuffer driver will bind to the pci device then, so linux kernel and userspace know there is a proper kernel driver for the device active. lspci shows this for example: [root@dhcp231 ~]# lspci -vs8 00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA (prog-if 00 [VGA controller]) Flags: bus master, fast devsel, latency 0, IRQ 11 Memory at f800 (32-bit, non-prefetchable) [size=64M] Expansion ROM at unassigned [disabled] Kernel driver in use: hyperv_fb Another effect is that the xorg vesa driver will not attach to the device and thus the Xorg server will automatically use the fbdev driver instead. Signed-off-by: Gerd Hoffmann kra...@redhat.com Acked-by: Haiyang Zhang haiya...@microsoft.com Thank you for fixing this! - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 2/2] hyperv-fb: add blanking support
-Original Message- From: linux-fbdev-ow...@vger.kernel.org [mailto:linux-fbdev- ow...@vger.kernel.org] On Behalf Of Gerd Hoffmann Sent: Wednesday, October 2, 2013 7:55 AM Cc: Gerd Hoffmann; KY Srinivasan; Haiyang Zhang; Jean-Christophe Plagniol- Villard; Tomi Valkeinen; open list:Hyper-V CORE AND...; open list:FRAMEBUFFER LAYER; open list Subject: [PATCH 2/2] hyperv-fb: add blanking support Signed-off-by: Gerd Hoffmann kra...@redhat.com Acked-by: Haiyang Zhang haiya...@microsoft.com ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event
The RNDIS_STATUS_NETWORK_CHANGE event is received after the Hyper-V host sleep or hibernation. We refresh network at this time. MS-TFS: 135162 Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h |3 ++- drivers/net/hyperv/netvsc_drv.c | 30 ++ drivers/net/hyperv/rndis_filter.c | 21 + include/linux/rndis.h |1 + 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 6cc37c1..24441ae 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -170,6 +170,7 @@ struct rndis_device { enum rndis_device_state state; bool link_state; + bool link_change; atomic_t new_req_id; spinlock_t request_lock; @@ -185,7 +186,7 @@ int netvsc_device_remove(struct hv_device *device); int netvsc_send(struct hv_device *device, struct hv_netvsc_packet *packet); void netvsc_linkstatus_callback(struct hv_device *device_obj, - unsigned int status); + struct rndis_message *resp); int netvsc_recv_callback(struct hv_device *device_obj, struct hv_netvsc_packet *packet, struct ndis_tcp_ip_checksum_info *csum_info); diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 4fd71b7..9b27ca8 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -579,8 +579,9 @@ drop: * netvsc_linkstatus_callback - Link up/down notification */ void netvsc_linkstatus_callback(struct hv_device *device_obj, - unsigned int status) + struct rndis_message *resp) { + struct rndis_indicate_status *indicate = resp-msg.indicate_status; struct net_device *net; struct net_device_context *ndev_ctx; struct netvsc_device *net_device; @@ -589,7 +590,19 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, net_device = hv_get_drvdata(device_obj); rdev = net_device-extension; - rdev-link_state = status != 1; + switch (indicate-status) { + case RNDIS_STATUS_MEDIA_CONNECT: + rdev-link_state = false; + break; + case RNDIS_STATUS_MEDIA_DISCONNECT: + rdev-link_state = true; + break; + case RNDIS_STATUS_NETWORK_CHANGE: + rdev-link_change = true; + break; + default: + return; + } net = net_device-ndev; @@ -597,7 +610,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, return; ndev_ctx = netdev_priv(net); - if (status == 1) { + if (!rdev-link_state) { schedule_delayed_work(ndev_ctx-dwork, 0); schedule_delayed_work(ndev_ctx-dwork, msecs_to_jiffies(20)); } else { @@ -767,7 +780,9 @@ static void netvsc_link_change(struct work_struct *w) struct net_device *net; struct netvsc_device *net_device; struct rndis_device *rdev; - bool notify; + bool notify, refresh = false; + char *argv[] = { /etc/init.d/network, restart, NULL }; + char *envp[] = { HOME=/, PATH=/sbin:/usr/sbin:/bin:/usr/bin, NULL }; rtnl_lock(); @@ -782,10 +797,17 @@ static void netvsc_link_change(struct work_struct *w) } else { netif_carrier_on(net); notify = true; + if (rdev-link_change) { + rdev-link_change = false; + refresh = true; + } } rtnl_unlock(); + if (refresh) + call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); + if (notify) netdev_notify_peers(net); } diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 99c527a..2b86f0b 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -320,25 +320,6 @@ static void rndis_filter_receive_response(struct rndis_device *dev, } } -static void rndis_filter_receive_indicate_status(struct rndis_device *dev, -struct rndis_message *resp) -{ - struct rndis_indicate_status *indicate = - resp-msg.indicate_status; - - if (indicate-status == RNDIS_STATUS_MEDIA_CONNECT) { - netvsc_linkstatus_callback( - dev-net_dev-dev, 1); - } else if (indicate-status == RNDIS_STATUS_MEDIA_DISCONNECT) { - netvsc_linkstatus_callback( - dev-net_dev-dev, 0); - } else { - /* -* TODO: -*/ - } -} - /* * Get the Per
RE: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event
-Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Friday, June 20, 2014 1:12 AM To: Olaf Hering Cc: Haiyang Zhang; net...@vger.kernel.org; jasow...@redhat.com; driverdev-devel@linuxdriverproject.org; linux-ker...@vger.kernel.org; da...@davemloft.net Subject: Re: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event On Fri, Jun 20, 2014 at 06:57:04AM +0200, Olaf Hering wrote: On Thu, Jun 19, Haiyang Zhang wrote: The RNDIS_STATUS_NETWORK_CHANGE event is received after the Hyper-V host sleep or hibernation. We refresh network at this time. + char *argv[] = { /etc/init.d/network, restart, NULL }; What happens if that file does not exist? Dead network in the guest? I tend to think if a VM with PV drivers goes to sleep it has to go through the whole suspend/resume cycle, very much like the LID closed event. So I think this and the other fbdev change that is floating around is wrong. Ah, and what about systems with no /etc/init.d/ at all (like systemd-based ones)? You can't have a kernel driver ask userspace to restart all networking connections, that seems really wrong. Olaf and Greg, Thanks for your reviews. On Server Hyper-V, the host sleep/hibernation is not supported. So this event won't happen on most deployment of Hyper-V. On Client Hyper-V (e.g. Windows 8+ on a laptop), the host sleep/hibernation is supported. If the laptop is moved to another network during sleep, we previously need to manually refresh the network (network restart) to renew DHCP. With this patch, the network is refreshed on the event. This command (/etc/init.d/network restart) exists on our supported distros currently. We will also look into some better ways to refresh the network for the distros without this command. I have tried setting IF_OPER_DORMANT then IF_OPER_UP, but not working. I will look into the suspend/resume cycle as well. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event
-Original Message- From: Dan Carpenter [mailto:dan.carpen...@oracle.com] Sent: Friday, June 20, 2014 4:42 AM To: Haiyang Zhang Cc: da...@davemloft.net; net...@vger.kernel.org; o...@aepfle.de; jasow...@redhat.com; driverdev-devel@linuxdriverproject.org; linux- ker...@vger.kernel.org Subject: Re: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event On Thu, Jun 19, 2014 at 06:34:36PM -0700, Haiyang Zhang wrote: @@ -589,7 +590,19 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, net_device = hv_get_drvdata(device_obj); rdev = net_device-extension; - rdev-link_state = status != 1; + switch (indicate-status) { + case RNDIS_STATUS_MEDIA_CONNECT: + rdev-link_state = false; link_state false means that we want to connect? Yes + break; + case RNDIS_STATUS_MEDIA_DISCONNECT: + rdev-link_state = true; link_state true means that we are disconnecting. Yes. @@ -782,10 +797,17 @@ static void netvsc_link_change(struct work_struct *w) } else { netif_carrier_on(net); notify = true; + if (rdev-link_change) { + rdev-link_change = false; + refresh = true; + } How do we know that we received a RNDIS_STATUS_MEDIA_CONNECT before we received the RNDIS_STATUS_NETWORK_CHANGE? In other words, why does RNDIS_STATUS_NETWORK_CHANGE imply that the link_state is false? After host sleep, both RNDIS_STATUS_MEDIA_CONNECT and RNDIS_STATUS_NETWORK_CHANGE events are received, but not necessarily in this order. If RNDIS_STATUS_MEDIA_CONNECT arrives later, the flag saved in rdev-link_change previously will trigger the refresh, not in the RNDIS_STATUS_NETWORK_CHANGE event, but in the latter RNDIS_STATUS_MEDIA_CONNECT event. } rtnl_unlock(); + if (refresh) + call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); You may as well use UMH_NO_WAIT since there is no error handling if /etc/init.d/network is not found. I previously tried UMH_NO_WAIT, but not working. We need to wait for the exec (not process completion) in this case. Since it's in the work queue, a bit of waiting is OK. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event
-Original Message- From: Olaf Hering [mailto:o...@aepfle.de] Sent: Monday, June 23, 2014 9:17 AM To: Haiyang Zhang Cc: Greg KH; net...@vger.kernel.org; jasow...@redhat.com; driverdev- de...@linuxdriverproject.org; linux-ker...@vger.kernel.org; da...@davemloft.net Subject: Re: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event On Mon, Jun 23, Haiyang Zhang wrote: I think its reasonable to expect guest config changes on this new kind of host. Would a link-down/link-up event work? I'm sure it will, there is enough code floating around in the guests which handles cable unplug. Do you mean netif_carrier_off() / netif_carrier_on()? They are already called in the code before this patch, but DHCP renew is not triggered by them. I do not know how to simulate a cable unplug. The point is that calling /etc/init.d/network will fail, at least in SLES12. Maybe some sort of DHCP refresh required event is required? Maybe the DHCP clients need to renew on cable unplug? No idea what the solution to the issue really is. Yes, it will be great if there is such a DHCP refresh required event, or DHCP clients are triggered when netif_carrier_off() then netif_carrier_on(). I have tried some possibilities, like IF_OPER_DORMANT then IF_OPER_UP with netdev_state_change() etc. but not able to trigger DHCP review. I will look at this further... So, what's the equivalent or similar command to network restart on SLES12? Could you update the command line for the usermodehelper when porting this patch to SLES 12? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event
-Original Message- From: Olaf Hering [mailto:o...@aepfle.de] Sent: Monday, June 23, 2014 12:27 PM To: Haiyang Zhang Cc: Greg KH; net...@vger.kernel.org; jasow...@redhat.com; driverdev- de...@linuxdriverproject.org; linux-ker...@vger.kernel.org; da...@davemloft.net Subject: Re: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event On Mon, Jun 23, Haiyang Zhang wrote: I have tried some possibilities, like IF_OPER_DORMANT then IF_OPER_UP with netdev_state_change() etc. but not able to trigger DHCP review. I will look at this further... Is there a link down/up event anyway? If the interface is configured to on hotplug or on cable plugged in or whatever the setting name is, the network scripts should do something. Even if its not a DHCP renew. Yes, there is a link down/up event from the host, we currently call netif_carrier_off() / netif_carrier_on() with these events. Will hotplug scripts be triggered by netif_carrier_off/on? Where are the scripts located at (SLES)? So, what's the equivalent or similar command to network restart on SLES12? Could you update the command line for the usermodehelper when porting this patch to SLES 12? I see a /sbin/rcnetwork in SLES, which links either to '/etc/init.d/network' or 'service'. This could be used as a quick workaround. Thanks for the info! Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event
-Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Monday, June 23, 2014 12:29 PM To: Haiyang Zhang Cc: Olaf Hering; net...@vger.kernel.org; jasow...@redhat.com; driverdev- de...@linuxdriverproject.org; linux-ker...@vger.kernel.org; da...@davemloft.net Subject: Re: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event On Mon, Jun 23, 2014 at 04:09:59PM +, Haiyang Zhang wrote: -Original Message- From: Olaf Hering [mailto:o...@aepfle.de] Sent: Monday, June 23, 2014 9:17 AM To: Haiyang Zhang Cc: Greg KH; net...@vger.kernel.org; jasow...@redhat.com; driverdev- de...@linuxdriverproject.org; linux-ker...@vger.kernel.org; da...@davemloft.net Subject: Re: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event On Mon, Jun 23, Haiyang Zhang wrote: I think its reasonable to expect guest config changes on this new kind of host. Would a link-down/link-up event work? I'm sure it will, there is enough code floating around in the guests which handles cable unplug. Do you mean netif_carrier_off() / netif_carrier_on()? They are already called in the code before this patch, but DHCP renew is not triggered by them. I do not know how to simulate a cable unplug. The point is that calling /etc/init.d/network will fail, at least in SLES12. Maybe some sort of DHCP refresh required event is required? Maybe the DHCP clients need to renew on cable unplug? No idea what the solution to the issue really is. Yes, it will be great if there is such a DHCP refresh required event, or DHCP clients are triggered when netif_carrier_off() then netif_carrier_on(). I have tried some possibilities, like IF_OPER_DORMANT then IF_OPER_UP with netdev_state_change() etc. but not able to trigger DHCP review. I will look at this further... So, what's the equivalent or similar command to network restart on SLES12? Could you update the command line for the usermodehelper when porting this patch to SLES 12? Given that this change will fail on all future distro releases, and almost all of the community distros today, I don't see how this is acceptable at all. Nor would it be any better if you switch to a systemd command line script as well. You should just work like any other network device works in this situation when it comes to enabling/disabling the device. Worse case, just tear down the whole network device at suspend time, and recreate it at resume. I will look into these options. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Monday, June 23, 2014 4:10 PM To: Haiyang Zhang Cc: o...@aepfle.de; g...@kroah.com; net...@vger.kernel.org; jasow...@redhat.com; driverdev-devel@linuxdriverproject.org; linux- ker...@vger.kernel.org Subject: Re: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event From: Haiyang Zhang haiya...@microsoft.com Date: Mon, 23 Jun 2014 16:09:59 + So, what's the equivalent or similar command to network restart on SLES12? Could you update the command line for the usermodehelper when porting this patch to SLES 12? No, you are not going to keep the usermodehelper invocation in your driver please remove it. It is absolutely inappropriate, and I strictly do not want to keep it in there because other people will copy it and then we'll have a real mess on our hands. I'm working on it, and will have a patch to replace the usermodehelper soon. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event
-Original Message- From: Olaf Hering [mailto:o...@aepfle.de] Sent: Thursday, June 26, 2014 4:46 AM To: Haiyang Zhang Cc: Greg KH; net...@vger.kernel.org; jasow...@redhat.com; driverdev- de...@linuxdriverproject.org; linux-ker...@vger.kernel.org; da...@davemloft.net Subject: Re: [PATCH net-next] hyperv: Add handler for RNDIS_STATUS_NETWORK_CHANGE event On Mon, Jun 23, Haiyang Zhang wrote: Yes, there is a link down/up event from the host, we currently call netif_carrier_off() / netif_carrier_on() with these events. Will hotplug scripts be triggered by netif_carrier_off/on? Where are the scripts located at (SLES)? In /etc/sysconfig/network/ifcfg-eth0 STARTMODE= should be set to ifplugd, this will most likely fix this sort of setup. Thanks for the info! I'll let our team know. - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 1/1] drivers/net/hyperv/netvsc.c: remove unnecessary null test before kfree
-Original Message- From: Fabian Frederick [mailto:f...@skynet.be] Sent: Saturday, June 28, 2014 6:37 AM To: linux-ker...@vger.kernel.org Cc: Fabian Frederick; KY Srinivasan; Haiyang Zhang; de...@linuxdriverproject.org Subject: [PATCH 1/1] drivers/net/hyperv/netvsc.c: remove unnecessary null test before kfree Fix checkpatch warning: WARNING: kfree(NULL) is safe this check is probably not required Cc: K. Y. Srinivasan k...@microsoft.com Cc: Haiyang Zhang haiya...@microsoft.com Cc: de...@linuxdriverproject.org Signed-off-by: Fabian Frederick f...@skynet.be Reviewed-by: Haiyang Zhang haiya...@microsoft.com Also, please add net...@vger.kernel.org to the recipients. Thanks. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2
-Original Message- From: Sitsofe Wheeler [mailto:sits...@gmail.com] Sent: Sunday, July 6, 2014 4:18 PM To: Haiyang Zhang Cc: KY Srinivasan; David S. Miller; de...@linuxdriverproject.org; linux- ker...@vger.kernel.org; net...@vger.kernel.org Subject: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2 With the 3.14 kernel Hyper-V no longer reliably enables its networking devices in time on cloud images leading to network devices permanently remaining offline. After a painful round of bisection I've narrowed this down to commit b679ef73edc251f6d200a7dd2396e9fef9e36fc3 : # bad: [455c6fdbd219161bd09b1165f11699d6d73de11c] Linux 3.14 # good: [d8ec26d7f8287f5788a494f56e8814210f0e64be] Linux 3.13 git bisect start 'v3.14' 'v3.13' # good: [82c477669a4665eb4e52030792051e0559ee2a36] Merge branch 'perf- urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip git bisect good 82c477669a4665eb4e52030792051e0559ee2a36 # bad: [ca2a650f3dfdc30d71d21bcbb04d2d057779f3f9] Merge branch 'for- linus' of git://git.infradead.org/users/vkoul/slave-dma git bisect bad ca2a650f3dfdc30d71d21bcbb04d2d057779f3f9 # bad: [205e2210daa975d92ace485a65a31ccc4077fe1a] iwlwifi: disable TX AMPDU by default for iwldvm git bisect bad 205e2210daa975d92ace485a65a31ccc4077fe1a # bad: [09db30805300e9ed5ad43d4d339115cf1d9c84e1] dccp: re-enable debug macro git bisect bad 09db30805300e9ed5ad43d4d339115cf1d9c84e1 # bad: [d9120198ddef2c0b61ca6659ace41b7c1e7c8f08] clk: shmobile: rcar- gen2: Use kick bit to allow Z clock frequency change git bisect bad d9120198ddef2c0b61ca6659ace41b7c1e7c8f08 # bad: [1b07da516ee25250f458c76c012ebe4cd677a84f] hyperv: Move state setting for link query git bisect bad 1b07da516ee25250f458c76c012ebe4cd677a84f # bad: [53611c0ce9f6e2fa2e31f9ab4ad8c08c512085ba] Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net git bisect bad 53611c0ce9f6e2fa2e31f9ab4ad8c08c512085ba # bad: [a34fe10750ebe524a39f97bd78ab4d232a554edb] parisc: locks: remove redundant arch_*_relax operations git bisect bad a34fe10750ebe524a39f97bd78ab4d232a554edb # bad: [004e5cf743086990e5fc04a14437b3966d7fa9a2] Merge branch 'exynos- drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-fixes git bisect bad 004e5cf743086990e5fc04a14437b3966d7fa9a2 # bad: [a4ecdf82f8ea49f7d3a072121dcbd0bf3a7cb93a] Merge branch 'x86- urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip git bisect bad a4ecdf82f8ea49f7d3a072121dcbd0bf3a7cb93a # bad: [c60f7d5a8e7c639de5d9dfe07e1e91d302d506e4] Merge branch 'drm- fixes' of git://people.freedesktop.org/~airlied/linux git bisect bad c60f7d5a8e7c639de5d9dfe07e1e91d302d506e4 # bad: [bf21d605bf7d18d2b3cdb1c19fc1b2a1549c1f11] Merge branch 'drm- fixes-3.14' of git://people.freedesktop.org/~agd5f/linux into drm-fixes git bisect bad bf21d605bf7d18d2b3cdb1c19fc1b2a1549c1f11 # bad: [07ae78c9798b79bad3d3adf983c94ba23fde54d4] drm/radeon/cik: stop the sdma engines in the enable() function git bisect bad 07ae78c9798b79bad3d3adf983c94ba23fde54d4 # bad: [7848865914c6a63ead674f0f5604b77df7d3874f] drm/radeon: fix runpm disabling on non-PX harder git bisect bad 7848865914c6a63ead674f0f5604b77df7d3874f # bad: [e9e352e9100b98aed1a5fb9e33355c29fb07d5b1] Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform git bisect bad e9e352e9100b98aed1a5fb9e33355c29fb07d5b1 # good: [6e1f586d31ad49063da391db12632b31c7b00d76] qlcnic: Fix SR-IOV cleanup code path git bisect good 6e1f586d31ad49063da391db12632b31c7b00d76 # good: [562e74fefc36eb57286455c68a60f2776659a7e1] Merge tag 'cris-for- 3.14' of git://jni.nu/cris git bisect good 562e74fefc36eb57286455c68a60f2776659a7e1 # good: [f1499382f114231cbd1e3dee7e656b50ce9d8236] Merge tag 'xfs-for- linus-v3.14-rc1-2' of git://oss.sgi.com/xfs/xfs git bisect good f1499382f114231cbd1e3dee7e656b50ce9d8236 # good: [0e47c969c65e213421450c31043353ebe3c67e0c] Merge tag 'for-linus- 20140127' of git://git.infradead.org/linux-mtd git bisect good 0e47c969c65e213421450c31043353ebe3c67e0c # bad: [30c867eebfbd1c25310aec9f152578deaf793080] Merge tag 'blackfin- for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/realmz6/blackfin- linux git bisect bad 30c867eebfbd1c25310aec9f152578deaf793080 # bad: [c044dc2132d19d8c643cdd340f21afcec177c046] qeth: fix build of s390 allmodconfig git bisect bad c044dc2132d19d8c643cdd340f21afcec177c046 # bad: [d922e1cb1ea17ac7f0a5c3c2be98d4bd80d055b8] net: Document promote_secondaries git bisect bad d922e1cb1ea17ac7f0a5c3c2be98d4bd80d055b8 # good: [f2ebd477f141bc09b10fb8deb612a4d9b8999bba] bonding: restructure locking of bond_ab_arp_probe() git bisect good f2ebd477f141bc09b10fb8deb612a4d9b8999bba # bad: [b679ef73edc251f6d200a7dd2396e9fef9e36fc3] hyperv: Add support for physically discontinuous receive buffer git bisect bad
RE: [PATCH] hyperv: Add netpoll support
-Original Message- From: Richard Weinberger [mailto:rich...@nod.at] Sent: Tuesday, July 8, 2014 5:32 AM To: KY Srinivasan; Haiyang Zhang Cc: de...@linuxdriverproject.org; net...@vger.kernel.org; linux- ker...@vger.kernel.org; Richard Weinberger Subject: [PATCH] hyperv: Add netpoll support In order to have at least a netconsole to debug kernel issues on Windows Azure this patch implements netpoll support. Sending packets is easy, netvsc_start_xmit() does already everything needed. To receive we need to trigger the channel callback which is usally called via tasklet_schedule(). Signed-off-by: Richard Weinberger rich...@nod.at --- drivers/net/hyperv/netvsc_drv.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 4fd71b7..367b71e 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -736,6 +736,17 @@ static int netvsc_set_mac_addr(struct net_device *ndev, void *p) return err; } +#ifdef CONFIG_NET_POLL_CONTROLLER +static void netvsc_poll_controller(struct net_device *net) +{ + struct net_device_context *net_device_ctx = netdev_priv(net); + struct hv_device *dev = net_device_ctx-device_ctx; + + local_bh_disable(); + netvsc_channel_cb(dev-channel); This can only poll the primary channel not the sub channels. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] hyperv: Add netpoll support
-Original Message- From: Richard Weinberger [mailto:rich...@nod.at] Sent: Tuesday, July 8, 2014 2:40 PM To: Haiyang Zhang; KY Srinivasan Cc: de...@linuxdriverproject.org; net...@vger.kernel.org; linux- ker...@vger.kernel.org Subject: Re: [PATCH] hyperv: Add netpoll support Am 08.07.2014 19:55, schrieb Haiyang Zhang: -Original Message- From: Richard Weinberger [mailto:rich...@nod.at] Sent: Tuesday, July 8, 2014 5:32 AM To: KY Srinivasan; Haiyang Zhang Cc: de...@linuxdriverproject.org; net...@vger.kernel.org; linux- ker...@vger.kernel.org; Richard Weinberger Subject: [PATCH] hyperv: Add netpoll support In order to have at least a netconsole to debug kernel issues on Windows Azure this patch implements netpoll support. Sending packets is easy, netvsc_start_xmit() does already everything needed. To receive we need to trigger the channel callback which is usally called via tasklet_schedule(). Signed-off-by: Richard Weinberger rich...@nod.at --- drivers/net/hyperv/netvsc_drv.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 4fd71b7..367b71e 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -736,6 +736,17 @@ static int netvsc_set_mac_addr(struct net_device *ndev, void *p) return err; } +#ifdef CONFIG_NET_POLL_CONTROLLER +static void netvsc_poll_controller(struct net_device *net) +{ + struct net_device_context *net_device_ctx = netdev_priv(net); + struct hv_device *dev = net_device_ctx-device_ctx; + + local_bh_disable(); + netvsc_channel_cb(dev-channel); This can only poll the primary channel not the sub channels. Sub channels in terms of one channel per VCPU as KY said? *confused*, Since it's used only for debugging, polling the subchannels may not be necessary. Regarding the CPU binding, KY will reply you in another email. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v3] hyperv: Add netpoll support
-Original Message- From: Richard Weinberger [mailto:rich...@nod.at] Sent: Wednesday, July 9, 2014 10:24 AM To: KY Srinivasan; Haiyang Zhang Cc: sergei.shtyl...@cogentembedded.com; rom...@fr.zoreil.com; de...@linuxdriverproject.org; net...@vger.kernel.org; linux- ker...@vger.kernel.org; Richard Weinberger Subject: [PATCH v3] hyperv: Add netpoll support In order to have at least a netconsole to debug kernel issues on Windows Azure this patch implements netpoll support. Sending packets is easy, netvsc_start_xmit() does already everything needed. Signed-off-by: Richard Weinberger rich...@nod.at Acked-by: Haiyang Zhang haiya...@microsoft.com Thanks. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2
-Original Message- From: Sitsofe Wheeler [mailto:sits...@gmail.com] Sent: Friday, July 11, 2014 1:53 AM To: Haiyang Zhang Cc: KY Srinivasan; David S. Miller; de...@linuxdriverproject.org; linux- ker...@vger.kernel.org; net...@vger.kernel.org Subject: Re: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2 Oops that should have been https://bugzilla.kernel.org/attachment.cgi?id=142351 (either way it's information linked off https://bugzilla.kernel.org/show_bug.cgi?id=78771 ). Thanks for the dmesg. By looking at it, seems the netvsc driver was loaded properly, and 2 NICs are up, one NIC is down (probably not set to connected in HyperV manager?). Or, this dmesg wasn't the one when bug happens? [8.514493] hv_netvsc: hv_netvsc channel opened successfully [9.343318] hv_netvsc vmbus_0_14: Send section size: 6144, Section count:170 [9.345831] hv_netvsc vmbus_0_14: Device MAC 00:15:5d:6f:02:8f link state up [9.347101] hv_netvsc: hv_netvsc channel opened successfully [ 10.170308] hv_netvsc vmbus_0_15: Send section size: 6144, Section count:170 [ 10.170702] hv_netvsc vmbus_0_15: Device MAC 00:15:5d:6f:02:a5 link state up [ 10.172826] hv_netvsc: hv_netvsc channel opened successfully [ 10.988146] hv_netvsc vmbus_0_16: Send section size: 6144, Section count:170 [ 10.989069] hv_netvsc vmbus_0_16: Device MAC 00:15:5d:6f:02:a6 link state down Since you found the commit b679ef73edc is related to this problem, could you do a simple test: Reduce the receive buffer size back to 2MB, like below, then re-test it, see if the problem goes away? drivers/net/hyperv/hyperv_net.h #define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*2) /* 2MB */ Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2
-Original Message- From: Sitsofe Wheeler [mailto:sits...@gmail.com] Sent: Monday, July 14, 2014 5:31 PM To: Haiyang Zhang Cc: KY Srinivasan; David S. Miller; de...@linuxdriverproject.org; linux- ker...@vger.kernel.org; net...@vger.kernel.org Subject: Re: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2 On Fri, Jul 11, 2014 at 03:25:11PM +, Haiyang Zhang wrote: Since you found the commit b679ef73edc is related to this problem, could you do a simple test: Reduce the receive buffer size back to 2MB, like below, then re-test it, see if the problem goes away? drivers/net/hyperv/hyperv_net.h #define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*2) /* 2MB */ After doing this I was able to reach over 900 reboots where the network connected properly. Thanks for the tests! I will make a patch that can automatically retry smaller memory allocs when memory is insufficient. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2
-Original Message- From: Sitsofe Wheeler [mailto:sits...@gmail.com] Sent: Tuesday, July 15, 2014 1:09 AM To: Haiyang Zhang Cc: KY Srinivasan; David S. Miller; de...@linuxdriverproject.org; linux- ker...@vger.kernel.org; net...@vger.kernel.org Subject: Re: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2 On Mon, Jul 14, 2014 at 10:39:48PM +, Haiyang Zhang wrote: -Original Message- From: Sitsofe Wheeler [mailto:sits...@gmail.com] Sent: Monday, July 14, 2014 5:31 PM To: Haiyang Zhang Cc: KY Srinivasan; David S. Miller; de...@linuxdriverproject.org; linux- ker...@vger.kernel.org; net...@vger.kernel.org Subject: Re: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2 Thanks for the tests! I will make a patch that can automatically retry smaller memory allocs when memory is insufficient. This concerns me a bit - why would there be insufficient memory on a 64 bit VM with 4 GBytes of RAM just after startup (presumably the host's memory isn't the issue)? Additionally, while things might fail just when things are starting up, doing ifup eth0 at some point later succeeds so whatever issue it had seems temporary. Perhaps it would be wise to adding some debugging output to see if the allocation really failed and why... Actually, there will be debug log in dmesg if the memory allocation fails. But it didn't show up in your dmesg. And since it can be recovered by ifup eth0 later, the NIC must have been properly loaded (buffer alloc was successful but took a bit longer time). I think the larger receive-buffer size (16MB) may take longer time, because vzalloc() may sleep. And, that's why we don't see the bug with a small buffer size, because the allocation is quick. Could you try put LINKDELAY=60 into the this file? /etc/sysconfig/network-scripts/ifcfg-eth0 And see if the problem goes away? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] hyperv: Fix error return code in netvsc_init_buf()
-Original Message- From: weiyj...@163.com [mailto:weiyj...@163.com] Sent: Tuesday, July 22, 2014 9:01 PM To: KY Srinivasan; Haiyang Zhang Cc: Wei Yongjun; de...@linuxdriverproject.org; net...@vger.kernel.org Subject: [PATCH] hyperv: Fix error return code in netvsc_init_buf() From: Wei Yongjun yongjun_...@trendmicro.com.cn Fix to return -ENOMEM from the kalloc error handling case instead of 0. Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn Reviewed-by: Haiyang Zhang haiya...@microsoft.com Good catch. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next] hyperv: Change the receive buffer size for legacy hosts
Due to a bug in the Hyper-V host verion 2008R2, we need to use a slightly smaller receive buffer size, otherwise the buffer will not be accepted by the legacy hosts. Signed-off-by: Haiyang Zhang haiya...@microsoft.com --- drivers/net/hyperv/hyperv_net.h |1 + drivers/net/hyperv/netvsc.c |6 +- 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 39fc230..ea5f182 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -516,6 +516,7 @@ struct nvsp_message { #define NETVSC_MTU 65536 #define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */ +#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024*1024*15) /* 15MB */ #define NETVSC_RECEIVE_BUFFER_ID 0xcafe diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 1a0280d..daddea2 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -365,6 +365,11 @@ static int netvsc_connect_vsp(struct hv_device *device) goto cleanup; /* Post the big receive buffer to NetVSP */ + if (net_device-nvsp_version = NVSP_PROTOCOL_VERSION_2) + net_device-recv_buf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; + else + net_device-recv_buf_size = NETVSC_RECEIVE_BUFFER_SIZE; + ret = netvsc_init_recv_buf(device); cleanup: @@ -898,7 +903,6 @@ int netvsc_device_add(struct hv_device *device, void *additional_info) ndev = net_device-ndev; /* Initialize the NetVSC channel extension */ - net_device-recv_buf_size = NETVSC_RECEIVE_BUFFER_SIZE; spin_lock_init(net_device-recv_pkt_list_lock); INIT_LIST_HEAD(net_device-recv_pkt_list); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next, v2, 0/1] hyperv: Add support for virtual Receive Side Scaling (vRSS)
In this updated version, I have re-written the send queue selection, which is based on ndo_select_queue now. I also applied the stop/wake queue for each queue separately as suggested by reviewers. Tom Herbert therb...@google.com has submitted a Toeplitz library function with some optimization. But it's not accepted yet. I'm still using my Toeplitz implementation in netvsc module. Please accept my patch if no other issues, because it already provides significant performance enhancement at current state. I will be happy to switch to the Toeplitz library function when it's accepted in the future. Haiyang Zhang (1): hyperv: Add support for virtual Receive Side Scaling (vRSS) drivers/net/hyperv/hyperv_net.h | 111 ++- drivers/net/hyperv/netvsc.c | 132 +- drivers/net/hyperv/netvsc_drv.c | 104 - drivers/net/hyperv/rndis_filter.c | 186 - 4 files changed, 500 insertions(+), 33 deletions(-) -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next, v2, 1/1] hyperv: Add support for virtual Receive Side Scaling (vRSS)
This feature allows multiple channels to be used by each virtual NIC. It is available on Hyper-V host 2012 R2. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h | 111 ++- drivers/net/hyperv/netvsc.c | 132 +- drivers/net/hyperv/netvsc_drv.c | 104 - drivers/net/hyperv/rndis_filter.c | 186 - 4 files changed, 500 insertions(+), 33 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 13010b4..f67292f 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -28,6 +28,98 @@ #include linux/hyperv.h #include linux/rndis.h +/* RSS related */ +#define OID_GEN_RECEIVE_SCALE_CAPABILITIES 0x00010203 /* query only */ +#define OID_GEN_RECEIVE_SCALE_PARAMETERS 0x00010204 /* query and set */ + +#define NDIS_OBJECT_TYPE_RSS_CAPABILITIES 0x88 +#define NDIS_OBJECT_TYPE_RSS_PARAMETERS 0x89 + +#define NDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2 2 +#define NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2 2 + +struct ndis_obj_header { + u8 type; + u8 rev; + u16 size; +} __packed; + + +/* ndis_recv_scale_cap/cap_flag */ +#define NDIS_RSS_CAPS_MESSAGE_SIGNALED_INTERRUPTS 0x0100 +#define NDIS_RSS_CAPS_CLASSIFICATION_AT_ISR 0x0200 +#define NDIS_RSS_CAPS_CLASSIFICATION_AT_DPC 0x0400 +#define NDIS_RSS_CAPS_USING_MSI_X 0x0800 +#define NDIS_RSS_CAPS_RSS_AVAILABLE_ON_PORTS 0x1000 +#define NDIS_RSS_CAPS_SUPPORTS_MSI_X 0x2000 +#define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV4 0x0100 +#define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6 0x0200 +#define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6_EX 0x0400 + +struct ndis_recv_scale_cap { /* NDIS_RECEIVE_SCALE_CAPABILITIES */ + struct ndis_obj_header hdr; + u32 cap_flag; + u32 num_int_msg; + u32 num_recv_que; + u16 num_indirect_tabent; +} __packed; + + +/* ndis_recv_scale_param flags */ +#define NDIS_RSS_PARAM_FLAG_BASE_CPU_UNCHANGED 0x0001 +#define NDIS_RSS_PARAM_FLAG_HASH_INFO_UNCHANGED0x0002 +#define NDIS_RSS_PARAM_FLAG_ITABLE_UNCHANGED 0x0004 +#define NDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED 0x0008 +#define NDIS_RSS_PARAM_FLAG_DISABLE_RSS0x0010 + +/* Hash info bits */ +#define NDIS_HASH_FUNC_TOEPLITZ 0x0001 +#define NDIS_HASH_IPV4 0x0100 +#define NDIS_HASH_TCP_IPV4 0x0200 +#define NDIS_HASH_IPV6 0x0400 +#define NDIS_HASH_IPV6_EX 0x0800 +#define NDIS_HASH_TCP_IPV6 0x1000 +#define NDIS_HASH_TCP_IPV6_EX 0x2000 + +#define NDIS_RSS_INDIRECTION_TABLE_MAX_SIZE_REVISION_2 (128 * 4) +#define NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 40 + +#define ITAB_NUM 128 +#define HASH_KEYLEN NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 +extern u8 hash_key[]; + +struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */ + struct ndis_obj_header hdr; + + /* Qualifies the rest of the information */ + u16 flag; + + /* The base CPU number to do receive processing. not used */ + u16 base_cpu_number; + + /* This describes the hash function and type being enabled */ + u32 hashinfo; + + /* The size of indirection table array */ + u16 indirect_tabsize; + + /* The offset of the indirection table from the beginning of this +* structure +*/ + u32 indirect_taboffset; + + /* The size of the hash secret key */ + u16 hashkey_size; + + /* The offset of the secret key from the beginning of this structure */ + u32 kashkey_offset; + + u32 processor_masks_offset; + u32 num_processor_masks; + u32 processor_masks_entry_size; +}; + + /* Fwd declaration */ struct hv_netvsc_packet; struct ndis_tcp_ip_checksum_info; @@ -39,6 +131,8 @@ struct xferpage_packet { /* # of netvsc packets this xfer packet contains */ u32 count; + + struct vmbus_channel *channel; }; /* @@ -54,6 +148,9 @@ struct hv_netvsc_packet { bool is_data_pkt; u16 vlan_tci; + u16 q_idx; + struct vmbus_channel *channel; + /* * Valid only for receives when we break a xfer page packet * into multiple netvsc packets @@ -120,6 +217,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, int netvsc_recv_callback(struct hv_device *device_obj, struct hv_netvsc_packet *packet, struct ndis_tcp_ip_checksum_info *csum_info); +extern void netvsc_channel_cb(void *context); int rndis_filter_open(struct hv_device *dev); int rndis_filter_close(struct hv_device *dev); int rndis_filter_device_add(struct hv_device *dev, @@ -131,6 +229,7 @@ int rndis_filter_receive(struct hv_device *dev, int rndis_filter_set_packet_filter(struct
RE: [PATCH net-next,v2,1/1] hyperv: Add support for virtual Receive Side Scaling (vRSS)
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Monday, March 17, 2014 4:20 PM To: Haiyang Zhang Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next,v2,1/1] hyperv: Add support for virtual Receive Side Scaling (vRSS) From: Haiyang Zhang haiya...@microsoft.com Date: Sat, 15 Mar 2014 10:18:07 -0700 - if (netif_queue_stopped(ndev) !net_device-start_remove - (hv_ringbuf_avail_percent(device-channel- outbound) -RING_AVAIL_PERCENT_HIWATER || - num_outstanding_sends 1)) - netif_wake_queue(ndev); + if (netif_tx_queue_stopped(netdev_get_tx_queue(ndev, q_idx)) +!net_device-start_remove + (hv_ringbuf_avail_percent(channel-outbound) +RING_AVAIL_PERCENT_HIWATER || queue_sends 1)) + netif_tx_wake_queue(netdev_get_tx_queue( + ndev, q_idx)); This is not indented properly, make it: if (A B (C D || E 1)) Never put operators at the beginning of a conditional line, always at the end. I will do. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next,v2,1/1] hyperv: Add support for virtual Receive Side Scaling (vRSS)
-Original Message- From: Ben Hutchings [mailto:b...@decadent.org.uk] Sent: Monday, March 17, 2014 4:28 PM To: Haiyang Zhang Cc: da...@davemloft.net; net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org Subject: Re: [PATCH net-next,v2,1/1] hyperv: Add support for virtual Receive Side Scaling (vRSS) On Sat, 2014-03-15 at 10:18 -0700, Haiyang Zhang wrote: [...] #define RING_SIZE_MIN 64 -static int ring_size = 128; +int ring_size = 128; module_param(ring_size, int, S_IRUGO); MODULE_PARM_DESC(ring_size, Ring buffer size (# of pages)); You have to add some driver-specific prefix to the variable name if it is going to be extern. (And use module_param_named to avoid changing the parameter name too.) [...] +u8 hash_key[HASH_KEYLEN] = { + 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, + 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, + 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, + 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, + 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa }; [...] Same for this one. I will do. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next, v3] hyperv: Add support for virtual Receive Side Scaling (vRSS)
This feature allows multiple channels to be used by each virtual NIC. It is available on Hyper-V host 2012 R2. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h | 112 ++- drivers/net/hyperv/netvsc.c | 134 +- drivers/net/hyperv/netvsc_drv.c | 102 +++- drivers/net/hyperv/rndis_filter.c | 187 - 4 files changed, 503 insertions(+), 32 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 13010b4..c2d72f6 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -28,6 +28,98 @@ #include linux/hyperv.h #include linux/rndis.h +/* RSS related */ +#define OID_GEN_RECEIVE_SCALE_CAPABILITIES 0x00010203 /* query only */ +#define OID_GEN_RECEIVE_SCALE_PARAMETERS 0x00010204 /* query and set */ + +#define NDIS_OBJECT_TYPE_RSS_CAPABILITIES 0x88 +#define NDIS_OBJECT_TYPE_RSS_PARAMETERS 0x89 + +#define NDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2 2 +#define NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2 2 + +struct ndis_obj_header { + u8 type; + u8 rev; + u16 size; +} __packed; + + +/* ndis_recv_scale_cap/cap_flag */ +#define NDIS_RSS_CAPS_MESSAGE_SIGNALED_INTERRUPTS 0x0100 +#define NDIS_RSS_CAPS_CLASSIFICATION_AT_ISR 0x0200 +#define NDIS_RSS_CAPS_CLASSIFICATION_AT_DPC 0x0400 +#define NDIS_RSS_CAPS_USING_MSI_X 0x0800 +#define NDIS_RSS_CAPS_RSS_AVAILABLE_ON_PORTS 0x1000 +#define NDIS_RSS_CAPS_SUPPORTS_MSI_X 0x2000 +#define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV4 0x0100 +#define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6 0x0200 +#define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6_EX 0x0400 + +struct ndis_recv_scale_cap { /* NDIS_RECEIVE_SCALE_CAPABILITIES */ + struct ndis_obj_header hdr; + u32 cap_flag; + u32 num_int_msg; + u32 num_recv_que; + u16 num_indirect_tabent; +} __packed; + + +/* ndis_recv_scale_param flags */ +#define NDIS_RSS_PARAM_FLAG_BASE_CPU_UNCHANGED 0x0001 +#define NDIS_RSS_PARAM_FLAG_HASH_INFO_UNCHANGED0x0002 +#define NDIS_RSS_PARAM_FLAG_ITABLE_UNCHANGED 0x0004 +#define NDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED 0x0008 +#define NDIS_RSS_PARAM_FLAG_DISABLE_RSS0x0010 + +/* Hash info bits */ +#define NDIS_HASH_FUNC_TOEPLITZ 0x0001 +#define NDIS_HASH_IPV4 0x0100 +#define NDIS_HASH_TCP_IPV4 0x0200 +#define NDIS_HASH_IPV6 0x0400 +#define NDIS_HASH_IPV6_EX 0x0800 +#define NDIS_HASH_TCP_IPV6 0x1000 +#define NDIS_HASH_TCP_IPV6_EX 0x2000 + +#define NDIS_RSS_INDIRECTION_TABLE_MAX_SIZE_REVISION_2 (128 * 4) +#define NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 40 + +#define ITAB_NUM 128 +#define HASH_KEYLEN NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 +extern u8 netvsc_hash_key[]; + +struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */ + struct ndis_obj_header hdr; + + /* Qualifies the rest of the information */ + u16 flag; + + /* The base CPU number to do receive processing. not used */ + u16 base_cpu_number; + + /* This describes the hash function and type being enabled */ + u32 hashinfo; + + /* The size of indirection table array */ + u16 indirect_tabsize; + + /* The offset of the indirection table from the beginning of this +* structure +*/ + u32 indirect_taboffset; + + /* The size of the hash secret key */ + u16 hashkey_size; + + /* The offset of the secret key from the beginning of this structure */ + u32 kashkey_offset; + + u32 processor_masks_offset; + u32 num_processor_masks; + u32 processor_masks_entry_size; +}; + + /* Fwd declaration */ struct hv_netvsc_packet; struct ndis_tcp_ip_checksum_info; @@ -39,6 +131,8 @@ struct xferpage_packet { /* # of netvsc packets this xfer packet contains */ u32 count; + + struct vmbus_channel *channel; }; /* @@ -54,6 +148,9 @@ struct hv_netvsc_packet { bool is_data_pkt; u16 vlan_tci; + u16 q_idx; + struct vmbus_channel *channel; + /* * Valid only for receives when we break a xfer page packet * into multiple netvsc packets @@ -120,6 +217,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, int netvsc_recv_callback(struct hv_device *device_obj, struct hv_netvsc_packet *packet, struct ndis_tcp_ip_checksum_info *csum_info); +extern void netvsc_channel_cb(void *context); int rndis_filter_open(struct hv_device *dev); int rndis_filter_close(struct hv_device *dev); int rndis_filter_device_add(struct hv_device *dev, @@ -522,6 +620,8 @@ struct nvsp_message { #define NETVSC_PACKET_SIZE 2048
RE: [PATCH net-next,v3] hyperv: Add support for virtual Receive Side Scaling (vRSS)
-Original Message- + + +/* ndis_recv_scale_cap/cap_flag */ One empty line is sufficient, we don't need two of them here. I will fix this and other formats you pointed out below, also check the whole patch for similar issues. - net = alloc_etherdev(sizeof(struct net_device_context)); + net = alloc_etherdev_mq(sizeof(struct net_device_context), + num_online_cpus()); if (!net) return -ENOMEM; num_online_cpus() can change, will your driver accomodate this? HyperV currently doesn't support hot-add/remove cpu, so this is constant for this driver. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next,v4] hyperv: Add support for virtual Receive Side Scaling (vRSS)
-Original Message- From: Haiyang Zhang [mailto:haiya...@microsoft.com] Sent: Friday, March 21, 2014 4:44 PM To: da...@davemloft.net; net...@vger.kernel.org Cc: Haiyang Zhang; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org Subject: [PATCH net-next,v4] hyperv: Add support for virtual Receive Side Scaling (vRSS) This feature allows multiple channels to be used by each virtual NIC. It is available on Hyper-V host 2012 R2. (It depends on this commit: Drivers: hv: vmbus: Support per-channel driver state http://git.kernel.org/cgit/linux/kernel/git/next/linux- next.git/commit/?id=8a7206a89f85c8439561b0eff85bb9440a2e97a9 ) Hi Dave, Do we know when the dependency (commit: 8a7206a89f) will be merged into net-next tree? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next,v4] hyperv: Add support for virtual Receive Side Scaling (vRSS)
-Original Message- From: Greg KH [mailto:gre...@linuxfoundation.org] Sent: Tuesday, March 25, 2014 11:50 PM To: Haiyang Zhang Cc: David Miller; o...@aepfle.de; net...@vger.kernel.org; jasow...@redhat.com; driverdev-devel@linuxdriverproject.org; linux- ker...@vger.kernel.org Subject: Re: [PATCH net-next,v4] hyperv: Add support for virtual Receive Side Scaling (vRSS) On Wed, Mar 26, 2014 at 03:23:47AM +, Haiyang Zhang wrote: -Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Tuesday, March 25, 2014 8:47 PM To: Haiyang Zhang Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next,v4] hyperv: Add support for virtual Receive Side Scaling (vRSS) From: David Miller da...@davemloft.net Date: Tue, 25 Mar 2014 20:43:43 -0400 (EDT) From: Haiyang Zhang haiya...@microsoft.com Date: Tue, 25 Mar 2014 20:37:43 + Do we know when the dependency (commit: 8a7206a89f) will be merged into net-next tree? You're really not very patient, to say the least. It's done now and I'm working to integrate your patch. That patch has been in under review state in patchwork, which means that I will get to it at some point, so you don't need to worry about it any more than any other patch you might submit. The whole reason patchwork exists is so that people don't have to ask. And actually, this dependency 8a7206a89f commit doesn't exist in the 'net' tree at all. I just merged Linus's tree into 'net' and it doesn't exist there either. So this patch still doesn't compile. I'm tossing it from patchwork until you sort this out. Dave, Thank you for the efforts. The commit is in the linux-next tree. You can see it from this link: http://git.kernel.org/cgit/linux/kernel/git/next/linux- next.git/commit/?id=8a7206a89f85c8439561b0eff85bb9440a2e97a9 And, here is the commit log: author K. Y. Srinivasan k...@microsoft.com 2014-02-03 20:42:45 (GMT) committer Greg Kroah-Hartman gre...@linuxfoundation.org 2014-02-07 23:22:40 (GMT) commit 8a7206a89f85c8439561b0eff85bb9440a2e97a9 (patch) tree 61f763919607368481ac128f56416df1f49cd187 parent 011a7c3cc3aa60c7ea6bb49d847e80a299ba7b36 (diff) Drivers: hv: vmbus: Support per-channel driver state As we implement Virtual Receive Side Scaling on the networking side (the VRSS patches are currently under review), it will be useful to have per-channel state that vmbus drivers can manage. Add support for managing per-channel state. KY: Do you know the original tree this patch was checked into by Greg KH? Or, did Greg checked into linux-next tree directly? No one checks into the linux-next tree directly. So your patch relies on a patch in my char-misc tree? Ick, that wasn't very wise. It will just have to wait until the patch goes into 3.15-rc1, as my trees are closed, sorry. Greg, Thank you for the info. We will wait until KY's earlier patch is merged into 3.15rc1. In the future, the changes for vmbus or common header used by netvsc driver should be submitted into net-next tree, correct? So, it can be available quickly for the subsequent features? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next,v4] hyperv: Add support for virtual Receive Side Scaling (vRSS)
-Original Message- From: Sharat Masetty [mailto:shara...@gmail.com] Sent: Monday, April 7, 2014 6:13 PM To: David Miller Cc: Haiyang Zhang; Linux Netdev List; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next,v4] hyperv: Add support for virtual Receive Side Scaling (vRSS) Hi Zhang, How is this beneficial when compared to RPS(receive packet steering)? Can you please provide more details on what this patch does? This patch supports the virtual RSS feature provided by Hyper-V hosts. Currently, the interrupts are received on only one CPU per vNIC. With this feature, we can receive interrupts from multiple CPUs and VMBus channels for one vNIC. Outgoing packets are put into multiple channels as well. So the network throughput can scale up with the number of CPUs for a VM. RPS is basically a software implementation of RSS. This is an online doc about these features: https://www.kernel.org/doc/Documentation/networking/scaling.txt Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next,v4] hyperv: Add support for virtual Receive Side Scaling (vRSS)
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Monday, April 7, 2014 2:43 PM To: Haiyang Zhang Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next,v4] hyperv: Add support for virtual Receive Side Scaling (vRSS) The net-next tree is not open yet, I will announce when it is and you can submit net-next targetted patches. Dave, Is the net-next tree open now? (I haven't seen your announcement, but I saw some patches for net-next are under review.) Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next, v4] hyperv: Add support for virtual Receive Side Scaling (vRSS)
This feature allows multiple channels to be used by each virtual NIC. It is available on Hyper-V host 2012 R2. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h | 110 +- drivers/net/hyperv/netvsc.c | 136 +- drivers/net/hyperv/netvsc_drv.c | 103 +++- drivers/net/hyperv/rndis_filter.c | 189 - 4 files changed, 504 insertions(+), 34 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index d18f711d..57eb3f9 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -28,6 +28,96 @@ #include linux/hyperv.h #include linux/rndis.h +/* RSS related */ +#define OID_GEN_RECEIVE_SCALE_CAPABILITIES 0x00010203 /* query only */ +#define OID_GEN_RECEIVE_SCALE_PARAMETERS 0x00010204 /* query and set */ + +#define NDIS_OBJECT_TYPE_RSS_CAPABILITIES 0x88 +#define NDIS_OBJECT_TYPE_RSS_PARAMETERS 0x89 + +#define NDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2 2 +#define NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2 2 + +struct ndis_obj_header { + u8 type; + u8 rev; + u16 size; +} __packed; + +/* ndis_recv_scale_cap/cap_flag */ +#define NDIS_RSS_CAPS_MESSAGE_SIGNALED_INTERRUPTS 0x0100 +#define NDIS_RSS_CAPS_CLASSIFICATION_AT_ISR 0x0200 +#define NDIS_RSS_CAPS_CLASSIFICATION_AT_DPC 0x0400 +#define NDIS_RSS_CAPS_USING_MSI_X 0x0800 +#define NDIS_RSS_CAPS_RSS_AVAILABLE_ON_PORTS 0x1000 +#define NDIS_RSS_CAPS_SUPPORTS_MSI_X 0x2000 +#define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV4 0x0100 +#define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6 0x0200 +#define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6_EX 0x0400 + +struct ndis_recv_scale_cap { /* NDIS_RECEIVE_SCALE_CAPABILITIES */ + struct ndis_obj_header hdr; + u32 cap_flag; + u32 num_int_msg; + u32 num_recv_que; + u16 num_indirect_tabent; +} __packed; + + +/* ndis_recv_scale_param flags */ +#define NDIS_RSS_PARAM_FLAG_BASE_CPU_UNCHANGED 0x0001 +#define NDIS_RSS_PARAM_FLAG_HASH_INFO_UNCHANGED0x0002 +#define NDIS_RSS_PARAM_FLAG_ITABLE_UNCHANGED 0x0004 +#define NDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED 0x0008 +#define NDIS_RSS_PARAM_FLAG_DISABLE_RSS0x0010 + +/* Hash info bits */ +#define NDIS_HASH_FUNC_TOEPLITZ 0x0001 +#define NDIS_HASH_IPV4 0x0100 +#define NDIS_HASH_TCP_IPV4 0x0200 +#define NDIS_HASH_IPV6 0x0400 +#define NDIS_HASH_IPV6_EX 0x0800 +#define NDIS_HASH_TCP_IPV6 0x1000 +#define NDIS_HASH_TCP_IPV6_EX 0x2000 + +#define NDIS_RSS_INDIRECTION_TABLE_MAX_SIZE_REVISION_2 (128 * 4) +#define NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 40 + +#define ITAB_NUM 128 +#define HASH_KEYLEN NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 +extern u8 netvsc_hash_key[]; + +struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */ + struct ndis_obj_header hdr; + + /* Qualifies the rest of the information */ + u16 flag; + + /* The base CPU number to do receive processing. not used */ + u16 base_cpu_number; + + /* This describes the hash function and type being enabled */ + u32 hashinfo; + + /* The size of indirection table array */ + u16 indirect_tabsize; + + /* The offset of the indirection table from the beginning of this +* structure +*/ + u32 indirect_taboffset; + + /* The size of the hash secret key */ + u16 hashkey_size; + + /* The offset of the secret key from the beginning of this structure */ + u32 kashkey_offset; + + u32 processor_masks_offset; + u32 num_processor_masks; + u32 processor_masks_entry_size; +}; + /* Fwd declaration */ struct hv_netvsc_packet; struct ndis_tcp_ip_checksum_info; @@ -39,6 +129,8 @@ struct xferpage_packet { /* # of netvsc packets this xfer packet contains */ u32 count; + + struct vmbus_channel *channel; }; /* @@ -54,6 +146,9 @@ struct hv_netvsc_packet { bool is_data_pkt; u16 vlan_tci; + u16 q_idx; + struct vmbus_channel *channel; + /* * Valid only for receives when we break a xfer page packet * into multiple netvsc packets @@ -120,6 +215,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, int netvsc_recv_callback(struct hv_device *device_obj, struct hv_netvsc_packet *packet, struct ndis_tcp_ip_checksum_info *csum_info); +void netvsc_channel_cb(void *context); int rndis_filter_open(struct hv_device *dev); int rndis_filter_close(struct hv_device *dev); int rndis_filter_device_add(struct hv_device *dev, @@ -522,6 +618,8 @@ struct nvsp_message { #define NETVSC_PACKET_SIZE 2048 +#define
[PATCH net-next,2/2] hyperv: Simplify the send_completion variables
The union contains only one member now, so we use the variables in it directly. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h | 10 +++--- drivers/net/hyperv/netvsc.c |7 +++ drivers/net/hyperv/netvsc_drv.c |8 drivers/net/hyperv/rndis_filter.c |2 +- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index a1af0f7..d1f7826 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -136,13 +136,9 @@ struct hv_netvsc_packet { u16 q_idx; struct vmbus_channel *channel; - union { - struct { - u64 send_completion_tid; - void *send_completion_ctx; - void (*send_completion)(void *context); - } send; - } completion; + u64 send_completion_tid; + void *send_completion_ctx; + void (*send_completion)(void *context); /* This points to the memory after page_buf */ struct rndis_message *rndis_msg; diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index b103347..bbee446 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -479,9 +479,8 @@ static void netvsc_send_completion(struct netvsc_device *net_device, if (nvsc_packet) { q_idx = nvsc_packet-q_idx; channel = nvsc_packet-channel; - nvsc_packet-completion.send.send_completion( - nvsc_packet-completion.send. - send_completion_ctx); + nvsc_packet-send_completion(nvsc_packet- +send_completion_ctx); } num_outstanding_sends = @@ -534,7 +533,7 @@ int netvsc_send(struct hv_device *device, 0x; sendMessage.msg.v1_msg.send_rndis_pkt.send_buf_section_size = 0; - if (packet-completion.send.send_completion) + if (packet-send_completion) req_id = (ulong)packet; else req_id = 0; diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 8f6d53a..c76b665 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -235,7 +235,7 @@ static void netvsc_xmit_completion(void *context) { struct hv_netvsc_packet *packet = (struct hv_netvsc_packet *)context; struct sk_buff *skb = (struct sk_buff *) - (unsigned long)packet-completion.send.send_completion_tid; + (unsigned long)packet-send_completion_tid; kfree(packet); @@ -425,9 +425,9 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) (num_data_pgs * sizeof(struct hv_page_buffer))); /* Set the completion routine */ - packet-completion.send.send_completion = netvsc_xmit_completion; - packet-completion.send.send_completion_ctx = packet; - packet-completion.send.send_completion_tid = (unsigned long)skb; + packet-send_completion = netvsc_xmit_completion; + packet-send_completion_ctx = packet; + packet-send_completion_tid = (unsigned long)skb; isvlan = packet-vlan_tci VLAN_TAG_PRESENT; diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 48f5a0f..99c527a 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -236,7 +236,7 @@ static int rndis_filter_send_request(struct rndis_device *dev, packet-page_buf[0].len; } - packet-completion.send.send_completion = NULL; + packet-send_completion = NULL; ret = netvsc_send(dev-net_dev-dev, packet); return ret; -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next,1/2] hyperv: Remove recv_pkt_list and lock
Removed recv_pkt_list and lock, and updated related code, so that the locking overhead is reduced especially when multiple channels are in use. The recv_pkt_list isn't actually necessary because the packets are processed sequentially in each channel. It has been replaced by a local variable, and the related lock for this list is also removed. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h | 33 --- drivers/net/hyperv/netvsc.c | 174 +++-- drivers/net/hyperv/netvsc_drv.c |2 +- drivers/net/hyperv/rndis_filter.c |2 - 4 files changed, 13 insertions(+), 198 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 57eb3f9..a1af0f7 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -119,27 +119,14 @@ struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */ }; /* Fwd declaration */ -struct hv_netvsc_packet; struct ndis_tcp_ip_checksum_info; -/* Represent the xfer page packet which contains 1 or more netvsc packet */ -struct xferpage_packet { - struct list_head list_ent; - u32 status; - - /* # of netvsc packets this xfer packet contains */ - u32 count; - - struct vmbus_channel *channel; -}; - /* * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame * within the RNDIS */ struct hv_netvsc_packet { /* Bookkeeping stuff */ - struct list_head list_ent; u32 status; struct hv_device *device; @@ -149,19 +136,8 @@ struct hv_netvsc_packet { u16 q_idx; struct vmbus_channel *channel; - /* -* Valid only for receives when we break a xfer page packet -* into multiple netvsc packets -*/ - struct xferpage_packet *xfer_page_pkt; - union { struct { - u64 recv_completion_tid; - void *recv_completion_ctx; - void (*recv_completion)(void *context); - } recv; - struct { u64 send_completion_tid; void *send_completion_ctx; void (*send_completion)(void *context); @@ -613,9 +589,6 @@ struct nvsp_message { #define NETVSC_RECEIVE_BUFFER_ID 0xcafe -/* Preallocated receive packets */ -#define NETVSC_RECEIVE_PACKETLIST_COUNT256 - #define NETVSC_PACKET_SIZE 2048 #define VRSS_SEND_TAB_SIZE 16 @@ -630,12 +603,6 @@ struct netvsc_device { wait_queue_head_t wait_drain; bool start_remove; bool destroy; - /* -* List of free preallocated hv_netvsc_packet to represent receive -* packet -*/ - struct list_head recv_pkt_list; - spinlock_t recv_pkt_list_lock; /* Receive buffer allocated by us but manages by NetVSP */ void *recv_buf; diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index e7e77f1..b103347 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -387,7 +387,6 @@ static void netvsc_disconnect_vsp(struct netvsc_device *net_device) int netvsc_device_remove(struct hv_device *device) { struct netvsc_device *net_device; - struct hv_netvsc_packet *netvsc_packet, *pos; unsigned long flags; net_device = hv_get_drvdata(device); @@ -416,12 +415,6 @@ int netvsc_device_remove(struct hv_device *device) vmbus_close(device-channel); /* Release all resources */ - list_for_each_entry_safe(netvsc_packet, pos, -net_device-recv_pkt_list, list_ent) { - list_del(netvsc_packet-list_ent); - kfree(netvsc_packet); - } - if (net_device-sub_cb_buf) vfree(net_device-sub_cb_buf); @@ -641,62 +634,6 @@ retry_send_cmplt: } } -/* Send a receive completion packet to RNDIS device (ie NetVsp) */ -static void netvsc_receive_completion(void *context) -{ - struct hv_netvsc_packet *packet = context; - struct hv_device *device = packet-device; - struct vmbus_channel *channel; - struct netvsc_device *net_device; - u64 transaction_id = 0; - bool fsend_receive_comp = false; - unsigned long flags; - struct net_device *ndev; - u32 status = NVSP_STAT_NONE; - - /* -* Even though it seems logical to do a GetOutboundNetDevice() here to -* send out receive completion, we are using GetInboundNetDevice() -* since we may have disable outbound traffic already. -*/ - net_device = get_inbound_net_device(device); - if (!net_device) - return; - ndev = net_device-ndev; - - /* Overloading use of the lock. */ - spin_lock_irqsave(net_device-recv_pkt_list_lock, flags
[PATCH net-next,v2,1/2] hyperv: Remove recv_pkt_list and lock
Removed recv_pkt_list and lock, and updated related code, so that the locking overhead is reduced especially when multiple channels are in use. The recv_pkt_list isn't actually necessary because the packets are processed sequentially in each channel. It has been replaced by a local variable, and the related lock for this list is also removed. The is_data_pkt field is not used in receive path, so its assignment is cleaned up. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h | 33 --- drivers/net/hyperv/netvsc.c | 174 +++-- drivers/net/hyperv/netvsc_drv.c |2 +- drivers/net/hyperv/rndis_filter.c |2 - 4 files changed, 13 insertions(+), 198 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 57eb3f9..a1af0f7 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -119,27 +119,14 @@ struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */ }; /* Fwd declaration */ -struct hv_netvsc_packet; struct ndis_tcp_ip_checksum_info; -/* Represent the xfer page packet which contains 1 or more netvsc packet */ -struct xferpage_packet { - struct list_head list_ent; - u32 status; - - /* # of netvsc packets this xfer packet contains */ - u32 count; - - struct vmbus_channel *channel; -}; - /* * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame * within the RNDIS */ struct hv_netvsc_packet { /* Bookkeeping stuff */ - struct list_head list_ent; u32 status; struct hv_device *device; @@ -149,19 +136,8 @@ struct hv_netvsc_packet { u16 q_idx; struct vmbus_channel *channel; - /* -* Valid only for receives when we break a xfer page packet -* into multiple netvsc packets -*/ - struct xferpage_packet *xfer_page_pkt; - union { struct { - u64 recv_completion_tid; - void *recv_completion_ctx; - void (*recv_completion)(void *context); - } recv; - struct { u64 send_completion_tid; void *send_completion_ctx; void (*send_completion)(void *context); @@ -613,9 +589,6 @@ struct nvsp_message { #define NETVSC_RECEIVE_BUFFER_ID 0xcafe -/* Preallocated receive packets */ -#define NETVSC_RECEIVE_PACKETLIST_COUNT256 - #define NETVSC_PACKET_SIZE 2048 #define VRSS_SEND_TAB_SIZE 16 @@ -630,12 +603,6 @@ struct netvsc_device { wait_queue_head_t wait_drain; bool start_remove; bool destroy; - /* -* List of free preallocated hv_netvsc_packet to represent receive -* packet -*/ - struct list_head recv_pkt_list; - spinlock_t recv_pkt_list_lock; /* Receive buffer allocated by us but manages by NetVSP */ void *recv_buf; diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index e7e77f1..b103347 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -387,7 +387,6 @@ static void netvsc_disconnect_vsp(struct netvsc_device *net_device) int netvsc_device_remove(struct hv_device *device) { struct netvsc_device *net_device; - struct hv_netvsc_packet *netvsc_packet, *pos; unsigned long flags; net_device = hv_get_drvdata(device); @@ -416,12 +415,6 @@ int netvsc_device_remove(struct hv_device *device) vmbus_close(device-channel); /* Release all resources */ - list_for_each_entry_safe(netvsc_packet, pos, -net_device-recv_pkt_list, list_ent) { - list_del(netvsc_packet-list_ent); - kfree(netvsc_packet); - } - if (net_device-sub_cb_buf) vfree(net_device-sub_cb_buf); @@ -641,62 +634,6 @@ retry_send_cmplt: } } -/* Send a receive completion packet to RNDIS device (ie NetVsp) */ -static void netvsc_receive_completion(void *context) -{ - struct hv_netvsc_packet *packet = context; - struct hv_device *device = packet-device; - struct vmbus_channel *channel; - struct netvsc_device *net_device; - u64 transaction_id = 0; - bool fsend_receive_comp = false; - unsigned long flags; - struct net_device *ndev; - u32 status = NVSP_STAT_NONE; - - /* -* Even though it seems logical to do a GetOutboundNetDevice() here to -* send out receive completion, we are using GetInboundNetDevice() -* since we may have disable outbound traffic already. -*/ - net_device = get_inbound_net_device(device); - if (!net_device) - return; - ndev = net_device-ndev; - - /* Overloading
[PATCH net-next, v2, 2/2] hyperv: Simplify the send_completion variables
The union contains only one member now, so we use the variables in it directly. Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h | 10 +++--- drivers/net/hyperv/netvsc.c |7 +++ drivers/net/hyperv/netvsc_drv.c |8 drivers/net/hyperv/rndis_filter.c |2 +- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index a1af0f7..d1f7826 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -136,13 +136,9 @@ struct hv_netvsc_packet { u16 q_idx; struct vmbus_channel *channel; - union { - struct { - u64 send_completion_tid; - void *send_completion_ctx; - void (*send_completion)(void *context); - } send; - } completion; + u64 send_completion_tid; + void *send_completion_ctx; + void (*send_completion)(void *context); /* This points to the memory after page_buf */ struct rndis_message *rndis_msg; diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index b103347..bbee446 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -479,9 +479,8 @@ static void netvsc_send_completion(struct netvsc_device *net_device, if (nvsc_packet) { q_idx = nvsc_packet-q_idx; channel = nvsc_packet-channel; - nvsc_packet-completion.send.send_completion( - nvsc_packet-completion.send. - send_completion_ctx); + nvsc_packet-send_completion(nvsc_packet- +send_completion_ctx); } num_outstanding_sends = @@ -534,7 +533,7 @@ int netvsc_send(struct hv_device *device, 0x; sendMessage.msg.v1_msg.send_rndis_pkt.send_buf_section_size = 0; - if (packet-completion.send.send_completion) + if (packet-send_completion) req_id = (ulong)packet; else req_id = 0; diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 8f6d53a..c76b665 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -235,7 +235,7 @@ static void netvsc_xmit_completion(void *context) { struct hv_netvsc_packet *packet = (struct hv_netvsc_packet *)context; struct sk_buff *skb = (struct sk_buff *) - (unsigned long)packet-completion.send.send_completion_tid; + (unsigned long)packet-send_completion_tid; kfree(packet); @@ -425,9 +425,9 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) (num_data_pgs * sizeof(struct hv_page_buffer))); /* Set the completion routine */ - packet-completion.send.send_completion = netvsc_xmit_completion; - packet-completion.send.send_completion_ctx = packet; - packet-completion.send.send_completion_tid = (unsigned long)skb; + packet-send_completion = netvsc_xmit_completion; + packet-send_completion_ctx = packet; + packet-send_completion_tid = (unsigned long)skb; isvlan = packet-vlan_tci VLAN_TAG_PRESENT; diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 48f5a0f..99c527a 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -236,7 +236,7 @@ static int rndis_filter_send_request(struct rndis_device *dev, packet-page_buf[0].len; } - packet-completion.send.send_completion = NULL; + packet-send_completion = NULL; ret = netvsc_send(dev-net_dev-dev, packet); return ret; -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next,1/2] hyperv: Remove recv_pkt_list and lock
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Monday, April 21, 2014 2:57 PM To: Haiyang Zhang Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next,1/2] hyperv: Remove recv_pkt_list and lock From: Haiyang Zhang haiya...@microsoft.com Date: Mon, 21 Apr 2014 12:26:15 -0700 @@ -401,8 +401,6 @@ static void rndis_filter_receive_data(struct rndis_device *dev, pkt-total_data_buflen = rndis_pkt-data_len; pkt-data = (void *)((unsigned long)pkt-data + data_offset); - pkt-is_data_pkt = true; - vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO); if (vlan) { pkt-vlan_tci = VLAN_TAG_PRESENT | vlan-vlanid | This part of your change is not explained at all in your commit message. Please resubmit this series with this hunk properly described and accounted for. I have updated the description and re-send them. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c
-Original Message- From: Jim Davis [mailto:jim.ep...@gmail.com] Sent: Friday, May 2, 2014 9:56 AM To: Stephen Rothwell; linux-next; linux-kernel; KY Srinivasan; Haiyang Zhang; de...@linuxdriverproject.org; netdev Subject: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c Building with the attached random configuration file, drivers/net/hyperv/netvsc_drv.c: In function ‘netvsc_recv_callback’: drivers/net/hyperv/netvsc_drv.c:648:11: error: ‘struct net_device’ has no member named ‘real_num_rx_queues’ net-real_num_rx_queues); ^ In file included from drivers/net/hyperv/netvsc_drv.c:26:0: drivers/net/hyperv/netvsc_drv.c: In function ‘netvsc_probe’: drivers/net/hyperv/netvsc_drv.c:832:32: error: ‘struct net_device’ has no member named ‘real_num_rx_queues’ net-real_num_tx_queues, net-real_num_rx_queues); ^ include/linux/device.h:1080:58: note: in definition of macro ‘dev_info’ #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) ^ make[3]: *** [drivers/net/hyperv/netvsc_drv.o] Error 1 real_num_rx_queues is defined in include/linux/netdevice.h: It requires CONFIG_SYSFS flag, which is enabled by default, but not set in your config file. Could you use default config and add hyperv drivers, then try again? Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c
-Original Message- From: KY Srinivasan Sent: Friday, May 2, 2014 11:00 AM To: Haiyang Zhang; Jim Davis; Stephen Rothwell; linux-next; linux-kernel; de...@linuxdriverproject.org; netdev Subject: RE: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c -Original Message- From: Haiyang Zhang Sent: Friday, May 2, 2014 7:42 AM To: Jim Davis; Stephen Rothwell; linux-next; linux-kernel; KY Srinivasan; de...@linuxdriverproject.org; netdev Subject: RE: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c -Original Message- From: Jim Davis [mailto:jim.ep...@gmail.com] Sent: Friday, May 2, 2014 9:56 AM To: Stephen Rothwell; linux-next; linux-kernel; KY Srinivasan; Haiyang Zhang; de...@linuxdriverproject.org; netdev Subject: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c Building with the attached random configuration file, drivers/net/hyperv/netvsc_drv.c: In function ‘netvsc_recv_callback’: drivers/net/hyperv/netvsc_drv.c:648:11: error: ‘struct net_device’ has no member named ‘real_num_rx_queues’ net-real_num_rx_queues); ^ In file included from drivers/net/hyperv/netvsc_drv.c:26:0: drivers/net/hyperv/netvsc_drv.c: In function ‘netvsc_probe’: drivers/net/hyperv/netvsc_drv.c:832:32: error: ‘struct net_device’ has no member named ‘real_num_rx_queues’ net-real_num_tx_queues, net-real_num_rx_queues); ^ include/linux/device.h:1080:58: note: in definition of macro ‘dev_info’ #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) ^ make[3]: *** [drivers/net/hyperv/netvsc_drv.o] Error 1 real_num_rx_queues is defined in include/linux/netdevice.h: It requires CONFIG_SYSFS flag, which is enabled by default, but not set in your config file. Could you use default config and add hyperv drivers, then try again? Haiyang, That is the point - the code must compile correctly for all possible configurations. You will want to protect the dependencies appropriately. OK, I'll look into this. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Friday, May 2, 2014 3:19 PM To: Haiyang Zhang Cc: jim.ep...@gmail.com; s...@canb.auug.org.au; linux- n...@vger.kernel.org; linux-ker...@vger.kernel.org; KY Srinivasan; de...@linuxdriverproject.org; net...@vger.kernel.org Subject: Re: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c From: Haiyang Zhang haiya...@microsoft.com Date: Fri, 2 May 2014 14:42:06 + real_num_rx_queues is defined in include/linux/netdevice.h: It requires CONFIG_SYSFS flag, which is enabled by default, but not set in your config file. Could you use default config and add hyperv drivers, then try again? You must fix your driver to compile successfully under all possible configuration combinations, not just the ones which are convenient for you to support. OK, I'll look into this. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Friday, May 2, 2014 3:19 PM To: Haiyang Zhang Cc: jim.ep...@gmail.com; s...@canb.auug.org.au; linux-n...@vger.kernel.org; linux-ker...@vger.kernel.org; KY Srinivasan; de...@linuxdriverproject.org; net...@vger.kernel.org Subject: Re: randconfig build error with next-20140502, in drivers/net/hyperv/netvsc_drv.c From: Haiyang Zhang haiya...@microsoft.com Date: Fri, 2 May 2014 14:42:06 + real_num_rx_queues is defined in include/linux/netdevice.h: It requires CONFIG_SYSFS flag, which is enabled by default, but not set in your config file. Could you use default config and add hyperv drivers, then try again? You must fix your driver to compile successfully under all possible configuration combinations, not just the ones which are convenient for you to support. I have submitted a patch to support compiling it without CONFIG_SYSFS flag. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] Add support for netvsc build without CONFIG_SYSFS flag
-Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Thursday, May 8, 2014 5:13 AM To: Haiyang Zhang Cc: da...@davemloft.net; net...@vger.kernel.org; o...@aepfle.de; jasow...@redhat.com; driverdev-devel@linuxdriverproject.org; linux- ker...@vger.kernel.org Subject: Re: [PATCH net-next] Add support for netvsc build without CONFIG_SYSFS flag On Wed, May 07, 2014 at 03:45:04PM -0700, Haiyang Zhang wrote: This change ensures the driver can be built successfully without the CONFIG_SYSFS flag. MS-TFS: 182270 Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h |2 ++ drivers/net/hyperv/netvsc_drv.c | 12 +++- drivers/net/hyperv/rndis_filter.c |4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 4b7df5a..23b96bc 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -87,6 +87,8 @@ struct ndis_recv_scale_cap { /* NDIS_RECEIVE_SCALE_CAPABILITIES */ #define HASH_KEYLEN NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 extern u8 netvsc_hash_key[]; +extern unsigned int netvsc_num_queue; + struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */ struct ndis_obj_header hdr; diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 939e3af..07896f3 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -52,6 +52,8 @@ static int ring_size = 128; module_param(ring_size, int, S_IRUGO); MODULE_PARM_DESC(ring_size, Ring buffer size (# of pages)); +unsigned int netvsc_num_queue = 1; + static void do_set_multicast(struct work_struct *w) { struct net_device_context *ndevctx = @@ -639,9 +641,11 @@ int netvsc_recv_callback(struct hv_device *device_obj, __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), packet-vlan_tci); +#ifdef CONFIG_SYSFS skb_record_rx_queue(skb, packet-channel- offermsg.offer.sub_channel_index % net-real_num_rx_queues); +#endif Why is this a sysfs-only function? It should have nothing to do with sysfs, right? So why would the driver care? Without CONFIG_SYSFS the multi-receive queues are not allocated, see below, and the variable real_num_rx_queues is not defined, so we skip this function. In alloc_netdev_mqs(), file net/core/dev.c: #ifdef CONFIG_SYSFS dev-num_rx_queues = rxqs; dev-real_num_rx_queues = rxqs; if (netif_alloc_rx_queues(dev)) goto free_all; #endif Don't put #ifdef in drivers, it's unmaintainable over time, if this really is a sysfs- only function, this should already be handled automatically in a .h file somewhere. OK, I will move the #ifdef into hyperv_net.h. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next, v2] Add support for netvsc build without CONFIG_SYSFS flag
This change ensures the driver can be built successfully without the CONFIG_SYSFS flag. MS-TFS: 182270 Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h | 28 drivers/net/hyperv/netvsc_drv.c | 13 +++-- drivers/net/hyperv/rndis_filter.c |4 ++-- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 4b7df5a..02358cb 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -87,6 +87,8 @@ struct ndis_recv_scale_cap { /* NDIS_RECEIVE_SCALE_CAPABILITIES */ #define HASH_KEYLEN NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 extern u8 netvsc_hash_key[]; +extern unsigned int netvsc_num_queue; + struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */ struct ndis_obj_header hdr; @@ -178,6 +180,32 @@ struct rndis_device { unsigned char hw_mac_adr[ETH_ALEN]; }; +static inline void netvsc_record_rx_queue(struct sk_buff *skb, + struct hv_netvsc_packet *packet, + struct net_device *ndev) +{ +#ifdef CONFIG_SYSFS + skb_record_rx_queue(skb, packet-channel- + offermsg.offer.sub_channel_index % + ndev-real_num_rx_queues); +#endif +} + +static inline void netvsc_show_num_queue(struct device *dev, +struct net_device *ndev) +{ +#ifdef CONFIG_SYSFS + dev_info(dev, real num tx,rx queues:%u, %u\n, +ndev-real_num_tx_queues, ndev-real_num_rx_queues); +#endif +} + +static inline void netvsc_set_num_queue(unsigned int *nq) +{ +#ifdef CONFIG_SYSFS + *nq = num_online_cpus(); +#endif +} /* Interface */ int netvsc_device_add(struct hv_device *device, void *additional_info); diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 939e3af..11794a0 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -52,6 +52,8 @@ static int ring_size = 128; module_param(ring_size, int, S_IRUGO); MODULE_PARM_DESC(ring_size, Ring buffer size (# of pages)); +unsigned int netvsc_num_queue = 1; + static void do_set_multicast(struct work_struct *w) { struct net_device_context *ndevctx = @@ -639,9 +641,7 @@ int netvsc_recv_callback(struct hv_device *device_obj, __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), packet-vlan_tci); - skb_record_rx_queue(skb, packet-channel- - offermsg.offer.sub_channel_index % - net-real_num_rx_queues); + netvsc_record_rx_queue(skb, packet, net); net-stats.rx_packets++; net-stats.rx_bytes += packet-total_data_buflen; @@ -788,7 +788,7 @@ static int netvsc_probe(struct hv_device *dev, int ret; net = alloc_etherdev_mq(sizeof(struct net_device_context), - num_online_cpus()); + netvsc_num_queue); if (!net) return -ENOMEM; @@ -824,8 +824,7 @@ static int netvsc_probe(struct hv_device *dev, nvdev = hv_get_drvdata(dev); netif_set_real_num_tx_queues(net, nvdev-num_chn); netif_set_real_num_rx_queues(net, nvdev-num_chn); - dev_info(dev-device, real num tx,rx queues:%u, %u\n, -net-real_num_tx_queues, net-real_num_rx_queues); + netvsc_show_num_queue(dev-device, net); ret = register_netdev(net); if (ret != 0) { @@ -897,6 +896,8 @@ static void __exit netvsc_drv_exit(void) static int __init netvsc_drv_init(void) { + netvsc_set_num_queue(netvsc_num_queue); + if (ring_size RING_SIZE_MIN) { ring_size = RING_SIZE_MIN; pr_info(Increased ring_size to %d (min allowed)\n, diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 99c527a..9db163c 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -1094,8 +1094,8 @@ int rndis_filter_device_add(struct hv_device *dev, if (ret || rsscap.num_recv_que 2) goto out; - net_device-num_chn = (num_online_cpus() rsscap.num_recv_que) ? - num_online_cpus() : rsscap.num_recv_que; + net_device-num_chn = (netvsc_num_queue rsscap.num_recv_que) ? + netvsc_num_queue : rsscap.num_recv_que; if (net_device-num_chn == 1) goto out; -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next] Add support for netvsc build without CONFIG_SYSFS flag
-Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Thursday, May 8, 2014 3:07 PM To: Haiyang Zhang Cc: da...@davemloft.net; net...@vger.kernel.org; o...@aepfle.de; jasow...@redhat.com; driverdev-devel@linuxdriverproject.org; linux- ker...@vger.kernel.org Subject: Re: [PATCH net-next] Add support for netvsc build without CONFIG_SYSFS flag On Thu, May 08, 2014 at 03:13:19PM +, Haiyang Zhang wrote: -Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Thursday, May 8, 2014 5:13 AM To: Haiyang Zhang Cc: da...@davemloft.net; net...@vger.kernel.org; o...@aepfle.de; jasow...@redhat.com; driverdev-devel@linuxdriverproject.org; linux- ker...@vger.kernel.org Subject: Re: [PATCH net-next] Add support for netvsc build without CONFIG_SYSFS flag On Wed, May 07, 2014 at 03:45:04PM -0700, Haiyang Zhang wrote: This change ensures the driver can be built successfully without the CONFIG_SYSFS flag. MS-TFS: 182270 Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h |2 ++ drivers/net/hyperv/netvsc_drv.c | 12 +++- drivers/net/hyperv/rndis_filter.c |4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 4b7df5a..23b96bc 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -87,6 +87,8 @@ struct ndis_recv_scale_cap { /* NDIS_RECEIVE_SCALE_CAPABILITIES */ #define HASH_KEYLEN NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 extern u8 netvsc_hash_key[]; +extern unsigned int netvsc_num_queue; + struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */ struct ndis_obj_header hdr; diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 939e3af..07896f3 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -52,6 +52,8 @@ static int ring_size = 128; module_param(ring_size, int, S_IRUGO); MODULE_PARM_DESC(ring_size, Ring buffer size (# of pages)); +unsigned int netvsc_num_queue = 1; + static void do_set_multicast(struct work_struct *w) { struct net_device_context *ndevctx = @@ -639,9 +641,11 @@ int netvsc_recv_callback(struct hv_device *device_obj, __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), packet-vlan_tci); +#ifdef CONFIG_SYSFS skb_record_rx_queue(skb, packet-channel- offermsg.offer.sub_channel_index % net-real_num_rx_queues); +#endif Why is this a sysfs-only function? It should have nothing to do with sysfs, right? So why would the driver care? Without CONFIG_SYSFS the multi-receive queues are not allocated, see below, and the variable real_num_rx_queues is not defined, so we skip this function. In alloc_netdev_mqs(), file net/core/dev.c: #ifdef CONFIG_SYSFS dev-num_rx_queues = rxqs; dev-real_num_rx_queues = rxqs; if (netif_alloc_rx_queues(dev)) goto free_all; #endif Then you need to structure your driver better :) I have submitted an update patch. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next, v2] Add support for netvsc build without CONFIG_SYSFS flag
-Original Message- From: Greg KH [mailto:g...@kroah.com] Sent: Thursday, May 8, 2014 4:04 PM To: Haiyang Zhang Cc: da...@davemloft.net; net...@vger.kernel.org; o...@aepfle.de; jasow...@redhat.com; driverdev-devel@linuxdriverproject.org; linux- ker...@vger.kernel.org Subject: Re: [PATCH net-next, v2] Add support for netvsc build without CONFIG_SYSFS flag On Thu, May 08, 2014 at 01:41:33PM -0700, Haiyang Zhang wrote: This change ensures the driver can be built successfully without the CONFIG_SYSFS flag. MS-TFS: 182270 Signed-off-by: Haiyang Zhang haiya...@microsoft.com Reviewed-by: K. Y. Srinivasan k...@microsoft.com --- drivers/net/hyperv/hyperv_net.h | 28 drivers/net/hyperv/netvsc_drv.c | 13 +++-- drivers/net/hyperv/rndis_filter.c |4 ++-- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 4b7df5a..02358cb 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -87,6 +87,8 @@ struct ndis_recv_scale_cap { /* NDIS_RECEIVE_SCALE_CAPABILITIES */ #define HASH_KEYLEN NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 extern u8 netvsc_hash_key[]; +extern unsigned int netvsc_num_queue; + struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */ struct ndis_obj_header hdr; @@ -178,6 +180,32 @@ struct rndis_device { unsigned char hw_mac_adr[ETH_ALEN]; }; +static inline void netvsc_record_rx_queue(struct sk_buff *skb, + struct hv_netvsc_packet *packet, + struct net_device *ndev) +{ +#ifdef CONFIG_SYSFS + skb_record_rx_queue(skb, packet-channel- + offermsg.offer.sub_channel_index % + ndev-real_num_rx_queues); +#endif Really? Do all other wireless drivers have this type of #ifdef needed? +} + +static inline void netvsc_show_num_queue(struct device *dev, +struct net_device *ndev) +{ +#ifdef CONFIG_SYSFS + dev_info(dev, real num tx,rx queues:%u, %u\n, +ndev-real_num_tx_queues, ndev-real_num_rx_queues); #endif Do network drivers really spam the kernel log with this type of thing? If you have sysfs, why is this needed in the kernel log? +} + +static inline void netvsc_set_num_queue(unsigned int *nq) { #ifdef +CONFIG_SYSFS + *nq = num_online_cpus(); +#endif +} I really feel that something is odd here... I looked around the other drivers, and the netif_set_real_num_rx_queues() function. It's already switched to no-op without CONFIG_SYSFS flag. So I will rely on this, and don't have to handle the flag in my code. Also, the dev_info can be removed. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next,v2] Add support for netvsc build without CONFIG_SYSFS flag
-Original Message- From: David Miller [mailto:da...@davemloft.net] Sent: Thursday, May 8, 2014 4:45 PM To: Haiyang Zhang Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- de...@linuxdriverproject.org Subject: Re: [PATCH net-next,v2] Add support for netvsc build without CONFIG_SYSFS flag From: Haiyang Zhang haiya...@microsoft.com Date: Thu, 8 May 2014 13:41:33 -0700 +static inline void netvsc_record_rx_queue(struct sk_buff *skb, + struct hv_netvsc_packet *packet, + struct net_device *ndev) +{ +#ifdef CONFIG_SYSFS + skb_record_rx_queue(skb, packet-channel- + offermsg.offer.sub_channel_index % + ndev-real_num_rx_queues); +#endif +} This is still fantastically gross, what is so unique about your driver that it needs hacks like this? No other driver to my knowledge does. Figure out what it is that makes your driver so unique, and try to make it conform to how other drivers handle these features without SYSFS ifdef'ery instead. I looked around the other drivers, and the netif_set_real_num_rx_queues() function. It's already switched to no-op without CONFIG_SYSFS flag. So I will rely on this, and don't have to handle the flag in my code. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next,v2] Add support for netvsc build without CONFIG_SYSFS flag
From: Ben Hutchings b...@decadent.org.uk Sent: Sunday, May 11, 2014 9:07 AM To: Haiyang Zhang I think most other drivers have a 1-1 mapping between hardware RX queues and the RX queue indices reported to Linux. It appears that in this case sub_channel_index is the 'hardware' queue number, but you think there is not a 1-1 mapping. Why is that? Actually, it is 1-1 mapping. The number of channels equals to the number of queues. In my updated patch (v3) the unnecessary % ndev-real_num_rx_queues has been removed. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next] Add hash value into RNDIS Per-packet info
It passes the hash value as the RNDIS Per-packet info to the Hyper-V host, so that the send completion notices can be spread across multiple channels. MS-TFS: 140273 Signed-off-by: Haiyang Zhang haiya...@microsoft.com --- drivers/net/hyperv/hyperv_net.h |4 drivers/net/hyperv/netvsc_drv.c | 18 ++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 4b7df5a..6cc37c1 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -791,6 +791,7 @@ enum ndis_per_pkt_info_type { IEEE_8021Q_INFO, ORIGINAL_PKTINFO, PACKET_CANCEL_ID, + NBL_HASH_VALUE = PACKET_CANCEL_ID, ORIGINAL_NET_BUFLIST, CACHED_NET_BUFLIST, SHORT_PKT_PADINFO, @@ -937,6 +938,9 @@ struct ndis_tcp_lso_info { #define NDIS_LSO_PPI_SIZE (sizeof(struct rndis_per_packet_info) + \ sizeof(struct ndis_tcp_lso_info)) +#define NDIS_HASH_PPI_SIZE (sizeof(struct rndis_per_packet_info) + \ + sizeof(u32)) + /* Format of Information buffer passed in a SetRequest for the OID */ /* OID_GEN_RNDIS_CONFIG_PARAMETER. */ struct rndis_config_parameter_info { diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 2e967a7..4fd71b7 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -224,9 +224,11 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb, if (nvsc_dev == NULL || ndev-real_num_tx_queues = 1) return 0; - if (netvsc_set_hash(hash, skb)) + if (netvsc_set_hash(hash, skb)) { q_idx = nvsc_dev-send_table[hash % VRSS_SEND_TAB_SIZE] % ndev-real_num_tx_queues; + skb_set_hash(skb, hash, PKT_HASH_TYPE_L3); + } return q_idx; } @@ -384,6 +386,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) struct ndis_tcp_lso_info *lso_info; int hdr_offset; u32 net_trans_info; + u32 hash; /* We will atmost need two pages to describe the rndis @@ -402,9 +405,8 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) packet = kzalloc(sizeof(struct hv_netvsc_packet) + (num_data_pgs * sizeof(struct hv_page_buffer)) + sizeof(struct rndis_message) + -NDIS_VLAN_PPI_SIZE + -NDIS_CSUM_PPI_SIZE + -NDIS_LSO_PPI_SIZE, GFP_ATOMIC); +NDIS_VLAN_PPI_SIZE + NDIS_CSUM_PPI_SIZE + +NDIS_LSO_PPI_SIZE + NDIS_HASH_PPI_SIZE, GFP_ATOMIC); if (!packet) { /* out of memory, drop packet */ netdev_err(net, unable to allocate hv_netvsc_packet\n); @@ -443,6 +445,14 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) rndis_msg_size = RNDIS_MESSAGE_SIZE(struct rndis_packet); + hash = skb_get_hash_raw(skb); + if (hash != 0 net-real_num_tx_queues 1) { + rndis_msg_size += NDIS_HASH_PPI_SIZE; + ppi = init_ppi_data(rndis_msg, NDIS_HASH_PPI_SIZE, + NBL_HASH_VALUE); + *(u32 *)((void *)ppi + ppi-ppi_offset) = hash; + } + if (isvlan) { struct ndis_pkt_8021q_info *vlan; -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel