linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next, PATCH] net: stmmac: use correct define to get rx timestamp on GMAC4
@ 2019-02-14 14:12 Alexandre Torgue
  2019-02-14 14:18 ` Jose Abreu
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Torgue @ 2019-02-14 14:12 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Jose Abreu, davem
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel, Alexandre Torgue

In dwmac4_wrback_get_rx_timestamp_status we looking for a RX timestamp.
For that receive descriptors are handled and so we should use defines
related to receive descriptors. It'll no change the functional behavior
as RDES3_RDES1_VALID=TDES3_RS1V=BIT(26) but it makes code easier to read.

Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
index 20299f6..9f062b3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
@@ -268,7 +268,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, void *next_desc,
 	int ret = -EINVAL;
 
 	/* Get the status from normal w/b descriptor */
-	if (likely(p->des3 & TDES3_RS1V)) {
+	if (likely(p->des3 & RDES3_RDES1_VALID)) {
 		if (likely(le32_to_cpu(p->des1) & RDES1_TIMESTAMP_AVAILABLE)) {
 			int i = 0;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [net-next, PATCH] net: stmmac: use correct define to get rx timestamp on GMAC4
  2019-02-14 14:12 [net-next, PATCH] net: stmmac: use correct define to get rx timestamp on GMAC4 Alexandre Torgue
@ 2019-02-14 14:18 ` Jose Abreu
  2019-02-14 15:00   ` Alexandre Torgue
  0 siblings, 1 reply; 5+ messages in thread
From: Jose Abreu @ 2019-02-14 14:18 UTC (permalink / raw)
  To: Alexandre Torgue, Giuseppe Cavallaro, Jose Abreu, davem
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel

Hi Alexandre,

On 2/14/2019 2:12 PM, Alexandre Torgue wrote:
> In dwmac4_wrback_get_rx_timestamp_status we looking for a RX timestamp.
> For that receive descriptors are handled and so we should use defines
> related to receive descriptors. It'll no change the functional behavior
> as RDES3_RDES1_VALID=TDES3_RS1V=BIT(26) but it makes code easier to read.
> 
> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> index 20299f6..9f062b3 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
> @@ -268,7 +268,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, void *next_desc,
>  	int ret = -EINVAL;
>  
>  	/* Get the status from normal w/b descriptor */
> -	if (likely(p->des3 & TDES3_RS1V)) {
> +	if (likely(p->des3 & RDES3_RDES1_VALID)) {

Shouldn't this also use le32_to_cpu() like bellow ?

Thanks,
Jose Miguel Abreu

>  		if (likely(le32_to_cpu(p->des1) & RDES1_TIMESTAMP_AVAILABLE)) {
>  			int i = 0;
>  
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [net-next, PATCH] net: stmmac: use correct define to get rx timestamp on GMAC4
  2019-02-14 14:18 ` Jose Abreu
@ 2019-02-14 15:00   ` Alexandre Torgue
  2019-02-14 15:30     ` Jose Abreu
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Torgue @ 2019-02-14 15:00 UTC (permalink / raw)
  To: Jose Abreu, Giuseppe Cavallaro, davem
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel

Hi Jose

On 2/14/19 3:18 PM, Jose Abreu wrote:
> Hi Alexandre,
> 
> On 2/14/2019 2:12 PM, Alexandre Torgue wrote:
>> In dwmac4_wrback_get_rx_timestamp_status we looking for a RX timestamp.
>> For that receive descriptors are handled and so we should use defines
>> related to receive descriptors. It'll no change the functional behavior
>> as RDES3_RDES1_VALID=TDES3_RS1V=BIT(26) but it makes code easier to read.
>>
>> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>> index 20299f6..9f062b3 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>> @@ -268,7 +268,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, void *next_desc,
>>   	int ret = -EINVAL;
>>   
>>   	/* Get the status from normal w/b descriptor */
>> -	if (likely(p->des3 & TDES3_RS1V)) {
>> +	if (likely(p->des3 & RDES3_RDES1_VALID)) {
> 
> Shouldn't this also use le32_to_cpu() like bellow ?

I agree. I focused on cosmetic but yes you are right, we have to take 
car about endianness as this IP is used by different processors (using 
different endianness). I gonna send a v2.
I think dwmac4_rx_check_timestamp have the same kind of issue. Another 
patch should be sent for it. no ?

regards
Alex



> 
> Thanks,
> Jose Miguel Abreu
> 
>>   		if (likely(le32_to_cpu(p->des1) & RDES1_TIMESTAMP_AVAILABLE)) {
>>   			int i = 0;
>>   
>>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [net-next, PATCH] net: stmmac: use correct define to get rx timestamp on GMAC4
  2019-02-14 15:00   ` Alexandre Torgue
@ 2019-02-14 15:30     ` Jose Abreu
  2019-02-14 15:56       ` Alexandre Torgue
  0 siblings, 1 reply; 5+ messages in thread
From: Jose Abreu @ 2019-02-14 15:30 UTC (permalink / raw)
  To: Alexandre Torgue, Jose Abreu, Giuseppe Cavallaro, davem
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel

On 2/14/2019 3:00 PM, Alexandre Torgue wrote:
> Hi Jose
> 
> On 2/14/19 3:18 PM, Jose Abreu wrote:
>> Hi Alexandre,
>>
>> On 2/14/2019 2:12 PM, Alexandre Torgue wrote:
>>> In dwmac4_wrback_get_rx_timestamp_status we looking for a RX
>>> timestamp.
>>> For that receive descriptors are handled and so we should use
>>> defines
>>> related to receive descriptors. It'll no change the functional
>>> behavior
>>> as RDES3_RDES1_VALID=TDES3_RS1V=BIT(26) but it makes code
>>> easier to read.
>>>
>>> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
>>>
>>> diff --git
>>> a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>>> b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>>> index 20299f6..9f062b3 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>>> @@ -268,7 +268,7 @@ static int
>>> dwmac4_wrback_get_rx_timestamp_status(void *desc, void
>>> *next_desc,
>>>       int ret = -EINVAL;
>>>         /* Get the status from normal w/b descriptor */
>>> -    if (likely(p->des3 & TDES3_RS1V)) {
>>> +    if (likely(p->des3 & RDES3_RDES1_VALID)) {
>>
>> Shouldn't this also use le32_to_cpu() like bellow ?
> 
> I agree. I focused on cosmetic but yes you are right, we have to
> take car about endianness as this IP is used by different
> processors (using different endianness). I gonna send a v2.
> I think dwmac4_rx_check_timestamp have the same kind of issue.
> Another patch should be sent for it. no ?

Yeah. Maybe you can send all of that in this v2 patch also ?

Thanks,
Jose Miguel Abreu

> 
> regards
> Alex
> 
> 
> 
>>
>> Thanks,
>> Jose Miguel Abreu
>>
>>>           if (likely(le32_to_cpu(p->des1) &
>>> RDES1_TIMESTAMP_AVAILABLE)) {
>>>               int i = 0;
>>>  

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [net-next, PATCH] net: stmmac: use correct define to get rx timestamp on GMAC4
  2019-02-14 15:30     ` Jose Abreu
@ 2019-02-14 15:56       ` Alexandre Torgue
  0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Torgue @ 2019-02-14 15:56 UTC (permalink / raw)
  To: Jose Abreu, Giuseppe Cavallaro, davem
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel



On 2/14/19 4:30 PM, Jose Abreu wrote:
> On 2/14/2019 3:00 PM, Alexandre Torgue wrote:
>> Hi Jose
>>
>> On 2/14/19 3:18 PM, Jose Abreu wrote:
>>> Hi Alexandre,
>>>
>>> On 2/14/2019 2:12 PM, Alexandre Torgue wrote:
>>>> In dwmac4_wrback_get_rx_timestamp_status we looking for a RX
>>>> timestamp.
>>>> For that receive descriptors are handled and so we should use
>>>> defines
>>>> related to receive descriptors. It'll no change the functional
>>>> behavior
>>>> as RDES3_RDES1_VALID=TDES3_RS1V=BIT(26) but it makes code
>>>> easier to read.
>>>>
>>>> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
>>>>
>>>> diff --git
>>>> a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>>>> b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>>>> index 20299f6..9f062b3 100644
>>>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>>>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
>>>> @@ -268,7 +268,7 @@ static int
>>>> dwmac4_wrback_get_rx_timestamp_status(void *desc, void
>>>> *next_desc,
>>>>        int ret = -EINVAL;
>>>>          /* Get the status from normal w/b descriptor */
>>>> -    if (likely(p->des3 & TDES3_RS1V)) {
>>>> +    if (likely(p->des3 & RDES3_RDES1_VALID)) {
>>>
>>> Shouldn't this also use le32_to_cpu() like bellow ?
>>
>> I agree. I focused on cosmetic but yes you are right, we have to
>> take car about endianness as this IP is used by different
>> processors (using different endianness). I gonna send a v2.
>> I think dwmac4_rx_check_timestamp have the same kind of issue.
>> Another patch should be sent for it. no ?
> 
> Yeah. Maybe you can send all of that in this v2 patch also ?

I'll send another one separately, in order to have a correct commit 
header. I send it now.

> 
> Thanks,
> Jose Miguel Abreu
> 
>>
>> regards
>> Alex
>>
>>
>>
>>>
>>> Thanks,
>>> Jose Miguel Abreu
>>>
>>>>            if (likely(le32_to_cpu(p->des1) &
>>>> RDES1_TIMESTAMP_AVAILABLE)) {
>>>>                int i = 0;
>>>>   

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-14 15:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-14 14:12 [net-next, PATCH] net: stmmac: use correct define to get rx timestamp on GMAC4 Alexandre Torgue
2019-02-14 14:18 ` Jose Abreu
2019-02-14 15:00   ` Alexandre Torgue
2019-02-14 15:30     ` Jose Abreu
2019-02-14 15:56       ` Alexandre Torgue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).