
Added a separate loop to dequeue the rx pkts and relinquish REO and rx-Refill ring faster. Additionl rx processing is moved to a different per vdev loop. CRs-Fixed: 1098453 Change-Id: I43b1fa302cf7e7c77f6114ea491306c0b724e365
166 baris
5.1 KiB
C
166 baris
5.1 KiB
C
/*
|
|
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
|
|
*
|
|
* Permission to use, copy, modify, and/or distribute this software for
|
|
* any purpose with or without fee is hereby granted, provided that the
|
|
* above copyright notice and this permission notice appear in all
|
|
* copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
|
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
|
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
#ifndef _DP_RX_H
|
|
#define _DP_RX_H
|
|
|
|
#include "hal_rx.h"
|
|
#include "dp_tx.h"
|
|
|
|
#define DP_PEER_METADATA_PEER_ID_MASK 0x0000ffff
|
|
#define DP_PEER_METADATA_PEER_ID_SHIFT 0
|
|
#define DP_PEER_METADATA_VDEV_ID_MASK 0x00070000
|
|
#define DP_PEER_METADATA_VDEV_ID_SHIFT 16
|
|
|
|
#define DP_PEER_METADATA_PEER_ID_GET(_peer_metadata) \
|
|
(((_peer_metadata) & DP_PEER_METADATA_PEER_ID_MASK) \
|
|
>> DP_PEER_METADATA_PEER_ID_SHIFT)
|
|
|
|
#define DP_PEER_METADATA_ID_GET(_peer_metadata) \
|
|
(((_peer_metadata) & DP_PEER_METADATA_VDEV_ID_MASK) \
|
|
>> DP_PEER_METADATA_VDEV_ID_SHIFT)
|
|
|
|
/**
|
|
* struct dp_rx_desc
|
|
*
|
|
* @nbuf : VA of the "skb" posted
|
|
* @rx_buf_start : VA of the original Rx buffer, before
|
|
* movement of any skb->data pointer
|
|
* @cookie : index into the sw array which holds
|
|
* the sw Rx descriptors
|
|
* Cookie space is 21 bits:
|
|
* lower 18 bits -- index
|
|
* upper 3 bits -- pool_id
|
|
* @pool_id : pool Id for which this allocated.
|
|
* Can only be used if there is no flow
|
|
* steering
|
|
*/
|
|
struct dp_rx_desc {
|
|
qdf_nbuf_t nbuf;
|
|
uint8_t *rx_buf_start;
|
|
uint16_t cookie;
|
|
uint8_t pool_id;
|
|
};
|
|
|
|
#define RX_DESC_COOKIE_INDEX_SHIFT 0
|
|
#define RX_DESC_COOKIE_INDEX_MASK 0x3ffff /* 18 bits */
|
|
#define RX_DESC_COOKIE_POOL_ID_SHIFT 18
|
|
#define RX_DESC_COOKIE_POOL_ID_MASK 0x1c0000
|
|
|
|
#define DP_RX_DESC_COOKIE_POOL_ID_GET(_cookie) \
|
|
(((_cookie) & RX_DESC_COOKIE_POOL_ID_MASK) >> \
|
|
RX_DESC_COOKIE_POOL_ID_SHIFT)
|
|
|
|
#define DP_RX_DESC_COOKIE_INDEX_GET(_cookie) \
|
|
(((_cookie) & RX_DESC_COOKIE_INDEX_MASK) >> \
|
|
RX_DESC_COOKIE_INDEX_SHIFT)
|
|
|
|
/**
|
|
* struct dp_rx_desc_list_elem_t
|
|
*
|
|
* @next : Next pointer to form free list
|
|
* @rx_desc : DP Rx descriptor
|
|
*/
|
|
union dp_rx_desc_list_elem_t {
|
|
union dp_rx_desc_list_elem_t *next;
|
|
struct dp_rx_desc rx_desc;
|
|
};
|
|
|
|
/**
|
|
* dp_rx_cookie_2_va() - Converts cookie to a virtual address of
|
|
* the Rx descriptor.
|
|
* @soc: core txrx main context
|
|
* @cookie: cookie used to lookup virtual address
|
|
*
|
|
* Return: void *: Virtual Address of the Rx descriptor
|
|
*/
|
|
static inline
|
|
void *dp_rx_cookie_2_va(struct dp_soc *soc, uint32_t cookie)
|
|
{
|
|
uint8_t pool_id = DP_RX_DESC_COOKIE_POOL_ID_GET(cookie);
|
|
uint16_t index = DP_RX_DESC_COOKIE_INDEX_GET(cookie);
|
|
/* TODO */
|
|
/* Add sanity for pool_id & index */
|
|
return &(soc->rx_desc[pool_id].array[index].rx_desc);
|
|
}
|
|
|
|
void dp_rx_add_desc_list_to_free_list(struct dp_soc *soc,
|
|
union dp_rx_desc_list_elem_t **local_desc_list,
|
|
union dp_rx_desc_list_elem_t **tail,
|
|
uint16_t pool_id);
|
|
|
|
uint16_t dp_rx_get_free_desc_list(struct dp_soc *soc, uint32_t pool_id,
|
|
uint16_t num_descs,
|
|
union dp_rx_desc_list_elem_t **desc_list,
|
|
union dp_rx_desc_list_elem_t **tail);
|
|
|
|
QDF_STATUS dp_rx_desc_pool_alloc(struct dp_soc *soc, uint32_t pool_id);
|
|
void dp_rx_desc_pool_free(struct dp_soc *soc, uint32_t pool_id);
|
|
|
|
QDF_STATUS dp_rx_pdev_attach(struct dp_pdev *pdev);
|
|
void dp_rx_pdev_detach(struct dp_pdev *pdev);
|
|
|
|
QDF_STATUS dp_rx_buffers_replenish(struct dp_soc *dp_soc, uint32_t mac_id,
|
|
uint32_t num_req_buffers,
|
|
union dp_rx_desc_list_elem_t **desc_list,
|
|
union dp_rx_desc_list_elem_t **tail,
|
|
uint8_t owner);
|
|
uint32_t dp_rx_process(struct dp_soc *soc, void *hal_ring, uint32_t quota);
|
|
|
|
uint32_t dp_rx_err_process(struct dp_soc *soc, void *hal_ring, uint32_t quota);
|
|
|
|
uint32_t
|
|
dp_rx_wbm_err_process(struct dp_soc *soc, void *hal_ring, uint32_t quota);
|
|
|
|
/**
|
|
* dp_rx_add_to_free_desc_list() - Adds to a local free descriptor list
|
|
*
|
|
* @head: pointer to the head of local free list
|
|
* @tail: pointer to the tail of local free list
|
|
* @new: new descriptor that is added to the free list
|
|
*
|
|
* Return: void:
|
|
*/
|
|
static inline
|
|
void dp_rx_add_to_free_desc_list(union dp_rx_desc_list_elem_t **head,
|
|
union dp_rx_desc_list_elem_t **tail,
|
|
struct dp_rx_desc *new)
|
|
{
|
|
qdf_assert(head && new);
|
|
|
|
new->nbuf = NULL;
|
|
|
|
((union dp_rx_desc_list_elem_t *)new)->next = *head;
|
|
*head = (union dp_rx_desc_list_elem_t *)new;
|
|
if (*tail == NULL)
|
|
*tail = *head;
|
|
|
|
}
|
|
|
|
#define DP_RX_LIST_APPEND(head, tail, elem) \
|
|
do { \
|
|
if (!(head)) { \
|
|
(head) = (elem); \
|
|
} else { \
|
|
qdf_nbuf_set_next((tail), (elem)); \
|
|
} \
|
|
(tail) = (elem); \
|
|
} while (0)
|
|
|
|
#endif /* _DP_RX_H */
|