net/cxgbe: init data value before reading seeprom
PATCH 1/3 net/cxgbe: init data value before reading seeprom
data value could have been garbage if VPD access timed out for VPD read request could not been issued.
Found with clang static analysis:drivers/net/cxgbe/base/t4_hw.c:1577:22:
warning: The left operand of '&' is a garbage value
} while ((stats_reg & 0x1) && --max_poll);
~~~~~~~~~ ^--- drivers/net/cxgbe/base/t4_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/cxgbe/base/t4_hw.c +1 -1
@@ -1532,7 +1532,7 @@ int t4_seeprom_write(struct adapter *adapter, u32 addr, u32 data) {unsigned int base = adapter->params.pci.vpd_cap_addr;int ret; -u32 stats_reg; +u32 stats_reg =0 ;int max_poll;/* VPD Accesses must alway be 4-byte aligned!
Signature · 1 line
2.11.0
PATCH 2/3 net/cxgbe: remove unused variable usage
Found with clang static analysis:drivers/net/cxgbe/sge.c:900:3: warning:
Value stored to 'in_use' is never read
in_use += q->size;
^ ~~~~~~~--- drivers/net/cxgbe/sge.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/cxgbe/sge.c +0 -4
@@ -891,14 +891,10 @@ static inline int should_tx_packet_coalesce(struct sge_eth_txq *txq,unsigned int flits, ndesc;unsigned char type =0 ;int credits, hw_cidx =ntohs (q->stat->cidx); -int in_use = q->pidx - hw_cidx +flits_to_desc (q->coalesce.flits);/* use coal WR type 1 when no frags are present */ type = (mbuf->nb_segs ==1 ) ?1 :0 ; -if (in_use <0 ) - in_use += q->size; -if (unlikely (type != q->coalesce.type && q->coalesce.idx))ship_tx_pkt_coalesce_wr (adap, txq);
Signature · 1 line
2.11.0
PATCH 3/3 net/cxgbe: remove unused variable
In reply to Emmanuel Roullit--- drivers/net/cxgbe/sge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/cxgbe/sge.c +1 -1
@@ -890,7 +890,7 @@ static inline int should_tx_packet_coalesce(struct sge_eth_txq *txq,struct sge_txq *q = &txq->q;unsigned int flits, ndesc;unsigned char type =0 ; -int credits, hw_cidx =ntohs (q->stat->cidx); +int credits;/* use coal WR type 1 when no frags are present */ type = (mbuf->nb_segs ==1 ) ?1 :0 ;
Signature · 1 line
2.11.0
Ferruh Yigit
AppliedQuoted 6 lines · Emmanuel Roullit
data value could have been garbage if VPD access timed out for VPD read request could not been issued.
Found with clang static analysis:
drivers/net/cxgbe/base/t4_hw.c:1577:22:
warning: The left operand of '&' is a garbage value
Quoted 6 lines
} while ((stats_reg & 0x1) && --max_poll); ~~~~~~~~~ ^Fixes 17ba077c5c54 ("net/cxgbe: support register dump")Signed-off-by Emmanuel Roullit <[email protected]>
Applied to dpdk-next-net/master, thanks.
Re: [PATCH 2/3] net/cxgbe: remove unused variable usage
In reply to Emmanuel RoullitQuoted 18 lines · Emmanuel Roullit
Found with clang static analysis:
drivers/net/cxgbe/sge.c:900:3: warning:
Value stored to 'in_use' is never readin_use += q->size; ^ ~~~~~~~Fixes c167acb61278 ("net/cxgbe: use I/O device memory read/write API")Signed-off-by Emmanuel Roullit <[email protected]>--- drivers/net/cxgbe/sge.c | 4 ---- 1 file changed, 4 deletions(-)drivers/net/cxgbe/sge.c +0
-0
drivers/net/cxgbe/sge.c static inline int should_tx_packet_coalesce(struct sge_eth_txq *txq, · line 900
Quoted 10 lines
drivers/net/cxgbe/sge.c +0
-3@@ -891,14 +891,10 @@ static inline int should_tx_packet_coalesce(struct sge_eth_txq *txq,unsigned int flits, ndesc;unsigned char type =0 ;int credits, hw_cidx =ntohs (q->stat->cidx); -int in_use = q->pidx - hw_cidx +flits_to_desc (q->coalesce.flits);/* use coal WR type 1 when no frags are present */ type = (mbuf->nb_segs ==1 ) ?1 :0 ; -if (in_use <0 ) - in_use += q->size;
Intention can be "q->in_use" here. That change can be proper fix instead of removing.
I will wait for maintainers comment to get the patch.
Quoted 5 lines
drivers/net/cxgbe/sge.c +0
-1-if (unlikely (type != q->coalesce.type && q->coalesce.idx))ship_tx_pkt_coalesce_wr (adap, txq);
Re: [PATCH 3/3] net/cxgbe: remove unused variable
In reply to Emmanuel RoullitQuoted 12 lines · Emmanuel Roullit
Fixes c167acb61278 ("net/cxgbe: use I/O device memory read/write API")Signed-off-by Emmanuel Roullit <[email protected]>--- drivers/net/cxgbe/sge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/cxgbe/sge.c +0
-0
drivers/net/cxgbe/sge.c static inline int should_tx_packet_coalesce(struct sge_eth_txq *txq, · line 893
Quoted 5 lines
drivers/net/cxgbe/sge.c +1
-1@@ -890,7 +890,7 @@ static inline int should_tx_packet_coalesce(struct sge_eth_txq *txq,struct sge_txq *q = &txq->q;unsigned int flits, ndesc;unsigned char type =0 ; -int credits, hw_cidx =ntohs (q->stat->cidx); +int credits;
This depends on patch 2/3, so this patch will wait it to be clarified.
Quoted 4 lines
drivers/net/cxgbe/sge.c +0
-0/* use coal WR type 1 when no frags are present */ type = (mbuf->nb_segs ==1 ) ?1 :0 ;
Re: [PATCH 2/3] net/cxgbe: remove unused variable usage
In reply to Ferruh YigitQuoted 8 lines · Ferruh Yigit
Quoted 7 lines · Emmanuel Roullit
Found with clang static analysis:
drivers/net/cxgbe/sge.c:900:3: warning:
Value stored to 'in_use' is never readin_use += q->size; ^ ~~~~~~~Fixes c167acb61278 ("net/cxgbe: use I/O device memory read/write API")
This fixes line seems to be wrong. Should be:
Quoted 19 lines
Quoted 19 lines
Signed-off-by Emmanuel Roullit <[email protected]>--- drivers/net/cxgbe/sge.c | 4 ---- 1 file changed, 4 deletions(-)drivers/net/cxgbe/sge.c +0
-1@@ -891,14 +891,10 @@ static inline int should_tx_packet_coalesce(struct sge_eth_txq *txq,unsigned int flits, ndesc;unsigned char type =0 ;int credits, hw_cidx =ntohs (q->stat->cidx); -int in_use = q->pidx - hw_cidx +flits_to_desc (q->coalesce.flits);/* use coal WR type 1 when no frags are present */ type = (mbuf->nb_segs ==1 ) ?1 :0 ;
Quoted 8 lines
drivers/net/cxgbe/sge.c static inline int should_tx_packet_coalesce(struct sge_eth_txq *txq, · line 900
Quoted 2 lines
drivers/net/cxgbe/sge.c +0
-2-if (in_use <0 ) - in_use += q->size;Intention can be "
q->in_use" here. That change can be proper fix instead of removing.I will wait for maintainers comment to get the patch.
in_use can be removed. Also, Patch 2 and 3 can be merged.
Quoted 6 lines
drivers/net/cxgbe/sge.c static inline int should_tx_packet_coalesce(struct sge_eth_txq *txq, · line 900
Quoted 5 lines
drivers/net/cxgbe/sge.c +0
-1-if (unlikely (type != q->coalesce.type && q->coalesce.idx))ship_tx_pkt_coalesce_wr (adap, txq);
Thanks,
Rahul
Re: [PATCH 2/3] net/cxgbe: remove unused variable usage
Quoted 10 lines · Rahul Lakkireddy
Quoted 8 lines · Ferruh Yigit
Quoted 7 lines · Emmanuel Roullit
Found with clang static analysis:
drivers/net/cxgbe/sge.c:900:3: warning:
Value stored to 'in_use' is never readin_use += q->size; ^ ~~~~~~~Fixes c167acb61278 ("net/cxgbe: use I/O device memory read/write API")
Quoted 8 lines
This fixes line seems to be wrong. Should be:
Quoted 2 lines
Quoted 2 lines
Signed-off-by Emmanuel Roullit <[email protected]>Fixes 4a01078b4fd1 ("cxgbe: add Tx support")
Applied to dpdk-next-net/master, thanks.
(patch 2/3 and 3/3 merged)
Quoted 10 lines · Ferruh Yigit
Quoted 9 lines · Emmanuel Roullit
data value could have been garbage if VPD access timed out for VPD read request could not been issued.
Found with clang static analysis:
drivers/net/cxgbe/base/t4_hw.c:1577:22:
warning: The left operand of '&' is a garbage value} while ((stats_reg & 0x1) && --max_poll); ~~~~~~~~~ ^
Quoted 6 lines
Quoted 3 lines
Fixes 17ba077c5c54 ("net/cxgbe: support register dump")Signed-off-by Emmanuel Roullit <[email protected]>Applied to dpdk-next-net/master, thanks.
Re: [PATCH 2/3] net/cxgbe: remove unused variable usage
In reply to Ferruh YigitQuoted 16 lines · Ferruh Yigit
Quoted 15 lines · Rahul Lakkireddy
Quoted 8 lines · Ferruh Yigit
Quoted 7 lines · Emmanuel Roullit
Found with clang static analysis:
drivers/net/cxgbe/sge.c:900:3: warning:
Value stored to 'in_use' is never readin_use += q->size; ^ ~~~~~~~Fixes c167acb61278 ("net/cxgbe: use I/O device memory read/write API")This fixes line seems to be wrong. Should be:
Quoted 1 line
Quoted 1 line
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Emmanuel Roullit <[email protected]>Fixes 4a01078b4fd1 ("cxgbe: add Tx support")
I doubt the necessary of picking it to a stable release: it doesn't fix a real bug after all. Therefore, I will drop it for v16.11.1.
--yliu
Quoted 7 lines
Acked-by Rahul Lakkireddy <[email protected]>Applied to dpdk-next-net/master, thanks.
(patch 2/3 and 3/3 merged)