Browse Source

drivers: ethernet: Rename struct ring_buf -> struct ring_buffer

The struct ring_buf is renamed to struct ring_buffer to be able to coexist
with the sys/ring_buffer.h header file.

Signed-off-by: Måns Ansgariusson <Mansgariusson@gmail.com>
pull/84177/head
Måns Ansgariusson 7 months ago committed by Benjamin Cabé
parent
commit
4772bfe710
  1. 22
      drivers/ethernet/eth_sam_gmac.c
  2. 6
      drivers/ethernet/eth_sam_gmac_priv.h

22
drivers/ethernet/eth_sam_gmac.c

@ -403,7 +403,7 @@ static inline void eth_sam_gmac_init_qav(Gmac *gmac) @@ -403,7 +403,7 @@ static inline void eth_sam_gmac_init_qav(Gmac *gmac)
/*
* Reset ring buffer
*/
static void ring_buf_reset(struct ring_buf *rb)
static void ring_buffer_reset(struct ring_buffer *rb)
{
rb->head = 0U;
rb->tail = 0U;
@ -412,7 +412,7 @@ static void ring_buf_reset(struct ring_buf *rb) @@ -412,7 +412,7 @@ static void ring_buf_reset(struct ring_buf *rb)
/*
* Get one 32 bit item from the ring buffer
*/
static uint32_t ring_buf_get(struct ring_buf *rb)
static uint32_t ring_buffer_get(struct ring_buffer *rb)
{
uint32_t val;
@ -428,7 +428,7 @@ static uint32_t ring_buf_get(struct ring_buf *rb) @@ -428,7 +428,7 @@ static uint32_t ring_buf_get(struct ring_buf *rb)
/*
* Put one 32 bit item into the ring buffer
*/
static void ring_buf_put(struct ring_buf *rb, uint32_t val)
static void ring_buffer_put(struct ring_buffer *rb, uint32_t val)
{
rb->buf[rb->head] = val;
MODULO_INC(rb->head, rb->len);
@ -528,9 +528,9 @@ static void tx_descriptors_init(Gmac *gmac, struct gmac_queue *queue) @@ -528,9 +528,9 @@ static void tx_descriptors_init(Gmac *gmac, struct gmac_queue *queue)
#if GMAC_MULTIPLE_TX_PACKETS == 1
/* Reset TX frame list */
ring_buf_reset(&queue->tx_frag_list);
ring_buffer_reset(&queue->tx_frag_list);
#if defined(CONFIG_PTP_CLOCK_SAM_GMAC)
ring_buf_reset(&queue->tx_frames);
ring_buffer_reset(&queue->tx_frames);
#endif
#endif
}
@ -721,14 +721,14 @@ static void tx_completed(Gmac *gmac, struct gmac_queue *queue) @@ -721,14 +721,14 @@ static void tx_completed(Gmac *gmac, struct gmac_queue *queue)
k_sem_give(&queue->tx_desc_sem);
/* Release net buffer to the buffer pool */
frag = UINT_TO_POINTER(ring_buf_get(&queue->tx_frag_list));
frag = UINT_TO_POINTER(ring_buffer_get(&queue->tx_frag_list));
net_pkt_frag_unref(frag);
LOG_DBG("Dropping frag %p", frag);
if (tx_desc->w1 & GMAC_TXW1_LASTBUFFER) {
#if defined(CONFIG_PTP_CLOCK_SAM_GMAC)
/* Release net packet to the packet pool */
pkt = UINT_TO_POINTER(ring_buf_get(&queue->tx_frames));
pkt = UINT_TO_POINTER(ring_buffer_get(&queue->tx_frames));
#if defined(CONFIG_NET_GPTP)
hdr = check_gptp_msg(get_iface(dev_data),
@ -756,10 +756,10 @@ static void tx_error_handler(Gmac *gmac, struct gmac_queue *queue) @@ -756,10 +756,10 @@ static void tx_error_handler(Gmac *gmac, struct gmac_queue *queue)
{
#if GMAC_MULTIPLE_TX_PACKETS == 1
struct net_buf *frag;
struct ring_buf *tx_frag_list = &queue->tx_frag_list;
struct ring_buffer *tx_frag_list = &queue->tx_frag_list;
#if defined(CONFIG_PTP_CLOCK_SAM_GMAC)
struct net_pkt *pkt;
struct ring_buf *tx_frames = &queue->tx_frames;
struct ring_buffer *tx_frames = &queue->tx_frames;
#endif
#endif
@ -1495,7 +1495,7 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) @@ -1495,7 +1495,7 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt)
"tx_desc_list overflow");
/* Account for a sent frag */
ring_buf_put(&queue->tx_frag_list, POINTER_TO_UINT(frag));
ring_buffer_put(&queue->tx_frag_list, POINTER_TO_UINT(frag));
/* frag is internally queued, so it requires to hold a reference */
net_pkt_frag_ref(frag);
@ -1533,7 +1533,7 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) @@ -1533,7 +1533,7 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt)
#if GMAC_MULTIPLE_TX_PACKETS == 1
#if defined(CONFIG_PTP_CLOCK_SAM_GMAC)
/* Account for a sent frame */
ring_buf_put(&queue->tx_frames, POINTER_TO_UINT(pkt));
ring_buffer_put(&queue->tx_frames, POINTER_TO_UINT(pkt));
/* pkt is internally queued, so it requires to hold a reference */
net_pkt_ref(pkt);

6
drivers/ethernet/eth_sam_gmac_priv.h

@ -208,7 +208,7 @@ enum queue_idx { @@ -208,7 +208,7 @@ enum queue_idx {
#endif
/** Minimal ring buffer implementation */
struct ring_buf {
struct ring_buffer {
uint32_t *buf;
uint16_t len;
uint16_t head;
@ -242,9 +242,9 @@ struct gmac_queue { @@ -242,9 +242,9 @@ struct gmac_queue {
struct net_buf **rx_frag_list;
#if GMAC_MULTIPLE_TX_PACKETS == 1
struct ring_buf tx_frag_list;
struct ring_buffer tx_frag_list;
#if defined(CONFIG_PTP_CLOCK_SAM_GMAC)
struct ring_buf tx_frames;
struct ring_buffer tx_frames;
#endif
#endif

Loading…
Cancel
Save