Skip to content

Commit

Permalink
CXGBE: fix big-endian behaviour
Browse files Browse the repository at this point in the history
The setbit/clearbit pair casts the bitfield pointer
to uint8_t* which effectively treats its contents as
little-endian variable. The ffs() function accepts int as
the parameter, which is big-endian. Use uint8_t here to
avoid mismatch, as we have only 4 doorbells.

Submitted by:          Wojciech Macek <[email protected]>
Reviewed by:           np
Obtained from:         Semihalf
Sponsored by:          QCM Technologies
Differential revision: https://reviews.freebsd.org/D13084
  • Loading branch information
Wojciech Macek authored and Wojciech Macek committed Nov 15, 2017
1 parent 9e45a31 commit ec7f8d5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sys/dev/cxgbe/adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ struct sge_eq {
struct mtx eq_lock;

struct tx_desc *desc; /* KVA of descriptor ring */
uint16_t doorbells;
uint8_t doorbells;
volatile uint32_t *udb; /* KVA of doorbell (lies within BAR2) */
u_int udb_qid; /* relative qid within the doorbell page */
uint16_t sidx; /* index of the entry with the status page */
Expand Down Expand Up @@ -695,7 +695,7 @@ struct sge_nm_txq {
uint16_t equiqidx; /* EQUIQ last requested at this pidx */
uint16_t equeqidx; /* EQUEQ last requested at this pidx */
uint16_t dbidx; /* pidx of the most recent doorbell */
uint16_t doorbells;
uint8_t doorbells;
volatile uint32_t *udb;
u_int udb_qid;
u_int cntxt_id;
Expand Down Expand Up @@ -807,7 +807,7 @@ struct adapter {
struct l2t_data *l2t; /* L2 table */
struct tid_info tids;

uint16_t doorbells;
uint8_t doorbells;
int offload_map; /* ports with IFCAP_TOE enabled */
int active_ulds; /* ULDs activated on this adapter */
int flags;
Expand Down

0 comments on commit ec7f8d5

Please sign in to comment.