[PATCH] drivers/staging/rtl8188eu: cleanup crc32_init logic

2017-09-06 Thread Pushkar Jambhlekar
crc32_init is using unnecessary else condition. Cleaningup this function

Signed-off-by: Pushkar Jambhlekar 
---
 drivers/staging/rtl8188eu/core/rtw_security.c | 42 +--
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c 
b/drivers/staging/rtl8188eu/core/rtw_security.c
index b283a490..9d17204 100644
--- a/drivers/staging/rtl8188eu/core/rtw_security.c
+++ b/drivers/staging/rtl8188eu/core/rtw_security.c
@@ -94,29 +94,29 @@ static u8 crc32_reverseBit(u8 data)
 
 static void crc32_init(void)
 {
-   if (bcrc32initialized == 1) {
+   if (bcrc32initialized == 1)
return;
-   } else {
-   int i, j;
-   u32 c;
-   u8 *p = (u8 *), *p1;
-   u8 k;
-
-   c = 0x1234;
-
-   for (i = 0; i < 256; ++i) {
-   k = crc32_reverseBit((u8)i);
-   for (c = ((u32)k) << 24, j = 8; j > 0; --j)
-   c = c & 0x8000 ? (c << 1) ^ CRC32_POLY : (c 
<< 1);
-   p1 = (u8 *)_table[i];
-
-   p1[0] = crc32_reverseBit(p[3]);
-   p1[1] = crc32_reverseBit(p[2]);
-   p1[2] = crc32_reverseBit(p[1]);
-   p1[3] = crc32_reverseBit(p[0]);
-   }
-   bcrc32initialized = 1;
+
+   int i, j;
+   u32 c;
+   u8 *p = (u8 *), *p1;
+   u8 k;
+
+   c = 0x1234;
+
+   for (i = 0; i < 256; ++i) {
+   k = crc32_reverseBit((u8)i);
+   for (c = ((u32)k) << 24, j = 8; j > 0; --j)
+   c = c & 0x8000 ? (c << 1) ^ CRC32_POLY : (c << 1);
+   p1 = (u8 *)_table[i];
+
+   p1[0] = crc32_reverseBit(p[3]);
+   p1[1] = crc32_reverseBit(p[2]);
+   p1[2] = crc32_reverseBit(p[1]);
+   p1[3] = crc32_reverseBit(p[0]);
}
+
+   bcrc32initialized = 1;
 }
 
 static __le32 getcrc32(u8 *buf, int len)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4] Staging: ccree: ssi_cipher.c: Remove unused variable.

2017-09-06 Thread Srishti Sharma
Remove local variable inflight_counter, as it is never used.

Signed-off-by: Srishti Sharma 
---
Change in v4:
 -There is no longer a need to make the comment more comprehensible, as I
  have deleted the variable associated with it. The v3 of this patch was
  not based on the original patch, hence v4.
 drivers/staging/ccree/ssi_cipher.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/ccree/ssi_cipher.c 
b/drivers/staging/ccree/ssi_cipher.c
index 8d31a93..1ff3c8a 100644
--- a/drivers/staging/ccree/ssi_cipher.c
+++ b/drivers/staging/ccree/ssi_cipher.c
@@ -697,13 +697,10 @@ static int ssi_blkcipher_complete(struct device *dev,
  void __iomem *cc_base)
 {
int completion_error = 0;
-   u32 inflight_counter;
struct ablkcipher_request *req = (struct ablkcipher_request *)areq;

ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst);

-   /*Set the inflight couter value to local variable*/
-   inflight_counter =  ctx_p->drvdata->inflight_counter;
/*Decrease the inflight counter*/
if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0)
ctx_p->drvdata->inflight_counter--;
--
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] Staging: ccree: ssi_cipher.c: Remove unused variable.

2017-09-06 Thread Srishti Sharma
On Thu, Sep 7, 2017 at 3:02 AM, Dan Carpenter  wrote:
> Always compile your patches.
>
>   CC [M]  drivers/staging/ccree/ssi_cipher.o
> drivers/staging/ccree/ssi_cipher.c: In function ‘ssi_blkcipher_complete’:
> drivers/staging/ccree/ssi_cipher.c:700:6: warning: unused variable 
> ‘inflight_counter’ [-Wunused-variable]
>   u32 inflight_counter;
>   ^~~~
>
> You need to delete the declaration as well.
>
> Don't be in a rush to resend patches.  I normally write them then let
> them sit in my outbox overnight and send them in the morning.  The extra
> delay helps me to calm down a bit and focus better.  Even though I've
> sent thousands of patches, it sometimes still stresses me out.  It's
> like you're disagreeing with the original author and the reviewers are
> disagreeing with you and everyone's trying to be nice about it but
> patches are fundamentally points of disagreement and that's stress.
>
> regards,
> dan carpenter
>
 Thanks , I'll be more careful !

 Regards,
 Srishti
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] Staging: ccree: ssi_cipher.c: Remove unused variable.

2017-09-06 Thread Dan Carpenter
Always compile your patches.

  CC [M]  drivers/staging/ccree/ssi_cipher.o
drivers/staging/ccree/ssi_cipher.c: In function ‘ssi_blkcipher_complete’:
drivers/staging/ccree/ssi_cipher.c:700:6: warning: unused variable 
‘inflight_counter’ [-Wunused-variable]
  u32 inflight_counter;
  ^~~~

You need to delete the declaration as well.

Don't be in a rush to resend patches.  I normally write them then let
them sit in my outbox overnight and send them in the morning.  The extra
delay helps me to calm down a bit and focus better.  Even though I've
sent thousands of patches, it sometimes still stresses me out.  It's
like you're disagreeing with the original author and the reviewers are
disagreeing with you and everyone's trying to be nice about it but
patches are fundamentally points of disagreement and that's stress.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH v3] Staging: ccree: ssi_cipher.c: Remove unused variable.

2017-09-06 Thread Srishti Sharma
On Thu, Sep 7, 2017 at 2:56 AM, Julia Lawall  wrote:
>
>
> On Thu, 7 Sep 2017, Srishti Sharma wrote:
>
>> On Thu, Sep 7, 2017 at 2:47 AM, Julia Lawall  wrote:
>> >
>> >
>> > On Thu, 7 Sep 2017, Srishti Sharma wrote:
>> >
>> >> Remove local variable inflight_counter ,as it is never used.
>> >
>> > "counter ,as" -> "counter, as"
>> >
>> >> Signed-off-by: Srishti Sharma 
>> >> ---
>> >> Changes in v3:
>> >>  - There was no longer a need to make the comment more comprehensible as
>> >>I have deleted the variable associated with it because it is unused .
>> >>  drivers/staging/ccree/ssi_cipher.c | 5 +
>> >>  1 file changed, 1 insertion(+), 4 deletions(-)
>> >>
>> >> diff --git a/drivers/staging/ccree/ssi_cipher.c 
>> >> b/drivers/staging/ccree/ssi_cipher.c
>> >> index fec2faa..609ebe4 100644
>> >> --- a/drivers/staging/ccree/ssi_cipher.c
>> >> +++ b/drivers/staging/ccree/ssi_cipher.c
>> >> @@ -702,10 +702,7 @@ static int ssi_blkcipher_complete(struct device *dev,
>> >>
>> >>   ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, 
>> >> dst);
>> >>
>> >> - /*
>> >> -  * Save inflight_counter in a local variable.
>> >> -  */
>> >> - inflight_counter =  ctx_p->drvdata->inflight_counter;
>> >> +
>> >
>> > This is a patch on your previous patch.  It should be a patch on the
>> > original code.  Also, don't add a new blank line.  Just remove the line
>> > completely.
>>
>>   so , when I resend it should I version it as v3 or send as a new
>> patch as it is now fixing a different problem ?
>
> v3 (or maybe now v4?) would be fine.  It's still the same code that is
> under consideration.  Then it will be clear that he previosu patches are
> not needed.

 Okay , Thanks !
 Regards,
 Srishti
>
> julia
>
>>  Regards,
>>  Srishti
>> >
>> > julia
>> >
>> >>   /*Decrease the inflight counter*/
>> >>   if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter 
>> >> > 0)
>> >>   ctx_p->drvdata->inflight_counter--;
>> >> --
>> >> 2.7.4
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google Groups 
>> >> "outreachy-kernel" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send an 
>> >> email to outreachy-kernel+unsubscr...@googlegroups.com.
>> >> To post to this group, send email to outreachy-ker...@googlegroups.com.
>> >> To view this discussion on the web visit 
>> >> https://groups.google.com/d/msgid/outreachy-kernel/1504732426-9765-1-git-send-email-srishtishar%40gmail.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >>
>>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH v3] Staging: ccree: ssi_cipher.c: Remove unused variable.

2017-09-06 Thread Julia Lawall


On Thu, 7 Sep 2017, Srishti Sharma wrote:

> On Thu, Sep 7, 2017 at 2:47 AM, Julia Lawall  wrote:
> >
> >
> > On Thu, 7 Sep 2017, Srishti Sharma wrote:
> >
> >> Remove local variable inflight_counter ,as it is never used.
> >
> > "counter ,as" -> "counter, as"
> >
> >> Signed-off-by: Srishti Sharma 
> >> ---
> >> Changes in v3:
> >>  - There was no longer a need to make the comment more comprehensible as
> >>I have deleted the variable associated with it because it is unused .
> >>  drivers/staging/ccree/ssi_cipher.c | 5 +
> >>  1 file changed, 1 insertion(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/staging/ccree/ssi_cipher.c 
> >> b/drivers/staging/ccree/ssi_cipher.c
> >> index fec2faa..609ebe4 100644
> >> --- a/drivers/staging/ccree/ssi_cipher.c
> >> +++ b/drivers/staging/ccree/ssi_cipher.c
> >> @@ -702,10 +702,7 @@ static int ssi_blkcipher_complete(struct device *dev,
> >>
> >>   ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, 
> >> dst);
> >>
> >> - /*
> >> -  * Save inflight_counter in a local variable.
> >> -  */
> >> - inflight_counter =  ctx_p->drvdata->inflight_counter;
> >> +
> >
> > This is a patch on your previous patch.  It should be a patch on the
> > original code.  Also, don't add a new blank line.  Just remove the line
> > completely.
>
>   so , when I resend it should I version it as v3 or send as a new
> patch as it is now fixing a different problem ?

v3 (or maybe now v4?) would be fine.  It's still the same code that is
under consideration.  Then it will be clear that he previosu patches are
not needed.

julia

>  Regards,
>  Srishti
> >
> > julia
> >
> >>   /*Decrease the inflight counter*/
> >>   if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 
> >> 0)
> >>   ctx_p->drvdata->inflight_counter--;
> >> --
> >> 2.7.4
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups 
> >> "outreachy-kernel" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an 
> >> email to outreachy-kernel+unsubscr...@googlegroups.com.
> >> To post to this group, send email to outreachy-ker...@googlegroups.com.
> >> To view this discussion on the web visit 
> >> https://groups.google.com/d/msgid/outreachy-kernel/1504732426-9765-1-git-send-email-srishtishar%40gmail.com.
> >> For more options, visit https://groups.google.com/d/optout.
> >>
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH v3] Staging: ccree: ssi_cipher.c: Remove unused variable.

2017-09-06 Thread Srishti Sharma
On Thu, Sep 7, 2017 at 2:47 AM, Julia Lawall  wrote:
>
>
> On Thu, 7 Sep 2017, Srishti Sharma wrote:
>
>> Remove local variable inflight_counter ,as it is never used.
>
> "counter ,as" -> "counter, as"
>
>> Signed-off-by: Srishti Sharma 
>> ---
>> Changes in v3:
>>  - There was no longer a need to make the comment more comprehensible as
>>I have deleted the variable associated with it because it is unused .
>>  drivers/staging/ccree/ssi_cipher.c | 5 +
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/ccree/ssi_cipher.c 
>> b/drivers/staging/ccree/ssi_cipher.c
>> index fec2faa..609ebe4 100644
>> --- a/drivers/staging/ccree/ssi_cipher.c
>> +++ b/drivers/staging/ccree/ssi_cipher.c
>> @@ -702,10 +702,7 @@ static int ssi_blkcipher_complete(struct device *dev,
>>
>>   ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst);
>>
>> - /*
>> -  * Save inflight_counter in a local variable.
>> -  */
>> - inflight_counter =  ctx_p->drvdata->inflight_counter;
>> +
>
> This is a patch on your previous patch.  It should be a patch on the
> original code.  Also, don't add a new blank line.  Just remove the line
> completely.

  so , when I resend it should I version it as v3 or send as a new
patch as it is now fixing a different problem ?

 Regards,
 Srishti
>
> julia
>
>>   /*Decrease the inflight counter*/
>>   if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0)
>>   ctx_p->drvdata->inflight_counter--;
>> --
>> 2.7.4
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "outreachy-kernel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to outreachy-kernel+unsubscr...@googlegroups.com.
>> To post to this group, send email to outreachy-ker...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/outreachy-kernel/1504732426-9765-1-git-send-email-srishtishar%40gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH v3] Staging: ccree: ssi_cipher.c: Remove unused variable.

2017-09-06 Thread Julia Lawall


On Thu, 7 Sep 2017, Srishti Sharma wrote:

> Remove local variable inflight_counter ,as it is never used.

"counter ,as" -> "counter, as"

> Signed-off-by: Srishti Sharma 
> ---
> Changes in v3:
>  - There was no longer a need to make the comment more comprehensible as
>I have deleted the variable associated with it because it is unused .
>  drivers/staging/ccree/ssi_cipher.c | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/staging/ccree/ssi_cipher.c 
> b/drivers/staging/ccree/ssi_cipher.c
> index fec2faa..609ebe4 100644
> --- a/drivers/staging/ccree/ssi_cipher.c
> +++ b/drivers/staging/ccree/ssi_cipher.c
> @@ -702,10 +702,7 @@ static int ssi_blkcipher_complete(struct device *dev,
>
>   ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst);
>
> - /*
> -  * Save inflight_counter in a local variable.
> -  */
> - inflight_counter =  ctx_p->drvdata->inflight_counter;
> +

This is a patch on your previous patch.  It should be a patch on the
original code.  Also, don't add a new blank line.  Just remove the line
completely.

julia

>   /*Decrease the inflight counter*/
>   if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0)
>   ctx_p->drvdata->inflight_counter--;
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/1504732426-9765-1-git-send-email-srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] Staging: ccree: ssi_cipher.c: Remove unused variable.

2017-09-06 Thread Srishti Sharma
Remove local variable inflight_counter ,as it is never used.

Signed-off-by: Srishti Sharma 
---
Changes in v3:
 - There was no longer a need to make the comment more comprehensible as
   I have deleted the variable associated with it because it is unused .
 drivers/staging/ccree/ssi_cipher.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/ccree/ssi_cipher.c 
b/drivers/staging/ccree/ssi_cipher.c
index fec2faa..609ebe4 100644
--- a/drivers/staging/ccree/ssi_cipher.c
+++ b/drivers/staging/ccree/ssi_cipher.c
@@ -702,10 +702,7 @@ static int ssi_blkcipher_complete(struct device *dev,

ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst);

-   /*
-* Save inflight_counter in a local variable.
-*/
-   inflight_counter =  ctx_p->drvdata->inflight_counter;
+
/*Decrease the inflight counter*/
if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0)
ctx_p->drvdata->inflight_counter--;
--
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: ccree: ssi_cipher.c: Correct spelling mistake.

2017-09-06 Thread Srishti Sharma
On Thu, Sep 7, 2017 at 2:29 AM, Dan Carpenter  wrote:
> On Thu, Sep 07, 2017 at 12:54:23AM +0530, Srishti Sharma wrote:
>> Correct spelling of counter in comment .
>>
>> Signed-off-by: Srishti Sharma 
>> ---
>>  drivers/staging/ccree/ssi_cipher.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/ccree/ssi_cipher.c 
>> b/drivers/staging/ccree/ssi_cipher.c
>> index 8d31a93..99232b2 100644
>> --- a/drivers/staging/ccree/ssi_cipher.c
>> +++ b/drivers/staging/ccree/ssi_cipher.c
>> @@ -702,7 +702,7 @@ static int ssi_blkcipher_complete(struct device *dev,
>>
>>   ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst);
>>
>> - /*Set the inflight couter value to local variable*/
>> + /*Set the inflight counter value to local variable*/
>>   inflight_counter =  ctx_p->drvdata->inflight_counter;
>
> Sure, but it would be better to just delete the comment.  It's obvious.
> But really just delete the local inflight_counter variable as well
> because that's never used.

  Okay, I'll delete it .
>
> regards,
> dan carpenter
>

Regards,
Srishti
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: ccree: ssi_cipher.c: Correct spelling mistake.

2017-09-06 Thread Dan Carpenter
On Thu, Sep 07, 2017 at 12:54:23AM +0530, Srishti Sharma wrote:
> Correct spelling of counter in comment .
> 
> Signed-off-by: Srishti Sharma 
> ---
>  drivers/staging/ccree/ssi_cipher.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/ccree/ssi_cipher.c 
> b/drivers/staging/ccree/ssi_cipher.c
> index 8d31a93..99232b2 100644
> --- a/drivers/staging/ccree/ssi_cipher.c
> +++ b/drivers/staging/ccree/ssi_cipher.c
> @@ -702,7 +702,7 @@ static int ssi_blkcipher_complete(struct device *dev,
> 
>   ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst);
> 
> - /*Set the inflight couter value to local variable*/
> + /*Set the inflight counter value to local variable*/
>   inflight_counter =  ctx_p->drvdata->inflight_counter;

Sure, but it would be better to just delete the comment.  It's obvious.
But really just delete the local inflight_counter variable as well
because that's never used.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH v2] Staging: ccree: ssi_cipher.c: Make comment more comprehensible.

2017-09-06 Thread Srishti Sharma
On Thu, Sep 7, 2017 at 2:28 AM, Julia Lawall  wrote:
>
>
> On Thu, 7 Sep 2017, Srishti Sharma wrote:
>
>> Edited comment to make it more comprehensible.
>>
>> Signed-off-by: Srishti Sharma 
>> ---
>> Changes in v2:
>>  - Make comment more comprehensible , instead of just correcting typos.
>>  drivers/staging/ccree/ssi_cipher.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/ccree/ssi_cipher.c 
>> b/drivers/staging/ccree/ssi_cipher.c
>> index 99232b2..fec2faa 100644
>> --- a/drivers/staging/ccree/ssi_cipher.c
>> +++ b/drivers/staging/ccree/ssi_cipher.c
>> @@ -702,7 +702,9 @@ static int ssi_blkcipher_complete(struct device *dev,
>>
>>   ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst);
>>
>> - /*Set the inflight counter value to local variable*/
>> + /*
>> +  * Save inflight_counter in a local variable.
>> +  */
>
> This is the format for multiline comments.  Your comments is only one
> line.  You just need to add spaces around the text, as compared to the
> original version.
>
> julia
>
>>   inflight_counter =  ctx_p->drvdata->inflight_counter;
>>   /*Decrease the inflight counter*/
>>   if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0)
>> --
>> 2.7.4
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "outreachy-kernel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to outreachy-kernel+unsubscr...@googlegroups.com.
>> To post to this group, send email to outreachy-ker...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/outreachy-kernel/1504731390-9536-1-git-send-email-srishtishar%40gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>

Okay, Thanks I'll re-send it .

Regards,
Srishti
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH v2] Staging: ccree: ssi_cipher.c: Make comment more comprehensible.

2017-09-06 Thread Julia Lawall


On Thu, 7 Sep 2017, Srishti Sharma wrote:

> Edited comment to make it more comprehensible.
>
> Signed-off-by: Srishti Sharma 
> ---
> Changes in v2:
>  - Make comment more comprehensible , instead of just correcting typos.
>  drivers/staging/ccree/ssi_cipher.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/ccree/ssi_cipher.c 
> b/drivers/staging/ccree/ssi_cipher.c
> index 99232b2..fec2faa 100644
> --- a/drivers/staging/ccree/ssi_cipher.c
> +++ b/drivers/staging/ccree/ssi_cipher.c
> @@ -702,7 +702,9 @@ static int ssi_blkcipher_complete(struct device *dev,
>
>   ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst);
>
> - /*Set the inflight counter value to local variable*/
> + /*
> +  * Save inflight_counter in a local variable.
> +  */

This is the format for multiline comments.  Your comments is only one
line.  You just need to add spaces around the text, as compared to the
original version.

julia

>   inflight_counter =  ctx_p->drvdata->inflight_counter;
>   /*Decrease the inflight counter*/
>   if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0)
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/1504731390-9536-1-git-send-email-srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] Staging: ccree: ssi_cipher.c: Make comment more comprehensible.

2017-09-06 Thread Srishti Sharma
Edited comment to make it more comprehensible.

Signed-off-by: Srishti Sharma 
---
Changes in v2:
 - Make comment more comprehensible , instead of just correcting typos.
 drivers/staging/ccree/ssi_cipher.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_cipher.c 
b/drivers/staging/ccree/ssi_cipher.c
index 99232b2..fec2faa 100644
--- a/drivers/staging/ccree/ssi_cipher.c
+++ b/drivers/staging/ccree/ssi_cipher.c
@@ -702,7 +702,9 @@ static int ssi_blkcipher_complete(struct device *dev,

ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst);

-   /*Set the inflight counter value to local variable*/
+   /*
+* Save inflight_counter in a local variable.
+*/
inflight_counter =  ctx_p->drvdata->inflight_counter;
/*Decrease the inflight counter*/
if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0)
--
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 net-next 0/2] hv_netvsc: sub channel initialization fixes

2017-09-06 Thread Stephen Hemminger
One serious deadlock, and one minor optimization.

Stephen Hemminger (2):
  hv_netvsc: fix deadlock on hotplug
  hv_netvsc: avoid unnecessary wakeups on subchannel creation

 drivers/net/hyperv/hyperv_net.h   |   3 +
 drivers/net/hyperv/netvsc.c   |   3 +
 drivers/net/hyperv/netvsc_drv.c   |  11 +---
 drivers/net/hyperv/rndis_filter.c | 126 ++
 4 files changed, 96 insertions(+), 47 deletions(-)

-- 
2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 net-next 2/2] hv_netvsc: avoid unnecessary wakeups on subchannel creation

2017-09-06 Thread Stephen Hemminger
Only need to wakeup the initiator after all sub-channels
are opened.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/hyperv/rndis_filter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hyperv/rndis_filter.c 
b/drivers/net/hyperv/rndis_filter.c
index 731bc7cc6f43..065b204d8e17 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -1048,8 +1048,8 @@ static void netvsc_sc_open(struct vmbus_channel *new_sc)
else
netdev_notice(ndev, "sub channel open failed: %d\n", ret);
 
-   atomic_inc(>open_chn);
-   wake_up(>subchan_open);
+   if (atomic_inc_return(>open_chn) == nvscdev->num_chn)
+   wake_up(>subchan_open);
 }
 
 /* Open sub-channels after completing the handling of the device probe.
-- 
2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 net-next 1/2] hv_netvsc: fix deadlock on hotplug

2017-09-06 Thread Stephen Hemminger
When a virtual device is added dynamically (via host console), then
the vmbus sends an offer message for the primary channel. The processing
of this message for networking causes the network device to then
initialize the sub channels.

The problem is that setting up the sub channels needs to wait until
the subsequent subchannel offers have been processed. These offers
come in on the same ring buffer and work queue as where the primary
offer is being processed; leading to a deadlock.

This did not happen in older kernels, because the sub channel waiting
logic was broken (it wasn't really waiting).

The solution is to do the sub channel setup in its own work queue
context that is scheduled by the primary channel setup; and then
happens later.

Fixes: 732e49850c5e ("netvsc: fix race on sub channel creation")
Reported-by: Dexuan Cui 
Signed-off-by: Stephen Hemminger 
---
v2 - fix module removal race with new work queue

 drivers/net/hyperv/hyperv_net.h   |   3 +
 drivers/net/hyperv/netvsc.c   |   3 +
 drivers/net/hyperv/netvsc_drv.c   |  11 +---
 drivers/net/hyperv/rndis_filter.c | 122 ++
 4 files changed, 94 insertions(+), 45 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index ec546da86683..d98cdfb1536b 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -204,6 +204,8 @@ int netvsc_recv_callback(struct net_device *net,
 const struct ndis_pkt_8021q_info *vlan);
 void netvsc_channel_cb(void *context);
 int netvsc_poll(struct napi_struct *napi, int budget);
+
+void rndis_set_subchannel(struct work_struct *w);
 bool rndis_filter_opened(const struct netvsc_device *nvdev);
 int rndis_filter_open(struct netvsc_device *nvdev);
 int rndis_filter_close(struct netvsc_device *nvdev);
@@ -782,6 +784,7 @@ struct netvsc_device {
u32 num_chn;
 
atomic_t open_chn;
+   struct work_struct subchan_work;
wait_queue_head_t subchan_open;
 
struct rndis_device *extension;
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 0062b802676f..a5511b7326af 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -81,6 +81,7 @@ static struct netvsc_device *alloc_net_device(void)
 
init_completion(_device->channel_init_wait);
init_waitqueue_head(_device->subchan_open);
+   INIT_WORK(_device->subchan_work, rndis_set_subchannel);
 
return net_device;
 }
@@ -557,6 +558,8 @@ void netvsc_device_remove(struct hv_device *device)
= rtnl_dereference(net_device_ctx->nvdev);
int i;
 
+   cancel_work_sync(_device->subchan_work);
+
netvsc_disconnect_vsp(device);
 
RCU_INIT_POINTER(net_device_ctx->nvdev, NULL);
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 165ba4b3b423..c538a4f15f3b 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -853,10 +853,7 @@ static int netvsc_set_channels(struct net_device *net,
rndis_filter_device_remove(dev, nvdev);
 
nvdev = rndis_filter_device_add(dev, _info);
-   if (!IS_ERR(nvdev)) {
-   netif_set_real_num_tx_queues(net, nvdev->num_chn);
-   netif_set_real_num_rx_queues(net, nvdev->num_chn);
-   } else {
+   if (IS_ERR(nvdev)) {
ret = PTR_ERR(nvdev);
device_info.num_chn = orig;
nvdev = rndis_filter_device_add(dev, _info);
@@ -1954,9 +1951,6 @@ static int netvsc_probe(struct hv_device *dev,
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
net->vlan_features = net->features;
 
-   netif_set_real_num_tx_queues(net, nvdev->num_chn);
-   netif_set_real_num_rx_queues(net, nvdev->num_chn);
-
netdev_lockdep_set_classes(net);
 
/* MTU range: 68 - 1500 or 65521 */
@@ -2012,9 +2006,10 @@ static int netvsc_remove(struct hv_device *dev)
if (vf_netdev)
netvsc_unregister_vf(vf_netdev);
 
+   unregister_netdevice(net);
+
rndis_filter_device_remove(dev,
   rtnl_dereference(ndev_ctx->nvdev));
-   unregister_netdevice(net);
rtnl_unlock();
 
hv_set_drvdata(dev, NULL);
diff --git a/drivers/net/hyperv/rndis_filter.c 
b/drivers/net/hyperv/rndis_filter.c
index 69c40b8fccc3..731bc7cc6f43 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -1039,8 +1039,6 @@ static void netvsc_sc_open(struct vmbus_channel *new_sc)
 
/* Set the channel before opening.*/
nvchan->channel = new_sc;
-   netif_napi_add(ndev, >napi,
-  netvsc_poll, NAPI_POLL_WEIGHT);
 
ret = vmbus_open(new_sc, nvscdev->ring_size * PAGE_SIZE,
 nvscdev->ring_size * PAGE_SIZE, NULL, 0,
@@ -1048,12 +1046,88 @@ static void 

Re: [Outreachy kernel] Re: [PATCH] Staging: ccree: ssi_cipher.c: Correct spelling mistake.

2017-09-06 Thread Julia Lawall


On Wed, 6 Sep 2017, Srishti Sharma wrote:

>
>
> On Thursday, September 7, 2017 at 12:54:49 AM UTC+5:30, Srishti Sharma
> wrote:
>   Correct spelling of counter in comment .
>
>   Signed-off-by: Srishti Sharma 
>   ---
>    drivers/staging/ccree/ssi_cipher.c | 2 +-
>    1 file changed, 1 insertion(+), 1 deletion(-)
>
>   diff --git a/drivers/staging/ccree/ssi_cipher.c
>   b/drivers/staging/ccree/ssi_cipher.c
>   index 8d31a93..99232b2 100644
>   --- a/drivers/staging/ccree/ssi_cipher.c
>   +++ b/drivers/staging/ccree/ssi_cipher.c
>   @@ -702,7 +702,7 @@ static int ssi_blkcipher_complete(struct
>   device *dev,
>
>    ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx,
>   ivsize, src, dst);
>
>   -/*Set the inflight couter value to local variable*/
>   +/*Set the inflight counter value to local variable*/
>    inflight_counter =  ctx_p->drvdata->inflight_counter;
>    /*Decrease the inflight counter*/
>    if (ctx_p->flow_mode == BYPASS &&
>   ctx_p->drvdata->inflight_counter > 0)
>   --
>   2.7.4
>
>
>   Hey,
>
>   Can I say , /* store the value of inflight_counter variable from  driver
> private data context to a local variable */  , to make it more
> comprehensible ? 

I think it could be a bit of overkill.  The "driver private data context"
part can be seen from a quick glance at the code.  Also, it could be good
to bring out the purpose rather than just what the code does.  So "save
inflight_counter in a a local variable" could be better, because it
focuses on the idea of saving some information for later use.  Good job on
figuring out the formatting problem.

julia

>
> Regards,
> Srishti 
>
> --
> You received this message because you are subscribed to the Google Groups
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web 
> visithttps://groups.google.com/d/msgid/outreachy-kernel/2b8bde9c-6e84-48c5-ab93-
> 76127f314429%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH] vsock: only load vmci transport on VMware hypervisor by default

2017-09-06 Thread Dexuan Cui
> From: Jorgen S. Hansen [mailto:jhan...@vmware.com]
> Sent: Wednesday, September 6, 2017 7:11 AM
>> ...
> > I'm currently working on NFS over AF_VSOCK and sock_diag support (for
> > ss(8) and netstat-like tools).
> >
> > Multi-transport support is lower priority for me at the moment.  I'm
> > happy to review patches though.  If there is no progress on this by the
> > end of the year then I will have time to work on it.
> >
> 
> I’ll try to find time to write a more coherent proposal in the coming weeks,
> and we can discuss that.
> 
> Jorgen

Thank you! 

Thanks,
-- Dexuan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 8/8] staging: ccree: remove BUG macro usage

2017-09-06 Thread Dan Carpenter
On Sun, Sep 03, 2017 at 11:56:50AM +0300, Gilad Ben-Yossef wrote:
> @@ -1154,7 +1150,8 @@ static inline int ssi_buffer_mgr_aead_chain_data(
>   //if have reached the end of the sgl, then this is unexpected
>   if (!areq_ctx->src_sgl) {
>   SSI_LOG_ERR("reached end of sg list. unexpected\n");
> - BUG();
> + return -EINVAL;
> + goto chain_data_exit;

You've got a direct return followed by a goto.

It's a do-nothing goto that just returns rc.  I hate those.  I've tried
to review locking bugs to see if single returns prevent future
programmers from introducing new error paths which don't unlock.  They
don't really help...

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/2] LU-6808: ported to upstream staging driver

2017-09-06 Thread Tyson Whitehead
On Wednesday, September 6, 2017 7:28:52 PM EDT Greg Kroah-Hartman wrote:
> On Wed, Sep 06, 2017 at 12:04:04PM -0400, Tyson Whitehead wrote:
> > Please find enclosed in the next two emails the two patches for LU-6808 
> > ported to the in-tree staging lustre client driver in the 4.12 release.
> 
> What does that mean?  What can I do with these?  4.12 is about to be 
> end-of-life in a few days...
> 
> confused,

Those were some Lustre client driver patches I ported forward to the in-tree 
4.12 kernel driver (as that is what our Fedora based system is running).

I was asked to pass them along on the Lustre bug tracking system for inclusion.

I see though that they should be against your staging-testing branch and not 
the previous release branch.  I'll move them over to this and post again.

Thanks!  -Tyson
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: ccree: ssi_cipher.c: Correct spelling mistake.

2017-09-06 Thread Srishti Sharma
Correct spelling of counter in comment .

Signed-off-by: Srishti Sharma 
---
 drivers/staging/ccree/ssi_cipher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_cipher.c 
b/drivers/staging/ccree/ssi_cipher.c
index 8d31a93..99232b2 100644
--- a/drivers/staging/ccree/ssi_cipher.c
+++ b/drivers/staging/ccree/ssi_cipher.c
@@ -702,7 +702,7 @@ static int ssi_blkcipher_complete(struct device *dev,

ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst);

-   /*Set the inflight couter value to local variable*/
+   /*Set the inflight counter value to local variable*/
inflight_counter =  ctx_p->drvdata->inflight_counter;
/*Decrease the inflight counter*/
if (ctx_p->flow_mode == BYPASS && ctx_p->drvdata->inflight_counter > 0)
--
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/2] LU-6808: ported to upstream staging driver

2017-09-06 Thread Greg Kroah-Hartman
On Wed, Sep 06, 2017 at 12:04:04PM -0400, Tyson Whitehead wrote:
> Please find enclosed in the next two emails the two patches for LU-6808 
> ported to the in-tree staging lustre client driver in the 4.12 release.

What does that mean?  What can I do with these?  4.12 is about to be
end-of-life in a few days...

confused,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next 1/1] hv_netvsc: fix deadlock on hotplug

2017-09-06 Thread Stephen Hemminger
On Wed, 6 Sep 2017 16:23:45 +
Haiyang Zhang  wrote:

> > -Original Message-
> > From: Stephen Hemminger [mailto:step...@networkplumber.org]
> > Sent: Wednesday, September 6, 2017 11:19 AM
> > To: KY Srinivasan ; Haiyang Zhang
> > ; Stephen Hemminger 
> > Cc: de...@linuxdriverproject.org; net...@vger.kernel.org
> > Subject: [PATCH net-next 1/1] hv_netvsc: fix deadlock on hotplug
> > 
> > When a virtual device is added dynamically (via host console), then
> > the vmbus sends an offer message for the primary channel. The processing
> > of this message for networking causes the network device to then
> > initialize the sub channels.
> > 
> > The problem is that setting up the sub channels needs to wait until
> > the subsequent subchannel offers have been processed. These offers
> > come in on the same ring buffer and work queue as where the primary
> > offer is being processed; leading to a deadlock.
> > 
> > This did not happen in older kernels, because the sub channel waiting
> > logic was broken (it wasn't really waiting).
> > 
> > The solution is to do the sub channel setup in its own work queue
> > context that is scheduled by the primary channel setup; and then
> > happens later.
> > 
> > Fixes: 732e49850c5e ("netvsc: fix race on sub channel creation")
> > Reported-by: Dexuan Cui 
> > Signed-off-by: Stephen Hemminger 
> > ---
> > Should also go to stable, but this version does not apply cleanly
> > to 4.13. Have another patch for that.
> > 
> >  drivers/net/hyperv/hyperv_net.h   |   1 +
> >  drivers/net/hyperv/netvsc_drv.c   |   8 +--
> >  drivers/net/hyperv/rndis_filter.c | 106 ++-
> > ---
> >  3 files changed, 74 insertions(+), 41 deletions(-)  
> 
> The patch looks overall. I just have a question:
> 
> With this patch, after module load and probe is done, there may still be
> subchannels being processed. If rmmod immediately, the subchannel offers 
> may hit half-way removed device structures... Do we also need to add 
> cancel_work_sync(>subchan_work) to the top of netvsc_remove()?
> 
> unregister_netdevice() includes device close, but it's only called later
> in the netvsc_remove() when rndis is already removed.
> 
> Thanks,
> - Haiyang

Good catch.
If the driver called unregister_netdevice first before doing 
rndis_filter_device_remove
that would solve the problem. That wouldn't cause additional problems and it 
makes
sense to close the network layer first.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] LU-6808 ptlrpc: no need to reassign mbits for replay

2017-09-06 Thread Tyson Whitehead
From: Niu Yawei 

It's not necessary reassgin & re-adjust rq_mbits for replay
request in ptlrpc_set_bulk_mbits(), they all must have already
been correctly assigned before.

Such unecessary reassign could make the first matchbit not
PTLRPC_BULK_OPS_MASK aligned, that'll trigger LASSERT in
ptlrpc_register_bulk():

- ptlrpc_set_bulk_mbits() is called when first time sending
  request, rq_mbits is set as xid, which is BULK_OPS aligned;

- ptlrpc_set_bulk_mbits() continue to adjust the mbits for
  multi-bulk RPC, rq_mbits is not aligned anymore, then rq_xid
  is changed accordingly if client is connecting to an old
  server, so rq_xid became unaligned too;

- The request is replayed, ptlrpc_set_bulk_mbits() reassign
  the rq_mbits as rq_xid, which isn't aligned already, but
  ptlrpc_register_bulk() still assumes this value as the
  first matchbits and LASSERT it's BULK_OPS aligned.

Signed-off-by: Niu Yawei 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6808
Reviewed-on: http://review.whamcloud.com/23048
Tested-by: Jenkins
Reviewed-by: Fan Yong 
Reviewed-by: Alex Zhuravlev 
Tested-by: Maloo 
Reviewed-by: Oleg Drokin 
Signed-off-by: Tyson Whitehead 
---
 drivers/staging/lustre/lustre/ptlrpc/client.c | 34 +++
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index 0f9db5526ba5..6ddbd1289a2f 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -3116,26 +3116,37 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req)
 
LASSERT(bd);
 
-   if (!req->rq_resend) {
-   /* this request has a new xid, just use it as bulk matchbits */
-   req->rq_mbits = req->rq_xid;
-
-   } else { /* needs to generate a new matchbits for resend */
-   u64 old_mbits = req->rq_mbits;
-
+   /* Generate new matchbits for all resend requests, including
+* resend replay. */
+   if (req->rq_resend) {
+   __u64 old_mbits = req->rq_mbits;
+
+   /* First time resend on -EINPROGRESS will generate new xid,
+* so we can actually use the rq_xid as rq_mbits in such case,
+* however, it's bit hard to distinguish such resend with a
+* 'resend for the -EINPROGRESS resend'. To make it simple,
+* we opt to generate mbits for all resend cases. */
if (OCD_HAS_FLAG(>bd_import->imp_connect_data, BULK_MBITS)){
req->rq_mbits = ptlrpc_next_xid();
} else {
-   /* old version transfers rq_xid to peer as matchbits */
+   /* Old version transfers rq_xid to peer as
+* matchbits. */
spin_lock(>rq_import->imp_lock);
list_del_init(>rq_unreplied_list);
ptlrpc_assign_next_xid_nolock(req);
-   req->rq_mbits = req->rq_xid;
spin_unlock(>rq_import->imp_lock);
+   req->rq_mbits = req->rq_xid;
}
 
CDEBUG(D_HA, "resend bulk old x%llu new x%llu\n",
   old_mbits, req->rq_mbits);
+   } else if (!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY)) {
+   /* Request being sent first time, use xid as matchbits. */
+   req->rq_mbits = req->rq_xid;
+   } else {
+   /* Replay request, xid and matchbits have already been
+* correctly assigned. */
+   return;
}
 
/*
@@ -3146,7 +3157,10 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req)
req->rq_mbits += DIV_ROUND_UP(bd->bd_iov_count, LNET_MAX_IOV) - 1;
 
/* Set rq_xid as rq_mbits to indicate the final bulk for the old
-* server which does not support OBD_CONNECT_BULK_MBITS. LU-6808 */
+* server which does not support OBD_CONNECT_BULK_MBITS. LU-6808.
+*
+* It's ok to directly set the rq_xid here, since this xid bump
+* won't affect the request position in unreplied list. */
if (!OCD_HAS_FLAG(>bd_import->imp_connect_data, BULK_MBITS))
req->rq_xid = req->rq_mbits;
 }
-- 
2.14.0


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] LU-6808 ptlrpc: properly set "rq_xid" for 4MB IO

2017-09-06 Thread Tyson Whitehead
From: Fan Yong 

The commit d099fdd6 replaced the "rq_xid" with "rq_mbits" as
the matchbits of bulk data transferring. To be interoperable
with old servers, it introduced the new connection flag:
OBD_CONNECT_BULK_MBITS. If the server does not support such
feature, then the "rq_xid" would be set the same value as
"rq_mbits". Unfortunately, it forgot to handle multiple bulk
operations, for example 4MB IO. If the new client wants to
make 4MB IO with old server, it may send a small "rq_xid" to
the old server, as to the old server will regard it as an 1MB
IO or 2MB IO. So the data transfer will not complete because
of only part of data transferred. Then the client will timeout
failure and retry again and again.

Test-Parameters: alwaysuploadlogs testlist=sanity envdefinitions=ONLY=224c 
ossjob=lustre-b2_7_fe mdsjob=lustre-b2_7_fe ossbuildno=95 mdsbuildno=95 
mdsdistro=el6.7 ossdistro=el6.7
Signed-off-by: Fan Yong 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6808
Reviewed-on: http://review.whamcloud.com/22373
Tested-by: Jenkins
Reviewed-by: Jinshan Xiong 
Tested-by: Maloo 
Reviewed-by: Bobi Jam 
Reviewed-by: Liang Zhen 
Reviewed-by: Oleg Drokin 
Signed-off-by: Tyson Whitehead 
---
 drivers/staging/lustre/lustre/ptlrpc/client.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index 6466974a43e7..0f9db5526ba5 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -3123,8 +3123,7 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req)
} else { /* needs to generate a new matchbits for resend */
u64 old_mbits = req->rq_mbits;
 
-   if ((bd->bd_import->imp_connect_data.ocd_connect_flags &
-OBD_CONNECT_BULK_MBITS)) {
+   if (OCD_HAS_FLAG(>bd_import->imp_connect_data, BULK_MBITS)){
req->rq_mbits = ptlrpc_next_xid();
} else {
/* old version transfers rq_xid to peer as matchbits */
@@ -3145,6 +3144,11 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req)
 * see LU-1431
 */
req->rq_mbits += DIV_ROUND_UP(bd->bd_iov_count, LNET_MAX_IOV) - 1;
+
+   /* Set rq_xid as rq_mbits to indicate the final bulk for the old
+* server which does not support OBD_CONNECT_BULK_MBITS. LU-6808 */
+   if (!OCD_HAS_FLAG(>bd_import->imp_connect_data, BULK_MBITS))
+   req->rq_xid = req->rq_mbits;
 }
 
 /**
-- 
2.14.0


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/2] LU-6808: ported to upstream staging driver

2017-09-06 Thread Tyson Whitehead
Please find enclosed in the next two emails the two patches for LU-6808 ported 
to the in-tree staging lustre client driver in the 4.12 release.

https://jira.hpdd.intel.com/browse/LU-6808

Fan Yong (1):
  LU-6808 ptlrpc: properly set "rq_xid" for 4MB IO

Niu Yawei (1):
  LU-6808 ptlrpc: no need to reassign mbits for replay

 drivers/staging/lustre/lustre/ptlrpc/client.c | 40 +++
 1 file changed, 29 insertions(+), 11 deletions(-)

-- 
2.14.0


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH net-next 1/1] hv_netvsc: fix deadlock on hotplug

2017-09-06 Thread Haiyang Zhang


> -Original Message-
> From: Stephen Hemminger [mailto:step...@networkplumber.org]
> Sent: Wednesday, September 6, 2017 11:19 AM
> To: KY Srinivasan ; Haiyang Zhang
> ; Stephen Hemminger 
> Cc: de...@linuxdriverproject.org; net...@vger.kernel.org
> Subject: [PATCH net-next 1/1] hv_netvsc: fix deadlock on hotplug
> 
> When a virtual device is added dynamically (via host console), then
> the vmbus sends an offer message for the primary channel. The processing
> of this message for networking causes the network device to then
> initialize the sub channels.
> 
> The problem is that setting up the sub channels needs to wait until
> the subsequent subchannel offers have been processed. These offers
> come in on the same ring buffer and work queue as where the primary
> offer is being processed; leading to a deadlock.
> 
> This did not happen in older kernels, because the sub channel waiting
> logic was broken (it wasn't really waiting).
> 
> The solution is to do the sub channel setup in its own work queue
> context that is scheduled by the primary channel setup; and then
> happens later.
> 
> Fixes: 732e49850c5e ("netvsc: fix race on sub channel creation")
> Reported-by: Dexuan Cui 
> Signed-off-by: Stephen Hemminger 
> ---
> Should also go to stable, but this version does not apply cleanly
> to 4.13. Have another patch for that.
> 
>  drivers/net/hyperv/hyperv_net.h   |   1 +
>  drivers/net/hyperv/netvsc_drv.c   |   8 +--
>  drivers/net/hyperv/rndis_filter.c | 106 ++-
> ---
>  3 files changed, 74 insertions(+), 41 deletions(-)

The patch looks overall. I just have a question:

With this patch, after module load and probe is done, there may still be
subchannels being processed. If rmmod immediately, the subchannel offers 
may hit half-way removed device structures... Do we also need to add 
cancel_work_sync(>subchan_work) to the top of netvsc_remove()?

unregister_netdevice() includes device close, but it's only called later
in the netvsc_remove() when rndis is already removed.

Thanks,
- Haiyang

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging:pi433:pi433_if.c:Fixes minor typo errors

2017-09-06 Thread harsha
Fixes checkpatch warning -- "occured" and "succesfully" are misspelled

Signed-off-by: Harsha Sharma 
---
 drivers/staging/pi433/pi433_if.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 6b9b7df..6a10478 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -473,7 +473,7 @@ struct pi433_instance {
}
 
 
-   /* rx done, wait was interrupted or error occured */
+   /* rx done, wait was interrupted or error occurred */
 abort:
dev->interrupt_rx_allowed = true;
SET_CHECKED(rf69_set_mode(dev->spi, standby));
@@ -1033,7 +1033,7 @@ static int setup_GPIOs(struct pi433_device *device)
if (retval)
return retval;
 
-   dev_dbg(>spi->dev, "%s succesfully configured", name);
+   dev_dbg(>spi->dev, "%s successfully configured", name);
}
 
return 0;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: pi433: Move limit check to switch default to kill warning

2017-09-06 Thread Geert Uytterhoeven
With gcc-4.1.2:

drivers/staging/pi433/rf69.c: In function ‘rf69_set_dio_mapping’:
drivers/staging/pi433/rf69.c:566: warning: ‘regaddr’ may be used 
uninitialized in this function
drivers/staging/pi433/rf69.c:565: warning: ‘shift’ may be used 
uninitialized in this function
drivers/staging/pi433/rf69.c:564: warning: ‘mask’ may be used uninitialized 
in this function

While this is a false positive, it can easily be fixed by moving the
limit check into the "default" case of the switch statement.

Signed-off-by: Geert Uytterhoeven 
---
 drivers/staging/pi433/rf69.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index c4b1b218ea38f8d1..290b419aa9dd7135 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -570,12 +570,6 @@ int rf69_set_dio_mapping(struct spi_device *spi, u8 
DIONumber, u8 value)
dev_dbg(>dev, "set: DIO mapping");
#endif
 
-   // check DIO number
-   if (DIONumber > 5) {
-   dev_dbg(>dev, "set: illegal input param");
-   return -EINVAL;
-   }
-
switch (DIONumber) {
case 0: mask=MASK_DIO0; shift=SHIFT_DIO0; regaddr=REG_DIOMAPPING1; 
break;
case 1: mask=MASK_DIO1; shift=SHIFT_DIO1; regaddr=REG_DIOMAPPING1; 
break;
@@ -583,6 +577,9 @@ int rf69_set_dio_mapping(struct spi_device *spi, u8 
DIONumber, u8 value)
case 3: mask=MASK_DIO3; shift=SHIFT_DIO3; regaddr=REG_DIOMAPPING1; 
break;
case 4: mask=MASK_DIO4; shift=SHIFT_DIO4; regaddr=REG_DIOMAPPING2; 
break;
case 5: mask=MASK_DIO5; shift=SHIFT_DIO5; regaddr=REG_DIOMAPPING2; 
break;
+   default:
+   dev_dbg(>dev, "set: illegal input param");
+   return -EINVAL;
}
 
// read reg
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net-next 0/1] netvsc hot plug fix

2017-09-06 Thread Stephen Hemminger
This is one fix for problems with hot add of network device
on Windows Server.

Stephen Hemminger (1):
  hv_netvsc: fix deadlock on hotplug

 drivers/net/hyperv/hyperv_net.h   |   1 +
 drivers/net/hyperv/netvsc_drv.c   |   8 +--
 drivers/net/hyperv/rndis_filter.c | 106 ++
 3 files changed, 74 insertions(+), 41 deletions(-)

-- 
2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net-next 1/1] hv_netvsc: fix deadlock on hotplug

2017-09-06 Thread Stephen Hemminger
When a virtual device is added dynamically (via host console), then
the vmbus sends an offer message for the primary channel. The processing
of this message for networking causes the network device to then
initialize the sub channels.

The problem is that setting up the sub channels needs to wait until
the subsequent subchannel offers have been processed. These offers
come in on the same ring buffer and work queue as where the primary
offer is being processed; leading to a deadlock.

This did not happen in older kernels, because the sub channel waiting
logic was broken (it wasn't really waiting).

The solution is to do the sub channel setup in its own work queue
context that is scheduled by the primary channel setup; and then
happens later.

Fixes: 732e49850c5e ("netvsc: fix race on sub channel creation")
Reported-by: Dexuan Cui 
Signed-off-by: Stephen Hemminger 
---
Should also go to stable, but this version does not apply cleanly
to 4.13. Have another patch for that.

 drivers/net/hyperv/hyperv_net.h   |   1 +
 drivers/net/hyperv/netvsc_drv.c   |   8 +--
 drivers/net/hyperv/rndis_filter.c | 106 ++
 3 files changed, 74 insertions(+), 41 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index ec546da86683..d1df5050adfb 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -172,6 +172,7 @@ struct rndis_device {
struct list_head req_list;
 
struct work_struct mcast_work;
+   struct work_struct subchan_work;
 
bool link_state;/* 0 - link up, 1 - link down */
 
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 165ba4b3b423..80f45e0f81c8 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -853,10 +853,7 @@ static int netvsc_set_channels(struct net_device *net,
rndis_filter_device_remove(dev, nvdev);
 
nvdev = rndis_filter_device_add(dev, _info);
-   if (!IS_ERR(nvdev)) {
-   netif_set_real_num_tx_queues(net, nvdev->num_chn);
-   netif_set_real_num_rx_queues(net, nvdev->num_chn);
-   } else {
+   if (IS_ERR(nvdev)) {
ret = PTR_ERR(nvdev);
device_info.num_chn = orig;
nvdev = rndis_filter_device_add(dev, _info);
@@ -1954,9 +1951,6 @@ static int netvsc_probe(struct hv_device *dev,
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
net->vlan_features = net->features;
 
-   netif_set_real_num_tx_queues(net, nvdev->num_chn);
-   netif_set_real_num_rx_queues(net, nvdev->num_chn);
-
netdev_lockdep_set_classes(net);
 
/* MTU range: 68 - 1500 or 65521 */
diff --git a/drivers/net/hyperv/rndis_filter.c 
b/drivers/net/hyperv/rndis_filter.c
index 69c40b8fccc3..c240125eed48 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -33,6 +33,7 @@
 #include "hyperv_net.h"
 
 static void rndis_set_multicast(struct work_struct *w);
+static void rndis_set_subchannel(struct work_struct *w);
 
 #define RNDIS_EXT_LEN PAGE_SIZE
 struct rndis_request {
@@ -79,6 +80,7 @@ static struct rndis_device *get_rndis_device(void)
 
INIT_LIST_HEAD(>req_list);
INIT_WORK(>mcast_work, rndis_set_multicast);
+   INIT_WORK(>subchan_work, rndis_set_subchannel);
 
device->state = RNDIS_DEV_UNINITIALIZED;
 
@@ -1002,6 +1004,7 @@ static int rndis_filter_close_device(struct rndis_device 
*dev)
 
/* Make sure rndis_set_multicast doesn't re-enable filter! */
cancel_work_sync(>mcast_work);
+   cancel_work_sync(>subchan_work);
 
ret = rndis_filter_set_packet_filter(dev, 0);
if (ret == -ENODEV)
@@ -1054,6 +1057,71 @@ static void netvsc_sc_open(struct vmbus_channel *new_sc)
wake_up(>subchan_open);
 }
 
+/*
+ * Open sub-channels after completing the handling of the device probe.
+ * This breaks overlap of processing the host message for the
+ * new primary channel with the initialization of sub-channels.
+ */
+static void rndis_set_subchannel(struct work_struct *w)
+{
+   struct rndis_device *rdev
+   = container_of(w, struct rndis_device, subchan_work);
+   struct net_device *net = rdev->ndev;
+   struct net_device_context *ndev_ctx = netdev_priv(net);
+   struct hv_device *dev = ndev_ctx->device_ctx;
+   struct nvsp_message *init_packet;
+   struct netvsc_device *nvdev;
+   int ret = -ENODEV;
+
+   if (!rtnl_trylock()) {
+   schedule_work(w);
+   return;
+   }
+
+   nvdev = rtnl_dereference(ndev_ctx->nvdev);
+   if (!nvdev)
+   goto out;
+
+   init_packet = >channel_init_pkt;
+   memset(init_packet, 0, sizeof(struct nvsp_message));
+   init_packet->hdr.msg_type = NVSP_MSG5_TYPE_SUBCHANNEL;
+   init_packet->msg.v5_msg.subchn_req.op = 

Re: [PATCH] vsock: only load vmci transport on VMware hypervisor by default

2017-09-06 Thread Jorgen S. Hansen

> On Aug 31, 2017, at 1:54 PM, Stefan Hajnoczi  wrote:
> 
> On Tue, Aug 29, 2017 at 03:37:07PM +, Jorgen S. Hansen wrote:
>>> On Aug 29, 2017, at 4:36 AM, Dexuan Cui  wrote:
>> If we allow multiple host side transports, virtio host side support and
>> vmci should be able to coexist regardless of the order of initialization.
> 
> That sounds good to me.
> 
> This means af_vsock.c needs to be aware of CID allocation.  Currently the
> vhost_vsock.ko driver handles this itself (it keeps a list of CIDs and
> checks that they are not used twice).  It should be possible to move
> that state into af_vsock.c so we have  pairs.
> 

Yes, that was my thinking as well.

> I'm currently working on NFS over AF_VSOCK and sock_diag support (for
> ss(8) and netstat-like tools).
> 
> Multi-transport support is lower priority for me at the moment.  I'm
> happy to review patches though.  If there is no progress on this by the
> end of the year then I will have time to work on it.
> 

I’ll try to find time to write a more coherent proposal in the coming weeks,
and we can discuss that.

> Are either of you are in Prague, Czech Republic on October 25-27 for
> Linux Kernel Summit, Open Source Summit Europe, Embedded Linux
> Conference Europe, KVM Forum, or MesosCon Europe?

No, I won’t be there.

Thanks,
Jorgen

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] iio staging: tsl2x7x: clean up limit checks

2017-09-06 Thread Dan Carpenter
Let me try send a v2 and see what you think.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging/speakup: fix checkpatch.pl warning in speak_char()

2017-09-06 Thread Justin Skists
correct the following warning from checkpatch.pl:-

WARNING: Prefer using '"%s...", __func__' to using 'speak_char', this
function's name, in a string

Signed-off-by: Justin Skists 
Acked-by: Samuel Thibault 

---
 drivers/staging/speakup/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 67956e24779c..938a0aed7de5 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -447,7 +447,7 @@ static void speak_char(u16 ch)
 
cp = spk_characters[ch];
if (!cp) {
-   pr_info("speak_char: cp == NULL!\n");
+   pr_info("%s: cp == NULL!\n", __func__);
return;
}
if (IS_CHAR(ch, B_CAP)) {
-- 
2.14.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel