RE: [PATCH] igb: Fix a test with HWTSTAMP_TX_ON

2018-02-13 Thread Brown, Aaron F
> From: netdev-ow...@vger.kernel.org [mailto:netdev-
> ow...@vger.kernel.org] On Behalf Of Christophe JAILLET
> Sent: Tuesday, February 6, 2018 11:48 AM
> To: Kirsher, Jeffrey T <jeffrey.t.kirs...@intel.com>
> Cc: intel-wired-...@lists.osuosl.org; net...@vger.kernel.org; linux-
> ker...@vger.kernel.org; kernel-janit...@vger.kernel.org; Christophe
> JAILLET <christophe.jail...@wanadoo.fr>
> Subject: [PATCH] igb: Fix a test with HWTSTAMP_TX_ON
> 
> 'HWTSTAMP_TX_ON' should be handled as a value, not as a bit mask.
> The modified code should behave the same, because HWTSTAMP_TX_ON is
> 1
> and no other possible values of 'tx_type' would match the test.
> However, this is more future-proof, should other values be allowed one day.
> 
> See 'struct hwtstamp_config' in 'include/uapi/linux/net_tstamp.h'
> 
> This fixes a warning reported by smatch:
>igb_xmit_frame_ring() warn: bit shifter 'HWTSTAMP_TX_ON' used for
> logical '&'
> 
> Fixes: 26bd4e2db06be ("igb: protect TX timestamping from API misuse")
> Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr>
> ---
>  drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Tested-by: Aaron Brown <aaron.f.br...@intel.com>


RE: [PATCH] igb: Fix a test with HWTSTAMP_TX_ON

2018-02-13 Thread Brown, Aaron F
> From: netdev-ow...@vger.kernel.org [mailto:netdev-
> ow...@vger.kernel.org] On Behalf Of Christophe JAILLET
> Sent: Tuesday, February 6, 2018 11:48 AM
> To: Kirsher, Jeffrey T 
> Cc: intel-wired-...@lists.osuosl.org; net...@vger.kernel.org; linux-
> ker...@vger.kernel.org; kernel-janit...@vger.kernel.org; Christophe
> JAILLET 
> Subject: [PATCH] igb: Fix a test with HWTSTAMP_TX_ON
> 
> 'HWTSTAMP_TX_ON' should be handled as a value, not as a bit mask.
> The modified code should behave the same, because HWTSTAMP_TX_ON is
> 1
> and no other possible values of 'tx_type' would match the test.
> However, this is more future-proof, should other values be allowed one day.
> 
> See 'struct hwtstamp_config' in 'include/uapi/linux/net_tstamp.h'
> 
> This fixes a warning reported by smatch:
>igb_xmit_frame_ring() warn: bit shifter 'HWTSTAMP_TX_ON' used for
> logical '&'
> 
> Fixes: 26bd4e2db06be ("igb: protect TX timestamping from API misuse")
> Signed-off-by: Christophe JAILLET 
> ---
>  drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Tested-by: Aaron Brown 


Re: [PATCH] igb: Fix a test with HWTSTAMP_TX_ON

2018-02-06 Thread Richard Cochran
On Tue, Feb 06, 2018 at 08:47:59PM +0100, Christophe JAILLET wrote:
> 'HWTSTAMP_TX_ON' should be handled as a value, not as a bit mask.
> The modified code should behave the same, because HWTSTAMP_TX_ON is 1
> and no other possible values of 'tx_type' would match the test.
> However, this is more future-proof, should other values be allowed one day.

Nice catch, and I am going to introduce more tx_type values soon.

Thanks,
Richard


Re: [PATCH] igb: Fix a test with HWTSTAMP_TX_ON

2018-02-06 Thread Richard Cochran
On Tue, Feb 06, 2018 at 08:47:59PM +0100, Christophe JAILLET wrote:
> 'HWTSTAMP_TX_ON' should be handled as a value, not as a bit mask.
> The modified code should behave the same, because HWTSTAMP_TX_ON is 1
> and no other possible values of 'tx_type' would match the test.
> However, this is more future-proof, should other values be allowed one day.

Nice catch, and I am going to introduce more tx_type values soon.

Thanks,
Richard


[PATCH] igb: Fix a test with HWTSTAMP_TX_ON

2018-02-06 Thread Christophe JAILLET
'HWTSTAMP_TX_ON' should be handled as a value, not as a bit mask.
The modified code should behave the same, because HWTSTAMP_TX_ON is 1
and no other possible values of 'tx_type' would match the test.
However, this is more future-proof, should other values be allowed one day.

See 'struct hwtstamp_config' in 'include/uapi/linux/net_tstamp.h'

This fixes a warning reported by smatch:
   igb_xmit_frame_ring() warn: bit shifter 'HWTSTAMP_TX_ON' used for logical '&'

Fixes: 26bd4e2db06be ("igb: protect TX timestamping from API misuse")
Signed-off-by: Christophe JAILLET 
---
 drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index c208753ff5b7..e945d1f7c7fe 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -5727,7 +5727,7 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
 
-   if (adapter->tstamp_config.tx_type & HWTSTAMP_TX_ON &&
+   if (adapter->tstamp_config.tx_type == HWTSTAMP_TX_ON &&
!test_and_set_bit_lock(__IGB_PTP_TX_IN_PROGRESS,
   >state)) {
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
-- 
2.14.1


---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel 
antivirus Avast.
https://www.avast.com/antivirus



[PATCH] igb: Fix a test with HWTSTAMP_TX_ON

2018-02-06 Thread Christophe JAILLET
'HWTSTAMP_TX_ON' should be handled as a value, not as a bit mask.
The modified code should behave the same, because HWTSTAMP_TX_ON is 1
and no other possible values of 'tx_type' would match the test.
However, this is more future-proof, should other values be allowed one day.

See 'struct hwtstamp_config' in 'include/uapi/linux/net_tstamp.h'

This fixes a warning reported by smatch:
   igb_xmit_frame_ring() warn: bit shifter 'HWTSTAMP_TX_ON' used for logical '&'

Fixes: 26bd4e2db06be ("igb: protect TX timestamping from API misuse")
Signed-off-by: Christophe JAILLET 
---
 drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index c208753ff5b7..e945d1f7c7fe 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -5727,7 +5727,7 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
 
-   if (adapter->tstamp_config.tx_type & HWTSTAMP_TX_ON &&
+   if (adapter->tstamp_config.tx_type == HWTSTAMP_TX_ON &&
!test_and_set_bit_lock(__IGB_PTP_TX_IN_PROGRESS,
   >state)) {
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
-- 
2.14.1


---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel 
antivirus Avast.
https://www.avast.com/antivirus