Project

General

Profile

Actions

Bug #5003

closed

osmo-pcu: Fix structs containing bit-fields on big endian systems

Added by pespin about 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
02/01/2021
Due date:
% Done:

100%

Spec Reference:

Description

Apparently we have some structs in osmo-pcu containing bit fieldswhich don't have the big endian definition.

Example in rlc.h (there could be more places):

extern "C" {
/* TS 04.60  10.2.2 */
#if OSMO_IS_LITTLE_ENDIAN
struct rlc_ul_header {
    uint8_t    r:1,
         si:1,
         cv:4,
         pt:2;
    uint8_t    ti:1,
         tfi:5,
         pi:1,
         spare:1;
    uint8_t    e:1,
         bsn:7;
} __attribute__ ((packed));

struct rlc_dl_header {
    uint8_t    usf:3,
         s_p:1,
         rrbp:2,
         pt:2;
    uint8_t    fbi:1,
         tfi:5,
         pr:2;
    uint8_t    e:1,
         bsn:7;
} __attribute__ ((packed));

struct rlc_li_field {
    uint8_t    e:1,
         m:1,
         li:6;
} __attribute__ ((packed));

struct rlc_li_field_egprs {
    uint8_t    e:1,
         li:7;
} __attribute__ ((packed));
#else
#  error "Only little endian headers are supported yet. TODO: add missing structs" 
#endif
}

We should use scripts available in libosmocore to generate proper big-endian definitions.

Actions #1

Updated by pespin about 3 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 90

Fixed here:
https://gerrit.osmocom.org/c/osmo-pcu/+/22688 rlc.h: Fix struct bit fields on big endian systems

I also went through other osmocom projects which had some structs missing the big endian case.

Actions #2

Updated by pespin about 3 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

Merged, closing.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)