RE: [PATCH net,1/1] hyperv: Add support for setting MAC from within guests

2012-07-30 Thread Haiyang Zhang


> -Original Message-
> From: Olaf Hering [mailto:o...@aepfle.de]
> Sent: Monday, July 30, 2012 8:39 AM
> To: Haiyang Zhang
> Cc: da...@davemloft.net; net...@vger.kernel.org; KY Srinivasan; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org
> Subject: Re: [PATCH net,1/1] hyperv: Add support for setting MAC from
> within guests
> 
> On Tue, Jul 10, Haiyang Zhang wrote:
> 
> > diff --git a/drivers/net/hyperv/rndis_filter.c
> > b/drivers/net/hyperv/rndis_filter.c
> > index 981ebb1..fbf5394 100644
> > --- a/drivers/net/hyperv/rndis_filter.c
> > +++ b/drivers/net/hyperv/rndis_filter.c
> > @@ -47,6 +48,7 @@ struct rndis_request {
> > struct hv_page_buffer buf;
> > /* FIXME: We assumed a fixed size request here. */
> > struct rndis_message request_msg;
> > +   u8 ext[100];
> 
> This array is not referenced in the patch.
> Please add a comment to the code what the purpose of this array is, and why
> its size is 100 bytes.

It's a buffer for the extended info after the RNDIS message. It's referenced 
based
on the data offset in the RNDIS message. 100 byte size is enough for current 
needs, 
and should be sufficient for the near future.

I will add a comment to the code.

Thanks,
- Haiyang



Re: [PATCH net,1/1] hyperv: Add support for setting MAC from within guests

2012-07-30 Thread Olaf Hering
On Tue, Jul 10, Haiyang Zhang wrote:

> diff --git a/drivers/net/hyperv/rndis_filter.c 
> b/drivers/net/hyperv/rndis_filter.c
> index 981ebb1..fbf5394 100644
> --- a/drivers/net/hyperv/rndis_filter.c
> +++ b/drivers/net/hyperv/rndis_filter.c
> @@ -47,6 +48,7 @@ struct rndis_request {
>   struct hv_page_buffer buf;
>   /* FIXME: We assumed a fixed size request here. */
>   struct rndis_message request_msg;
> + u8 ext[100];

This array is not referenced in the patch.
Please add a comment to the code what the purpose of this array is, and
why its size is 100 bytes.

Thanks.

Olaf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH net,1/1] hyperv: Add support for setting MAC from within guests

2012-07-16 Thread David Miller
From: Haiyang Zhang 
Date: Tue, 10 Jul 2012 10:19:22 -0700

> This adds support for setting synthetic NIC MAC address from within Linux
> guests. Before using this feature, the option "spoofing of MAC address"
> should be enabled at the Hyper-V manager / Settings of the synthetic
> NIC.
> 
> Thanks to Kin Cho  for the initial implementation and
> tests. And, thanks to Long Li  for the debugging
> works.
> 
> Reported-and-tested-by: Kin Cho 
> Reported-by: Long Li 
> Signed-off-by: Haiyang Zhang 
> Reviewed-by: K. Y. Srinivasan 

Applied to net-next, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH net,1/1] hyperv: Add support for setting MAC from within guests

2012-07-10 Thread Ben Hutchings
On Tue, 2012-07-10 at 17:03 +, Haiyang Zhang wrote:
> 
> > -Original Message-
> > From: Ben Hutchings [mailto:bhutchi...@solarflare.com]
> > Sent: Friday, July 06, 2012 8:19 PM
> > To: Haiyang Zhang
> > Cc: da...@davemloft.net; net...@vger.kernel.org; KY Srinivasan;
> > o...@aepfle.de; linux-kernel@vger.kernel.org;
> > de...@linuxdriverproject.org
> > Subject: Re: [PATCH net,1/1] hyperv: Add support for setting MAC from
> > within guests
> > 
> > On Fri, 2012-07-06 at 14:25 -0700, Haiyang Zhang wrote:
> > > This adds support for setting synthetic NIC MAC address from within
> > Linux
> > > guests. Before using this feature, the option "spoofing of MAC
> > address"
> > > should be enabled at the Hyper-V manager / Settings of the synthetic
> > > NIC.
> > [...]
> > > +int rndis_filter_set_device_mac(struct hv_device *hdev, char *mac)
> > > +{
> > [...]
> > > + t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
> > > + if (t == 0) {
> > > + netdev_err(ndev, "timeout before we got a set
> > response...\n");
> > > + /*
> > > +  * can't put_rndis_request, since we may still receive a
> > > +  * send-completion.
> > > +  */
> > > + return -EBUSY;
> > > + } else {
> > > + set_complete = &request->response_msg.msg.set_complete;
> > > + if (set_complete->status != RNDIS_STATUS_SUCCESS)
> > > + ret = -EINVAL;
> > [...]
> > 
> > Is there a specific error code that indicates the hypervisor is
> > configured not to allow MAC address changes?  If so, shouldn't that be
> > translated to return EPERM rather than EINVAL?
> 
> I have check the return code, 0xc00d, which is returned both when MAC
> spoofing is not enabled or the parameter contains other errors. So we can't
> tell if it permission error or not. I will re-submit this patch still
> using EINVAL.

Oh well, thanks for trying!

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH net,1/1] hyperv: Add support for setting MAC from within guests

2012-07-10 Thread Haiyang Zhang


> -Original Message-
> From: Ben Hutchings [mailto:bhutchi...@solarflare.com]
> Sent: Friday, July 06, 2012 8:19 PM
> To: Haiyang Zhang
> Cc: da...@davemloft.net; net...@vger.kernel.org; KY Srinivasan;
> o...@aepfle.de; linux-kernel@vger.kernel.org;
> de...@linuxdriverproject.org
> Subject: Re: [PATCH net,1/1] hyperv: Add support for setting MAC from
> within guests
> 
> On Fri, 2012-07-06 at 14:25 -0700, Haiyang Zhang wrote:
> > This adds support for setting synthetic NIC MAC address from within
> Linux
> > guests. Before using this feature, the option "spoofing of MAC
> address"
> > should be enabled at the Hyper-V manager / Settings of the synthetic
> > NIC.
> [...]
> > +int rndis_filter_set_device_mac(struct hv_device *hdev, char *mac)
> > +{
> [...]
> > +   t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
> > +   if (t == 0) {
> > +   netdev_err(ndev, "timeout before we got a set
> response...\n");
> > +   /*
> > +* can't put_rndis_request, since we may still receive a
> > +* send-completion.
> > +*/
> > +   return -EBUSY;
> > +   } else {
> > +   set_complete = &request->response_msg.msg.set_complete;
> > +   if (set_complete->status != RNDIS_STATUS_SUCCESS)
> > +   ret = -EINVAL;
> [...]
> 
> Is there a specific error code that indicates the hypervisor is
> configured not to allow MAC address changes?  If so, shouldn't that be
> translated to return EPERM rather than EINVAL?

I have check the return code, 0xc00d, which is returned both when MAC
spoofing is not enabled or the parameter contains other errors. So we can't
tell if it permission error or not. I will re-submit this patch still
using EINVAL.

Thanks,
- Haiyang



RE: [PATCH net,1/1] hyperv: Add support for setting MAC from within guests

2012-07-07 Thread Haiyang Zhang


> -Original Message-
> From: Ben Hutchings [mailto:bhutchi...@solarflare.com]
> Sent: Friday, July 06, 2012 8:19 PM
> To: Haiyang Zhang
> Cc: da...@davemloft.net; net...@vger.kernel.org; KY Srinivasan;
> o...@aepfle.de; linux-kernel@vger.kernel.org; de...@linuxdriverproject.org
> Subject: Re: [PATCH net,1/1] hyperv: Add support for setting MAC from
> within guests
> 
> On Fri, 2012-07-06 at 14:25 -0700, Haiyang Zhang wrote:
> > This adds support for setting synthetic NIC MAC address from within
> > Linux guests. Before using this feature, the option "spoofing of MAC
> address"
> > should be enabled at the Hyper-V manager / Settings of the synthetic
> > NIC.
> [...]
> > +int rndis_filter_set_device_mac(struct hv_device *hdev, char *mac) {
> [...]
> > +   t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
> > +   if (t == 0) {
> > +   netdev_err(ndev, "timeout before we got a set
> response...\n");
> > +   /*
> > +* can't put_rndis_request, since we may still receive a
> > +* send-completion.
> > +*/
> > +   return -EBUSY;
> > +   } else {
> > +   set_complete = &request->response_msg.msg.set_complete;
> > +   if (set_complete->status != RNDIS_STATUS_SUCCESS)
> > +   ret = -EINVAL;
> [...]
> 
> Is there a specific error code that indicates the hypervisor is configured not
> to allow MAC address changes?  If so, shouldn't that be translated to return
> EPERM rather than EINVAL?

Will do. 

Thanks,
- Haiyang

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

Re: [PATCH net,1/1] hyperv: Add support for setting MAC from within guests

2012-07-06 Thread Ben Hutchings
On Fri, 2012-07-06 at 14:25 -0700, Haiyang Zhang wrote:
> This adds support for setting synthetic NIC MAC address from within Linux
> guests. Before using this feature, the option "spoofing of MAC address"
> should be enabled at the Hyper-V manager / Settings of the synthetic
> NIC.
[...]
> +int rndis_filter_set_device_mac(struct hv_device *hdev, char *mac)
> +{
[...]
> + t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
> + if (t == 0) {
> + netdev_err(ndev, "timeout before we got a set response...\n");
> + /*
> +  * can't put_rndis_request, since we may still receive a
> +  * send-completion.
> +  */
> + return -EBUSY;
> + } else {
> + set_complete = &request->response_msg.msg.set_complete;
> + if (set_complete->status != RNDIS_STATUS_SUCCESS)
> + ret = -EINVAL;
[...]

Is there a specific error code that indicates the hypervisor is
configured not to allow MAC address changes?  If so, shouldn't that be
translated to return EPERM rather than EINVAL?

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/