root/drivers/net/wireless/broadcom/brcm80211/brcmfmac/commonring.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 // SPDX-License-Identifier: ISC
   2 /*
   3  * Copyright (c) 2014 Broadcom Corporation
   4  */
   5 #ifndef BRCMFMAC_COMMONRING_H
   6 #define BRCMFMAC_COMMONRING_H
   7 
   8 
   9 struct brcmf_commonring {
  10         u16 r_ptr;
  11         u16 w_ptr;
  12         u16 f_ptr;
  13         u16 depth;
  14         u16 item_len;
  15 
  16         void *buf_addr;
  17 
  18         int (*cr_ring_bell)(void *ctx);
  19         int (*cr_update_rptr)(void *ctx);
  20         int (*cr_update_wptr)(void *ctx);
  21         int (*cr_write_rptr)(void *ctx);
  22         int (*cr_write_wptr)(void *ctx);
  23 
  24         void *cr_ctx;
  25 
  26         spinlock_t lock;
  27         unsigned long flags;
  28         bool inited;
  29         bool was_full;
  30 
  31         atomic_t outstanding_tx;
  32 };
  33 
  34 
  35 void brcmf_commonring_register_cb(struct brcmf_commonring *commonring,
  36                                   int (*cr_ring_bell)(void *ctx),
  37                                   int (*cr_update_rptr)(void *ctx),
  38                                   int (*cr_update_wptr)(void *ctx),
  39                                   int (*cr_write_rptr)(void *ctx),
  40                                   int (*cr_write_wptr)(void *ctx), void *ctx);
  41 void brcmf_commonring_config(struct brcmf_commonring *commonring, u16 depth,
  42                              u16 item_len, void *buf_addr);
  43 void brcmf_commonring_lock(struct brcmf_commonring *commonring);
  44 void brcmf_commonring_unlock(struct brcmf_commonring *commonring);
  45 bool brcmf_commonring_write_available(struct brcmf_commonring *commonring);
  46 void *brcmf_commonring_reserve_for_write(struct brcmf_commonring *commonring);
  47 void *
  48 brcmf_commonring_reserve_for_write_multiple(struct brcmf_commonring *commonring,
  49                                             u16 n_items, u16 *alloced);
  50 int brcmf_commonring_write_complete(struct brcmf_commonring *commonring);
  51 void brcmf_commonring_write_cancel(struct brcmf_commonring *commonring,
  52                                    u16 n_items);
  53 void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  54                                     u16 *n_items);
  55 int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  56                                    u16 n_items);
  57 
  58 #define brcmf_commonring_n_items(commonring) (commonring->depth)
  59 #define brcmf_commonring_len_item(commonring) (commonring->item_len)
  60 
  61 
  62 #endif /* BRCMFMAC_COMMONRING_H */

/* [<][>][^][v][top][bottom][index][help] */