Thread (14 messages) flat view 14 messages, 2 authors, 2021-03-08

RE: [PATCH net-next v2 5/6] net: qualcomm: rmnet: don't use C bit-fields in rmnet checksum trailer

From: David Laight <hidden>
Date: 2021-03-08 13:56:41
Also in: lkml

...
quoted
quoted
-	if (!csum_trailer->valid) {
+	if (!u8_get_bits(csum_trailer->flags, MAP_CSUM_DL_VALID_FMASK)) {
Is that just an overcomplicated way of saying:
	if (!(csum_trailer->flags & MAP_CSUM_DL_VALID_FMASK)) {
Yes it is.  I defined and used all the field masks in a
consistent way, but I do think it will read better the
way you suggest.  Bjorn also asked me privately whether
GENMASK(15, 15) was just the same as BIT(15) (it is).

I will post version 3 of the series, identifying which
fields are single bit/Boolean.  For those I will define
the value using BIT() and will set/extract using simple
AND/OR operators.  I won't use the _FMASK suffix on such
fields.
Even for the checksum offset a simple 'offset << CONSTANT'
is enough.
If it is the bottom bits then even that isn't really needed.
You might want to mask off high bits - but that is an error
path that needs to have been checked earlier.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help