[PATCH v3 04/14] test: cryptodev use rte_pktmbuf_mtod_offset

Stephen Hemminger stephen at networkplumber.org
Fri Jul 7 22:32:11 CEST 2023


On Fri, 7 Jul 2023 13:46:07 +0100
Ferruh Yigit <ferruh.yigit at amd.com> wrote:

> On 7/6/2023 6:59 PM, Stephen Hemminger wrote:
> > Based off patch generated by cocci/mtod-offset.cocci.
> > With some cleanup to shorten lines by using conditional
> > with omitted operand.
> > 
> > Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>  
> 
> <...>
> 
> > @@ -5163,9 +5169,9 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata,
> >  		debug_hexdump(stdout, "ciphertext expected:",
> >  			tdata->ciphertext.data, tdata->ciphertext.len >> 3);
> >  
> > -		ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
> > -			+ (tdata->digest.offset_bytes == 0 ?
> > -		plaintext_pad_len : tdata->digest.offset_bytes);
> > +		ut_params->digest = rte_pktmbuf_mtod_offset(ut_params->obuf,
> > +					uint8_t *,
> > +					tdata->digest.offset_bytes ? : plaintext_pad_len);
> >    
> 
> As far as I know "x ?: y" support is gcc extention, what about sticking
> to standard syntax?

Already used five places in DPDK, so didn't seem like a problem.


More information about the dev mailing list