forked from luck/tmp_suning_uos_patched
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: 26bd4e2db0
("igb: protect TX timestamping from API misuse")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
17a0b9add6
commit
0a6f2f05a2
|
@ -5749,7 +5749,7 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
|
||||||
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
|
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
|
||||||
struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
|
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,
|
!test_and_set_bit_lock(__IGB_PTP_TX_IN_PROGRESS,
|
||||||
&adapter->state)) {
|
&adapter->state)) {
|
||||||
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
|
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user