[PATCH 1/4] Staging: rtl8192e: Remove variable bFirstSeg

Tree Davies posted 4 patches 2 years ago
[PATCH 1/4] Staging: rtl8192e: Remove variable bFirstSeg
Posted by Tree Davies 2 years ago
Remove variable bFirstSeg as it is defined but never used.

Signed-off-by: Tree Davies <tdavies@darkphysics.net>
---
 drivers/staging/rtl8192e/rtllib.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 0a8c44e497f5..c0a24826cd3b 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -103,7 +103,6 @@ struct cb_desc {
 	/* Tx Desc Related flags (8-9) */
 	u8 bLastIniPkt:1;
 	u8 bCmdOrInit:1;
-	u8 bFirstSeg:1;
 	u8 bLastSeg:1;
 	u8 bEncrypt:1;
 	u8 tx_dis_rate_fallback:1;
-- 
2.39.2
Re: [PATCH 1/4] Staging: rtl8192e: Remove variable bFirstSeg
Posted by Dan Carpenter 2 years ago
On Sun, Dec 10, 2023 at 11:37:02AM -0800, Tree Davies wrote:
> Remove variable bFirstSeg as it is defined but never used.
> 
> Signed-off-by: Tree Davies <tdavies@darkphysics.net>
> ---
>  drivers/staging/rtl8192e/rtllib.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
> index 0a8c44e497f5..c0a24826cd3b 100644
> --- a/drivers/staging/rtl8192e/rtllib.h
> +++ b/drivers/staging/rtl8192e/rtllib.h
> @@ -103,7 +103,6 @@ struct cb_desc {
>  	/* Tx Desc Related flags (8-9) */
>  	u8 bLastIniPkt:1;
>  	u8 bCmdOrInit:1;
> -	u8 bFirstSeg:1;
>  	u8 bLastSeg:1;
>  	u8 bEncrypt:1;
>  	u8 tx_dis_rate_fallback:1;

I don't think you can remove these.  They're part of the protocol for
talking to the firmware.

regards,
dan carpenter
Re: [PATCH 1/4] Staging: rtl8192e: Remove variable bFirstSeg
Posted by Philipp Hortmann 2 years ago
On 12/11/23 09:37, Dan Carpenter wrote:
> On Sun, Dec 10, 2023 at 11:37:02AM -0800, Tree Davies wrote:
>> Remove variable bFirstSeg as it is defined but never used.
>>
>> Signed-off-by: Tree Davies <tdavies@darkphysics.net>
>> ---
>>   drivers/staging/rtl8192e/rtllib.h | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
>> index 0a8c44e497f5..c0a24826cd3b 100644
>> --- a/drivers/staging/rtl8192e/rtllib.h
>> +++ b/drivers/staging/rtl8192e/rtllib.h
>> @@ -103,7 +103,6 @@ struct cb_desc {
>>   	/* Tx Desc Related flags (8-9) */
>>   	u8 bLastIniPkt:1;
>>   	u8 bCmdOrInit:1;
>> -	u8 bFirstSeg:1;
>>   	u8 bLastSeg:1;
>>   	u8 bEncrypt:1;
>>   	u8 tx_dis_rate_fallback:1;
> 
> I don't think you can remove these.  They're part of the protocol for
> talking to the firmware.
> 
> regards,
> dan carpenter
> 

Hi Dan,

thanks for your response.

struct cb_desc is used in conjunction with this line:
struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + 8);
from skbuff.h:
	/*
	 * This is the control buffer. It is free to use for every
	 * layer. Please put your private variables there. If you
	 * want to keep them across layers you have to do a skb_clone()
	 * first. This is owned by whoever has the skb queued ATM.
	 */
	char			cb[48] __aligned(8);

I think it has to do with the sku buffer and can be changed.

Here a test:
kernel@matrix-ESPRIMO-P710:~/Documents/git/kernels/staging$ git diff
diff --git a/drivers/staging/rtl8192e/rtllib.h 
b/drivers/staging/rtl8192e/rtllib.h
index cc9070f39004..f29efc605ba9 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -100,6 +100,7 @@ static inline void *netdev_priv_rsl(struct 
net_device *dev)
  /* defined for skb cb field */
  /* At most 28 byte */
  struct cb_desc {
+       u8 ph_temp[7];
         /* Tx Desc Related flags (8-9) */
         u8 bLastIniPkt:1;
         u8 bCmdOrInit:1;
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c 
b/drivers/staging/rtl8192e/rtllib_softmac.c
index ee527ba5d1a8..93292fc3faaf 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -189,6 +189,9 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, 
struct rtllib_device *ieee)
         struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + 8);

         spin_lock_irqsave(&ieee->lock, flags);
+       printk("Setting tcb_desc !!!\n");
+       tcb_desc->ph_temp[0] = 0xAA;
+       tcb_desc->ph_temp[6] = 0xAA;

         /* called with 2nd param 0, no mgmt lock required */
         rtllib_sta_wakeup(ieee, 0);

Here the log:
[ 9024.740612] rtl819xE 0000:03:00.0: Adapter(8192 PCI-E) is found - 
DeviceID=8192
[ 9025.773658] Setting tcb_desc !!!
[ 9025.773783] Setting tcb_desc !!!
[ 9025.797635] Setting tcb_desc !!!
[ 9025.797701] Setting tcb_desc !!!
[ 9025.849687] Setting tcb_desc !!!
[ 9025.849743] Setting tcb_desc !!!
[ 9025.977703] Setting tcb_desc !!!
[ 9025.977740] Setting tcb_desc !!!
[ 9026.105693] Setting tcb_desc !!!

Performance as expected OK.

Please reconsider your decision?

Thanks

Bye Philipp
Re: [PATCH 1/4] Staging: rtl8192e: Remove variable bFirstSeg
Posted by Dan Carpenter 2 years ago
The struct talks about firmware and it has reserved bits so that's what
confused me.

You know this code better than I do so since you're fine with it, then
I'm fine with it.

regards,
dan carpenter