Commit 6757d345 authored by Sujuan Chen's avatar Sujuan Chen Committed by Paolo Abeni

net: ethernet: mtk_wed: introduce hw_rro support for MT7988

MT7988 SoC support 802.11 receive reordering offload in hw while
MT7986 SoC implements it through the firmware running on the mcu.
Co-developed-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarSujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent b230812b
This diff is collapsed.
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#define MTK_WED_TX_QUEUES 2 #define MTK_WED_TX_QUEUES 2
#define MTK_WED_RX_QUEUES 2 #define MTK_WED_RX_QUEUES 2
#define MTK_WED_RX_PAGE_QUEUES 3
#define WED_WO_STA_REC 0x6 #define WED_WO_STA_REC 0x6
...@@ -99,6 +100,9 @@ struct mtk_wed_device { ...@@ -99,6 +100,9 @@ struct mtk_wed_device {
struct mtk_wed_ring txfree_ring; struct mtk_wed_ring txfree_ring;
struct mtk_wed_ring tx_wdma[MTK_WED_TX_QUEUES]; struct mtk_wed_ring tx_wdma[MTK_WED_TX_QUEUES];
struct mtk_wed_ring rx_wdma[MTK_WED_RX_QUEUES]; struct mtk_wed_ring rx_wdma[MTK_WED_RX_QUEUES];
struct mtk_wed_ring rx_rro_ring[MTK_WED_RX_QUEUES];
struct mtk_wed_ring rx_page_ring[MTK_WED_RX_PAGE_QUEUES];
struct mtk_wed_ring ind_cmd_ring;
struct { struct {
int size; int size;
...@@ -119,6 +123,13 @@ struct mtk_wed_device { ...@@ -119,6 +123,13 @@ struct mtk_wed_device {
dma_addr_t fdbk_phys; dma_addr_t fdbk_phys;
} rro; } rro;
struct {
int size;
struct mtk_wed_buf *pages;
struct mtk_wed_bm_desc *desc;
dma_addr_t desc_phys;
} hw_rro;
/* filled by driver: */ /* filled by driver: */
struct { struct {
union { union {
...@@ -137,6 +148,8 @@ struct mtk_wed_device { ...@@ -137,6 +148,8 @@ struct mtk_wed_device {
u32 wpdma_txfree; u32 wpdma_txfree;
u32 wpdma_rx_glo; u32 wpdma_rx_glo;
u32 wpdma_rx; u32 wpdma_rx;
u32 wpdma_rx_rro[MTK_WED_RX_QUEUES];
u32 wpdma_rx_pg;
bool wcid_512; bool wcid_512;
bool hw_rro; bool hw_rro;
...@@ -151,9 +164,20 @@ struct mtk_wed_device { ...@@ -151,9 +164,20 @@ struct mtk_wed_device {
u8 tx_tbit[MTK_WED_TX_QUEUES]; u8 tx_tbit[MTK_WED_TX_QUEUES];
u8 rx_tbit[MTK_WED_RX_QUEUES]; u8 rx_tbit[MTK_WED_RX_QUEUES];
u8 rro_rx_tbit[MTK_WED_RX_QUEUES];
u8 rx_pg_tbit[MTK_WED_RX_PAGE_QUEUES];
u8 txfree_tbit; u8 txfree_tbit;
u8 amsdu_max_subframes; u8 amsdu_max_subframes;
struct {
u8 se_group_nums;
u16 win_size;
u16 particular_sid;
u32 ack_sn_addr;
dma_addr_t particular_se_phys;
dma_addr_t addr_elem_phys[1024];
} ind_cmd;
u32 (*init_buf)(void *ptr, dma_addr_t phys, int token_id); u32 (*init_buf)(void *ptr, dma_addr_t phys, int token_id);
int (*offload_enable)(struct mtk_wed_device *wed); int (*offload_enable)(struct mtk_wed_device *wed);
void (*offload_disable)(struct mtk_wed_device *wed); void (*offload_disable)(struct mtk_wed_device *wed);
...@@ -192,6 +216,14 @@ struct mtk_wed_ops { ...@@ -192,6 +216,14 @@ struct mtk_wed_ops {
void (*irq_set_mask)(struct mtk_wed_device *dev, u32 mask); void (*irq_set_mask)(struct mtk_wed_device *dev, u32 mask);
int (*setup_tc)(struct mtk_wed_device *wed, struct net_device *dev, int (*setup_tc)(struct mtk_wed_device *wed, struct net_device *dev,
enum tc_setup_type type, void *type_data); enum tc_setup_type type, void *type_data);
void (*start_hw_rro)(struct mtk_wed_device *dev, u32 irq_mask,
bool reset);
void (*rro_rx_ring_setup)(struct mtk_wed_device *dev, int ring,
void __iomem *regs);
void (*msdu_pg_rx_ring_setup)(struct mtk_wed_device *dev, int ring,
void __iomem *regs);
int (*ind_rx_ring_setup)(struct mtk_wed_device *dev,
void __iomem *regs);
}; };
extern const struct mtk_wed_ops __rcu *mtk_soc_wed_ops; extern const struct mtk_wed_ops __rcu *mtk_soc_wed_ops;
...@@ -263,6 +295,15 @@ static inline bool mtk_wed_is_amsdu_supported(struct mtk_wed_device *dev) ...@@ -263,6 +295,15 @@ static inline bool mtk_wed_is_amsdu_supported(struct mtk_wed_device *dev)
#define mtk_wed_device_dma_reset(_dev) (_dev)->ops->reset_dma(_dev) #define mtk_wed_device_dma_reset(_dev) (_dev)->ops->reset_dma(_dev)
#define mtk_wed_device_setup_tc(_dev, _netdev, _type, _type_data) \ #define mtk_wed_device_setup_tc(_dev, _netdev, _type, _type_data) \
(_dev)->ops->setup_tc(_dev, _netdev, _type, _type_data) (_dev)->ops->setup_tc(_dev, _netdev, _type, _type_data)
#define mtk_wed_device_start_hw_rro(_dev, _mask, _reset) \
(_dev)->ops->start_hw_rro(_dev, _mask, _reset)
#define mtk_wed_device_rro_rx_ring_setup(_dev, _ring, _regs) \
(_dev)->ops->rro_rx_ring_setup(_dev, _ring, _regs)
#define mtk_wed_device_msdu_pg_rx_ring_setup(_dev, _ring, _regs) \
(_dev)->ops->msdu_pg_rx_ring_setup(_dev, _ring, _regs)
#define mtk_wed_device_ind_rx_ring_setup(_dev, _regs) \
(_dev)->ops->ind_rx_ring_setup(_dev, _regs)
#else #else
static inline bool mtk_wed_device_active(struct mtk_wed_device *dev) static inline bool mtk_wed_device_active(struct mtk_wed_device *dev)
{ {
...@@ -282,6 +323,10 @@ static inline bool mtk_wed_device_active(struct mtk_wed_device *dev) ...@@ -282,6 +323,10 @@ static inline bool mtk_wed_device_active(struct mtk_wed_device *dev)
#define mtk_wed_device_stop(_dev) do {} while (0) #define mtk_wed_device_stop(_dev) do {} while (0)
#define mtk_wed_device_dma_reset(_dev) do {} while (0) #define mtk_wed_device_dma_reset(_dev) do {} while (0)
#define mtk_wed_device_setup_tc(_dev, _netdev, _type, _type_data) -EOPNOTSUPP #define mtk_wed_device_setup_tc(_dev, _netdev, _type, _type_data) -EOPNOTSUPP
#define mtk_wed_device_start_hw_rro(_dev, _mask, _reset) do {} while (0)
#define mtk_wed_device_rro_rx_ring_setup(_dev, _ring, _regs) -ENODEV
#define mtk_wed_device_msdu_pg_rx_ring_setup(_dev, _ring, _regs) -ENODEV
#define mtk_wed_device_ind_rx_ring_setup(_dev, _regs) -ENODEV
#endif #endif
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment