Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ morse-y += coredump.o
morse-y += peer.o
morse-y += led.o
morse-y += bss_stats.o
morse-y += apf.o
morse-$(CONFIG_MORSE_MONITOR) += monitor.o
morse-$(CONFIG_MORSE_SDIO) += sdio.o
morse-$(CONFIG_MORSE_SPI) += spi.o
Expand All @@ -164,7 +165,6 @@ morse-$(CONFIG_MORSE_USER_ACCESS) += uaccess.o
morse-$(CONFIG_MORSE_HW_TRACE) += hw_trace.o
morse-$(CONFIG_MORSE_PAGESET_TRACE) += pageset_trace.o
morse-$(CONFIG_MORSE_BUS_TRACE) += bus_trace.o
morse-$(CONFIG_ANDROID) += apf.o

ifeq ($(CONFIG_DISABLE_MORSE_RC),y)
morse-y += minstrel_rc.o
Expand Down
27 changes: 27 additions & 0 deletions apf.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define MORSE_APF_WARN(_m, _f, _a...) morse_warn(FEATURE_ID_APF, _m, _f, ##_a)
#define MORSE_APF_ERR(_m, _f, _a...) morse_err(FEATURE_ID_APF, _m, _f, ##_a)

#ifdef CONFIG_ANDROID
struct nla_policy morse_apf_nla_policy[VENDOR_ATTR_PACKET_FILTER_MAX] = {
[VENDOR_ATTR_PACKET_FILTER_VERSION] = { .type = NLA_U32},
[VENDOR_ATTR_PACKET_FILTER_MAX_LENGTH] = { .type = NLA_U32},
Expand Down Expand Up @@ -210,3 +211,29 @@ int morse_vendor_cmd_apf_read_packet_filter_data(struct wiphy *wiphy,
kfree(program);
return ret;
}
#else
int morse_vendor_cmd_get_supported_feature_set(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int data_len)
{
return -EOPNOTSUPP;
}

int morse_vendor_cmd_apf_get_capabilities(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int data_len)
{
return -EOPNOTSUPP;
}

int morse_vendor_cmd_apf_set_packet_filter(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int data_len)
{
return -EOPNOTSUPP;
}

int morse_vendor_cmd_apf_read_packet_filter_data(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int data_len)
{
return -EOPNOTSUPP;
}

#endif /* CONFIG_ANDROID */
16 changes: 15 additions & 1 deletion bss_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ static void morse_bss_stats_timer_cb(unsigned long addr)
static void morse_bss_stats_timer_cb(struct timer_list *t)
#endif
{
#if KERNEL_VERSION(4, 14, 0) > LINUX_VERSION_CODE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0)
struct morse_bss_stats_context *bss_stats = timer_container_of(bss_stats, t, timer);
#elif KERNEL_VERSION(4, 14, 0) > LINUX_VERSION_CODE
struct morse_bss_stats_context *bss_stats = (struct morse_bss_stats_context *)addr;
#else
struct morse_bss_stats_context *bss_stats = from_timer(bss_stats, t, timer);
Expand Down Expand Up @@ -465,7 +467,11 @@ int morse_bss_stats_pause(struct morse_vif *mors_vif)

/* disable and stop the stats timer */
bss_stats->paused = true;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
timer_delete_sync(&bss_stats->timer);
#else
del_timer_sync(&bss_stats->timer);
#endif

return 0;
}
Expand Down Expand Up @@ -523,7 +529,11 @@ int morse_cmd_process_bss_stats_conf(struct morse_vif *mors_vif,
mod_timer(&bss_stats->timer,
jiffies + msecs_to_jiffies(bss_stats->monitor_window_ms));
else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
timer_delete_sync(&bss_stats->timer);
#else
del_timer_sync(&bss_stats->timer);
#endif

return 0;
}
Expand Down Expand Up @@ -573,5 +583,9 @@ void morse_bss_stats_deinit(struct morse_vif *mors_vif)

bss_stats = &mors_vif->ap->bss_stats;
morse_bss_stats_remove_all(mors_vif, bss_stats);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
timer_delete_sync(&bss_stats->timer);
#else
del_timer_sync(&bss_stats->timer);
#endif
}
9 changes: 7 additions & 2 deletions cac.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ static void cac_timer(unsigned long addr)
static void cac_timer(struct timer_list *t)
#endif
{
#if KERNEL_VERSION(4, 14, 0) > LINUX_VERSION_CODE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0)
struct morse_cac *cac = timer_container_of(cac, t, timer);
#elif KERNEL_VERSION(4, 14, 0) > LINUX_VERSION_CODE
struct morse_cac *cac = (struct morse_cac *)addr;
#else
struct morse_cac *cac = from_timer(cac, t, timer);
Expand Down Expand Up @@ -231,8 +233,11 @@ int morse_cac_deinit(struct morse_vif *mors_vif)
if (!mors_vif->ap)
return 0;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
timer_delete_sync(&cac->timer);
#else
del_timer_sync(&cac->timer);

#endif
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ extern uint debug_mask;
*
* @returns True if output would be generated and false otherwise.
*/
bool morse_log_is_enabled(u32 id, u8 level);
bool morse_log_is_enabled(enum morse_feature_id id, u8 level);

/**
* Set the default logging level for all features.
Expand Down
4 changes: 4 additions & 0 deletions dot11ah/ie.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,11 @@ int morse_dot11_insert_ordered_ies_from_ies_mask(struct sk_buff *skb, u8 *pos,
if (!ies_mask)
return 0;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
if (!ieee80211_is_s1g_beacon(frame_control) ||
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@govindsi why was the behavior negated for new kernel versions?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mic92 , yes, this shall be corrected. Thanks for pointing out

#else
if (ieee80211_is_s1g_short_beacon(frame_control) ||
#endif
(le16_to_cpu(frame_control) & IEEE80211_FC_COMPRESS_SSID)) {
ies_order_table = morse_ext_s1g_short_beacon_ies_order;
ies_order_table_len = ARRAY_SIZE(morse_ext_s1g_short_beacon_ies_order);
Expand Down
4 changes: 3 additions & 1 deletion firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#error "Capability subset filled by firmware is to big"
#endif

enum morse_config_test_mode;

enum morse_fw_info_tlv_type {
MORSE_FW_INFO_TLV_BCF_ADDR = 1,
MORSE_FW_INFO_TLV_COREDUMP_MEM_REGION = 2,
Expand Down Expand Up @@ -146,7 +148,7 @@ struct extended_host_table {
u8 ext_host_table_data_tlvs[];
} __packed;

int morse_firmware_init(struct morse *mors, uint test_mode);
int morse_firmware_init(struct morse *mors, enum morse_config_test_mode test_mode);

/**
* @brief Do necessary preparation and then initialise firmware
Expand Down
72 changes: 58 additions & 14 deletions mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2707,7 +2707,9 @@ static void morse_chswitch_timer(unsigned long addr)
static void morse_chswitch_timer(struct timer_list *t)
#endif
{
#if KERNEL_VERSION(4, 14, 0) > LINUX_VERSION_CODE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0)
struct morse_vif *mors_vif = timer_container_of(mors_vif, t, chswitch_timer);
#elif KERNEL_VERSION(4, 14, 0) > LINUX_VERSION_CODE
struct morse_vif *mors_vif = (struct morse_vif *)addr;
#else
struct morse_vif *mors_vif = from_timer(mors_vif, t, chswitch_timer);
Expand Down Expand Up @@ -3194,8 +3196,11 @@ static void morse_mac_ops_remove_interface(struct ieee80211_hw *hw, struct ieee8
MORSE_ERR(mors, "morse_cmd_rm_if failed %d", ret);
goto exit;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
timer_delete_sync(&mors_vif->chswitch_timer);
#else
del_timer_sync(&mors_vif->chswitch_timer);
#endif
flush_delayed_work(&mors_vif->ecsa_chswitch_work);

/* If data TX is stopped, the LMAC will eventually send the
Expand Down Expand Up @@ -3469,8 +3474,11 @@ static int morse_mac_change_channel(struct ieee80211_hw *hw)

return ret;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
static int morse_mac_ops_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)
#else
static int morse_mac_ops_config(struct ieee80211_hw *hw, u32 changed)
#endif
{
int err = 0;
struct morse *mors = hw->priv;
Expand Down Expand Up @@ -3540,7 +3548,11 @@ static int morse_mac_ops_config(struct ieee80211_hw *hw, u32 changed)
}

/* Return Tx power only when channel is configured and is the same as one in hw->conf */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
static int morse_mac_ops_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, unsigned int link_id, int *dbm)
#else
static int morse_mac_ops_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int *dbm)
#endif
{
int err;
struct morse *mors = hw->priv;
Expand Down Expand Up @@ -4290,21 +4302,14 @@ void morse_mac_update_ibss_node_capabilities(struct ieee80211_hw *hw,
/* API to process the bandwidth change notification from mac80211 */
static void morse_mac_ops_sta_rc_update(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
#if KERNEL_VERSION(6, 13, 0) > MAC80211_VERSION_CODE
struct ieee80211_sta *sta,
#else
struct ieee80211_link_sta *link_sta,
#endif
u32 changed)
{
struct morse *mors;
#ifdef CONFIG_MORSE_RC
enum ieee80211_sta_state old_state;
enum ieee80211_sta_state new_state;
#endif
#if KERNEL_VERSION(6, 13, 0) <= MAC80211_VERSION_CODE
struct ieee80211_sta *sta = link_sta->sta;
#endif

if (!hw || !vif || !sta)
return;
Expand Down Expand Up @@ -4340,6 +4345,20 @@ static void morse_mac_ops_sta_rc_update(struct ieee80211_hw *hw,
#endif
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,13,0)
static void morse_link_sta_rc_update_compat(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_link_sta *link_sta,
u32 changed)
{
if (!link_sta)
return;

/* link_sta always has a back-reference to the station */
morse_mac_ops_sta_rc_update(hw, vif, link_sta->sta, changed);
}
#endif

static int
morse_mac_ops_sta_state(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
Expand Down Expand Up @@ -4891,7 +4910,18 @@ static int morse_mac_join_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vi
* packets.
*/
changed |= IEEE80211_CONF_CHANGE_CHANNEL;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
int idx;
struct ieee80211_vif *vif_tmp;
for (idx = 0; idx < mors->max_vifs; idx++) {
vif_tmp = morse_get_vif_from_vif_id(mors, idx);
if (!vif_tmp)
continue;
morse_mac_ops_config(hw, idx, changed);
}
#else
morse_mac_ops_config(hw, changed);
#endif
}

memcpy(bssid, vif->bss_conf.bssid, ETH_ALEN);
Expand Down Expand Up @@ -4927,7 +4957,11 @@ static void morse_mac_leave_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *
mutex_unlock(&mors->lock);
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
static int morse_mac_set_frag_threshold(struct ieee80211_hw *hw, int radio_idx, u32 value)
#else
static int morse_mac_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
#endif
{
int ret = -EINVAL;
struct morse *mors = hw->priv;
Expand All @@ -4941,7 +4975,11 @@ static int morse_mac_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
return ret;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0)
static int morse_mac_set_rts_threshold(struct ieee80211_hw *hw, int radio_idx, u32 value)
#else
static int morse_mac_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
#endif
{
/* When Minstrel is not used, Linux checks if .set_rts_threshold is registered.
* MMRC follows Minstrel to apply RTS on retry rates so does not use this function.
Expand Down Expand Up @@ -5076,7 +5114,7 @@ static struct ieee80211_ops mors_ops = {
#if KERNEL_VERSION(6, 13, 0) > MAC80211_VERSION_CODE
.sta_rc_update = morse_mac_ops_sta_rc_update,
#else
.link_sta_rc_update = morse_mac_ops_sta_rc_update,
.link_sta_rc_update = morse_link_sta_rc_update_compat,
#endif
.set_frag_threshold = morse_mac_set_frag_threshold,
.set_rts_threshold = morse_mac_set_rts_threshold,
Expand Down Expand Up @@ -6490,8 +6528,11 @@ static int morse_mac_restart(struct morse *mors)
morse_ps_enable(mors);
return ret;
}

#if KERNEL_VERSION(4, 14, 0) > LINUX_VERSION_CODE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0)
static void morse_stale_tx_status_timer(struct timer_list *t)
{
struct morse *mors = timer_container_of(mors, t, stale_status.timer);
#elif KERNEL_VERSION(4, 14, 0) > LINUX_VERSION_CODE
static void morse_stale_tx_status_timer(unsigned long addr)
{
struct morse *mors = (struct morse *)addr;
Expand Down Expand Up @@ -6538,8 +6579,11 @@ static int morse_stale_tx_status_timer_finish(struct morse *mors)
return 0;

mors->stale_status.enabled = 0;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
timer_delete_sync(&mors->stale_status.timer);
#else
del_timer_sync(&mors->stale_status.timer);
#endif

return 0;
}
Expand Down
8 changes: 7 additions & 1 deletion mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ static void morse_mesh_probe_timer_cb(unsigned long addr)
static void morse_mesh_probe_timer_cb(struct timer_list *t)
#endif
{
#if KERNEL_VERSION(4, 14, 0) > LINUX_VERSION_CODE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0)
struct morse_mesh *mesh = timer_container_of(mesh, t, mesh_probe_timer);
#elif KERNEL_VERSION(4, 14, 0) > LINUX_VERSION_CODE
struct morse_mesh *mesh = (struct morse_mesh *)addr;
#else
struct morse_mesh *mesh = from_timer(mesh, t, mesh_probe_timer);
Expand Down Expand Up @@ -657,7 +659,11 @@ int morse_mesh_deinit(struct morse_vif *mors_vif)
{
struct morse_mesh *mesh = mors_vif->mesh;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
timer_delete_sync(&mesh->mesh_probe_timer);
#else
del_timer_sync(&mesh->mesh_probe_timer);
#endif
kfree(mors_vif->mesh);

return 0;
Expand Down
9 changes: 8 additions & 1 deletion rc.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ static void morse_rc_timer(unsigned long addr)
static void morse_rc_timer(struct timer_list *t)
#endif
{
#if KERNEL_VERSION(4, 14, 0) > LINUX_VERSION_CODE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0)
struct morse_rc *mrc = timer_container_of(mrc, t, timer);
struct morse *mors = mrc->mors;
#elif KERNEL_VERSION(4, 14, 0) > LINUX_VERSION_CODE
struct morse *mors = (struct morse *)addr;
#else
struct morse_rc *mrc = from_timer(mrc, t, timer);
Expand Down Expand Up @@ -124,7 +127,11 @@ int morse_rc_init(struct morse *mors)
int morse_rc_deinit(struct morse *mors)
{
cancel_work_sync(&mors->mrc.work);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
timer_delete_sync(&mors->mrc.timer);
#else
del_timer_sync(&mors->mrc.timer);
#endif

return 0;
}
Expand Down
2 changes: 0 additions & 2 deletions vendor.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
#include "wiphy.h"
#include "vendor.h"
#include "mesh.h"
#ifdef CONFIG_ANDROID
#include "apf.h"
#endif

/** Extra overhead to account for any additional netlink framing */
#define VENDOR_EVENT_OVERHEAD (30)
Expand Down
Loading