[v3,13/14] net/mlx4: use rte_pktmbuf_mtod_offset

Message ID 20230706175938.62721-14-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Use rte_pktmbuf_mtod_offset() where possible |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger July 6, 2023, 5:59 p.m. UTC
  Autogenerated with cocci/mtod-offset.cocci.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/mlx4/mlx4_rxtx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Ferruh Yigit July 7, 2023, 12:46 p.m. UTC | #1
On 7/6/2023 6:59 PM, Stephen Hemminger wrote:
> Autogenerated with cocci/mtod-offset.cocci.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  drivers/net/mlx4/mlx4_rxtx.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c
> index 059e432a63fc..d5feeb7f7e6d 100644
> --- a/drivers/net/mlx4/mlx4_rxtx.c
> +++ b/drivers/net/mlx4/mlx4_rxtx.c
> @@ -1014,9 +1014,9 @@ mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
>  			 * loopback in eSwitch, so that VFs and PF can
>  			 * communicate with each other.
>  			 */
> -			srcrb.flags16[0] = *(rte_pktmbuf_mtod(buf, uint16_t *));
> -			ctrl->imm = *(rte_pktmbuf_mtod_offset(buf, uint32_t *,
> -					      sizeof(uint16_t)));
> +			srcrb.flags16[0] = *rte_pktmbuf_mtod(buf, uint16_t *);
> +			ctrl->imm = *rte_pktmbuf_mtod_offset(buf, uint32_t *,
> +							     sizeof(uint16_t));
>  		} else {
>  			ctrl->imm = 0;
>  		}

Although parenthesis may not be required, keeping them looks more clear
to me; personal preferences.

And patch title is not accurate for this patch.
  

Patch

diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c
index 059e432a63fc..d5feeb7f7e6d 100644
--- a/drivers/net/mlx4/mlx4_rxtx.c
+++ b/drivers/net/mlx4/mlx4_rxtx.c
@@ -1014,9 +1014,9 @@  mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
 			 * loopback in eSwitch, so that VFs and PF can
 			 * communicate with each other.
 			 */
-			srcrb.flags16[0] = *(rte_pktmbuf_mtod(buf, uint16_t *));
-			ctrl->imm = *(rte_pktmbuf_mtod_offset(buf, uint32_t *,
-					      sizeof(uint16_t)));
+			srcrb.flags16[0] = *rte_pktmbuf_mtod(buf, uint16_t *);
+			ctrl->imm = *rte_pktmbuf_mtod_offset(buf, uint32_t *,
+							     sizeof(uint16_t));
 		} else {
 			ctrl->imm = 0;
 		}