* [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c
@ 2011-11-30 15:19 Haiyang Zhang
2011-11-30 15:19 ` [PATCH 2/2] net/hyperv: Add support for promiscuous mode setting Haiyang Zhang
2011-11-30 17:36 ` [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Haiyang Zhang @ 2011-11-30 15:19 UTC (permalink / raw)
To: haiyangz, kys, davem, gregkh, linux-kernel, netdev, devel
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/net/hyperv/netvsc.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 28e69a6..4a807e4 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -230,9 +230,11 @@ static int netvsc_init_recv_buf(struct hv_device *device)
net_device->recv_section_cnt = init_packet->msg.
v1_msg.send_recv_buf_complete.num_sections;
- net_device->recv_section = kmemdup(init_packet->msg.v1_msg.send_recv_buf_complete.sections,
- net_device->recv_section_cnt * sizeof(struct nvsp_1_receive_buffer_section),
- GFP_KERNEL);
+ net_device->recv_section = kmemdup(
+ init_packet->msg.v1_msg.send_recv_buf_complete.sections,
+ net_device->recv_section_cnt *
+ sizeof(struct nvsp_1_receive_buffer_section),
+ GFP_KERNEL);
if (net_device->recv_section == NULL) {
ret = -EINVAL;
goto cleanup;
--
1.7.4.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] net/hyperv: Add support for promiscuous mode setting
2011-11-30 15:19 [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c Haiyang Zhang
@ 2011-11-30 15:19 ` Haiyang Zhang
2011-11-30 17:36 ` [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c David Miller
1 sibling, 0 replies; 5+ messages in thread
From: Haiyang Zhang @ 2011-11-30 15:19 UTC (permalink / raw)
To: haiyangz, kys, davem, gregkh, linux-kernel, netdev, devel
Add code to accept promiscuous mode setting, and pass it to
RNDIS filter.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/net/hyperv/hyperv_net.h | 24 +++++++++++++++++++
drivers/net/hyperv/netvsc_drv.c | 46 ++++++++++++++++++++++++++++++++++--
drivers/net/hyperv/rndis_filter.c | 23 +-----------------
3 files changed, 68 insertions(+), 25 deletions(-)
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index ac1ec84..49b131f 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -87,6 +87,27 @@ struct netvsc_device_info {
int ring_size;
};
+enum rndis_device_state {
+ RNDIS_DEV_UNINITIALIZED = 0,
+ RNDIS_DEV_INITIALIZING,
+ RNDIS_DEV_INITIALIZED,
+ RNDIS_DEV_DATAINITIALIZED,
+};
+
+struct rndis_device {
+ struct netvsc_device *net_dev;
+
+ enum rndis_device_state state;
+ bool link_state;
+ atomic_t new_req_id;
+
+ spinlock_t request_lock;
+ struct list_head req_list;
+
+ unsigned char hw_mac_adr[ETH_ALEN];
+};
+
+
/* Interface */
int netvsc_device_add(struct hv_device *device, void *additional_info);
int netvsc_device_remove(struct hv_device *device);
@@ -109,6 +130,9 @@ int rndis_filter_receive(struct hv_device *dev,
int rndis_filter_send(struct hv_device *dev,
struct hv_netvsc_packet *pkt);
+int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter);
+
+
#define NVSP_INVALID_PROTOCOL_VERSION ((u32)0xFFFFFFFF)
#define NVSP_PROTOCOL_VERSION_1 2
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 93b0e91..b69c3a4 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -56,11 +56,51 @@ static int ring_size = 128;
module_param(ring_size, int, S_IRUGO);
MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
-/* no-op so the netdev core doesn't return -EINVAL when modifying the the
- * multicast address list in SIOCADDMULTI. hv is setup to get all multicast
- * when it calls RndisFilterOnOpen() */
+struct set_multicast_work {
+ struct work_struct work;
+ struct net_device *net;
+};
+
+static void do_set_multicast(struct work_struct *w)
+{
+ struct set_multicast_work *swk =
+ container_of(w, struct set_multicast_work, work);
+ struct net_device *net = swk->net;
+
+ struct net_device_context *ndevctx = netdev_priv(net);
+ struct netvsc_device *nvdev;
+ struct rndis_device *rdev;
+
+ nvdev = hv_get_drvdata(ndevctx->device_ctx);
+ if (nvdev == NULL)
+ return;
+
+ rdev = nvdev->extension;
+ if (rdev == NULL)
+ return;
+
+ if (net->flags & IFF_PROMISC)
+ rndis_filter_set_packet_filter(rdev,
+ NDIS_PACKET_TYPE_PROMISCUOUS);
+ else
+ rndis_filter_set_packet_filter(rdev,
+ NDIS_PACKET_TYPE_BROADCAST |
+ NDIS_PACKET_TYPE_ALL_MULTICAST |
+ NDIS_PACKET_TYPE_DIRECTED);
+
+ kfree(w);
+}
+
static void netvsc_set_multicast_list(struct net_device *net)
{
+ struct set_multicast_work *swk =
+ kmalloc(sizeof(struct set_multicast_work), GFP_ATOMIC);
+ if (swk == NULL)
+ return;
+
+ swk->net = net;
+ INIT_WORK(&swk->work, do_set_multicast);
+ schedule_work(&swk->work);
}
static int netvsc_open(struct net_device *net)
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index bafccb3..418e7aa 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -30,26 +30,6 @@
#include "hyperv_net.h"
-enum rndis_device_state {
- RNDIS_DEV_UNINITIALIZED = 0,
- RNDIS_DEV_INITIALIZING,
- RNDIS_DEV_INITIALIZED,
- RNDIS_DEV_DATAINITIALIZED,
-};
-
-struct rndis_device {
- struct netvsc_device *net_dev;
-
- enum rndis_device_state state;
- bool link_state;
- atomic_t new_req_id;
-
- spinlock_t request_lock;
- struct list_head req_list;
-
- unsigned char hw_mac_adr[ETH_ALEN];
-};
-
struct rndis_request {
struct list_head list_ent;
struct completion wait_event;
@@ -522,8 +502,7 @@ static int rndis_filter_query_device_link_status(struct rndis_device *dev)
return ret;
}
-static int rndis_filter_set_packet_filter(struct rndis_device *dev,
- u32 new_filter)
+int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter)
{
struct rndis_request *request;
struct rndis_set_request *set;
--
1.7.4.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c
2011-11-30 15:19 [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c Haiyang Zhang
2011-11-30 15:19 ` [PATCH 2/2] net/hyperv: Add support for promiscuous mode setting Haiyang Zhang
@ 2011-11-30 17:36 ` David Miller
2011-11-30 19:13 ` Haiyang Zhang
1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2011-11-30 17:36 UTC (permalink / raw)
To: haiyangz; +Cc: kys, gregkh, linux-kernel, netdev, devel
Well, since Greg's tree is where the staging move happened, he'll have
to take any patches to this driver that happen now, rather than me.
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c
2011-11-30 17:36 ` [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c David Miller
@ 2011-11-30 19:13 ` Haiyang Zhang
2011-11-30 21:57 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Haiyang Zhang @ 2011-11-30 19:13 UTC (permalink / raw)
To: David Miller; +Cc: KY Srinivasan, gregkh, linux-kernel, netdev, devel
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Wednesday, November 30, 2011 12:36 PM
> To: Haiyang Zhang
> Cc: KY Srinivasan; gregkh@suse.de; linux-kernel@vger.kernel.org;
> netdev@vger.kernel.org; devel@linuxdriverproject.org
> Subject: Re: [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c
>
>
> Well, since Greg's tree is where the staging move happened, he'll have
> to take any patches to this driver that happen now, rather than me.
Sounds good. And, these patches were sent to devel@linuxdriverproject.org
too.
Greg, could you consider these patches for your tree?
Thanks,
- Haiyang
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c
2011-11-30 19:13 ` Haiyang Zhang
@ 2011-11-30 21:57 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2011-11-30 21:57 UTC (permalink / raw)
To: Haiyang Zhang; +Cc: David Miller, KY Srinivasan, linux-kernel, netdev, devel
On Wed, Nov 30, 2011 at 07:13:49PM +0000, Haiyang Zhang wrote:
> > -----Original Message-----
> > From: David Miller [mailto:davem@davemloft.net]
> > Sent: Wednesday, November 30, 2011 12:36 PM
> > To: Haiyang Zhang
> > Cc: KY Srinivasan; gregkh@suse.de; linux-kernel@vger.kernel.org;
> > netdev@vger.kernel.org; devel@linuxdriverproject.org
> > Subject: Re: [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c
> >
> >
> > Well, since Greg's tree is where the staging move happened, he'll have
> > to take any patches to this driver that happen now, rather than me.
>
> Sounds good. And, these patches were sent to devel@linuxdriverproject.org
> too.
>
> Greg, could you consider these patches for your tree?
Yes, I'll queue them up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-11-30 22:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-30 15:19 [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c Haiyang Zhang
2011-11-30 15:19 ` [PATCH 2/2] net/hyperv: Add support for promiscuous mode setting Haiyang Zhang
2011-11-30 17:36 ` [PATCH 1/2] net/hyperv: Fix long lines in netvsc.c David Miller
2011-11-30 19:13 ` Haiyang Zhang
2011-11-30 21:57 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®