Commit cecf1643 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

wifi: rtw89: mac: add to get DLE reserved quota

The reserved quota of DLE (data link engine) is used for processing next
packet. Add this to get quota number, and then WiFi 7 chips can use them.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231124071703.132549-3-pkshih@realtek.com
parent fdb3bb0a
...@@ -3807,8 +3807,10 @@ enum rtw89_hcifc_mode { ...@@ -3807,8 +3807,10 @@ enum rtw89_hcifc_mode {
}; };
struct rtw89_dle_info { struct rtw89_dle_info {
const struct rtw89_rsvd_quota *rsvd_qt;
enum rtw89_qta_mode qta_mode; enum rtw89_qta_mode qta_mode;
u16 ple_pg_size; u16 ple_pg_size;
u16 ple_free_pg;
u16 c0_rx_qta; u16 c0_rx_qta;
u16 c1_rx_qta; u16 c1_rx_qta;
}; };
......
...@@ -1555,7 +1555,9 @@ static const struct rtw89_dle_mem *get_dle_mem_cfg(struct rtw89_dev *rtwdev, ...@@ -1555,7 +1555,9 @@ static const struct rtw89_dle_mem *get_dle_mem_cfg(struct rtw89_dev *rtwdev,
return NULL; return NULL;
} }
mac->dle_info.rsvd_qt = cfg->rsvd_qt;
mac->dle_info.ple_pg_size = cfg->ple_size->pge_size; mac->dle_info.ple_pg_size = cfg->ple_size->pge_size;
mac->dle_info.ple_free_pg = cfg->ple_size->lnk_pge_num;
mac->dle_info.qta_mode = mode; mac->dle_info.qta_mode = mode;
mac->dle_info.c0_rx_qta = cfg->ple_min_qt->cma0_dma; mac->dle_info.c0_rx_qta = cfg->ple_min_qt->cma0_dma;
mac->dle_info.c1_rx_qta = cfg->ple_min_qt->cma1_dma; mac->dle_info.c1_rx_qta = cfg->ple_min_qt->cma1_dma;
...@@ -1563,6 +1565,59 @@ static const struct rtw89_dle_mem *get_dle_mem_cfg(struct rtw89_dev *rtwdev, ...@@ -1563,6 +1565,59 @@ static const struct rtw89_dle_mem *get_dle_mem_cfg(struct rtw89_dev *rtwdev,
return cfg; return cfg;
} }
int rtw89_mac_get_dle_rsvd_qt_cfg(struct rtw89_dev *rtwdev,
enum rtw89_mac_dle_rsvd_qt_type type,
struct rtw89_mac_dle_rsvd_qt_cfg *cfg)
{
struct rtw89_dle_info *dle_info = &rtwdev->mac.dle_info;
const struct rtw89_rsvd_quota *rsvd_qt = dle_info->rsvd_qt;
switch (type) {
case DLE_RSVD_QT_MPDU_INFO:
cfg->pktid = dle_info->ple_free_pg;
cfg->pg_num = rsvd_qt->mpdu_info_tbl;
break;
case DLE_RSVD_QT_B0_CSI:
cfg->pktid = dle_info->ple_free_pg + rsvd_qt->mpdu_info_tbl;
cfg->pg_num = rsvd_qt->b0_csi;
break;
case DLE_RSVD_QT_B1_CSI:
cfg->pktid = dle_info->ple_free_pg +
rsvd_qt->mpdu_info_tbl + rsvd_qt->b0_csi;
cfg->pg_num = rsvd_qt->b1_csi;
break;
case DLE_RSVD_QT_B0_LMR:
cfg->pktid = dle_info->ple_free_pg +
rsvd_qt->mpdu_info_tbl + rsvd_qt->b0_csi + rsvd_qt->b1_csi;
cfg->pg_num = rsvd_qt->b0_lmr;
break;
case DLE_RSVD_QT_B1_LMR:
cfg->pktid = dle_info->ple_free_pg +
rsvd_qt->mpdu_info_tbl + rsvd_qt->b0_csi + rsvd_qt->b1_csi +
rsvd_qt->b0_lmr;
cfg->pg_num = rsvd_qt->b1_lmr;
break;
case DLE_RSVD_QT_B0_FTM:
cfg->pktid = dle_info->ple_free_pg +
rsvd_qt->mpdu_info_tbl + rsvd_qt->b0_csi + rsvd_qt->b1_csi +
rsvd_qt->b0_lmr + rsvd_qt->b1_lmr;
cfg->pg_num = rsvd_qt->b0_ftm;
break;
case DLE_RSVD_QT_B1_FTM:
cfg->pktid = dle_info->ple_free_pg +
rsvd_qt->mpdu_info_tbl + rsvd_qt->b0_csi + rsvd_qt->b1_csi +
rsvd_qt->b0_lmr + rsvd_qt->b1_lmr + rsvd_qt->b0_ftm;
cfg->pg_num = rsvd_qt->b1_ftm;
break;
default:
return -EINVAL;
}
cfg->size = (u32)cfg->pg_num * dle_info->ple_pg_size;
return 0;
}
static bool mac_is_txq_empty(struct rtw89_dev *rtwdev) static bool mac_is_txq_empty(struct rtw89_dev *rtwdev)
{ {
struct rtw89_mac_dle_dfi_qempty qempty; struct rtw89_mac_dle_dfi_qempty qempty;
......
...@@ -650,6 +650,22 @@ struct rtw89_mac_dle_dfi_qempty { ...@@ -650,6 +650,22 @@ struct rtw89_mac_dle_dfi_qempty {
u32 qempty; u32 qempty;
}; };
enum rtw89_mac_dle_rsvd_qt_type {
DLE_RSVD_QT_MPDU_INFO,
DLE_RSVD_QT_B0_CSI,
DLE_RSVD_QT_B1_CSI,
DLE_RSVD_QT_B0_LMR,
DLE_RSVD_QT_B1_LMR,
DLE_RSVD_QT_B0_FTM,
DLE_RSVD_QT_B1_FTM,
};
struct rtw89_mac_dle_rsvd_qt_cfg {
u16 pktid;
u16 pg_num;
u32 size;
};
enum rtw89_mac_error_scenario { enum rtw89_mac_error_scenario {
RTW89_RXI300_ERROR = 1, RTW89_RXI300_ERROR = 1,
RTW89_WCPU_CPU_EXCEPTION = 2, RTW89_WCPU_CPU_EXCEPTION = 2,
...@@ -1254,5 +1270,8 @@ int rtw89_mac_resize_ple_rx_quota(struct rtw89_dev *rtwdev, bool wow); ...@@ -1254,5 +1270,8 @@ int rtw89_mac_resize_ple_rx_quota(struct rtw89_dev *rtwdev, bool wow);
int rtw89_mac_ptk_drop_by_band_and_wait(struct rtw89_dev *rtwdev, int rtw89_mac_ptk_drop_by_band_and_wait(struct rtw89_dev *rtwdev,
enum rtw89_mac_idx band); enum rtw89_mac_idx band);
void rtw89_mac_hw_mgnt_sec(struct rtw89_dev *rtwdev, bool wow); void rtw89_mac_hw_mgnt_sec(struct rtw89_dev *rtwdev, bool wow);
int rtw89_mac_get_dle_rsvd_qt_cfg(struct rtw89_dev *rtwdev,
enum rtw89_mac_dle_rsvd_qt_type type,
struct rtw89_mac_dle_rsvd_qt_cfg *cfg);
#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