Skip to content

Commit

Permalink
Modified the code to be compiled directly.
Browse files Browse the repository at this point in the history
1. Removed linux version checking.
2. Removed unused files.

Signed-off-by: David Lin <dlin@marvell.com>
  • Loading branch information
yuhhaurlin committed Jun 1, 2016
1 parent 5220b86 commit 265d314
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 114 deletions.
23 changes: 0 additions & 23 deletions Kconfig

This file was deleted.

39 changes: 0 additions & 39 deletions Makefile.external

This file was deleted.

13 changes: 0 additions & 13 deletions Makefile.kernel

This file was deleted.

4 changes: 0 additions & 4 deletions debugfs.c
Expand Up @@ -438,11 +438,9 @@ static ssize_t mwl_debugfs_dfs_channel_read(struct file *file,
channel->hw_value,
channel->center_freq,
channel->flags, channel->dfs_state);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
len += scnprintf(p + len, size - len,
"cac timer: %d ms\n",
channel->dfs_cac_ms);
#endif
}
}
len += scnprintf(p + len, size - len, "\n");
Expand Down Expand Up @@ -493,10 +491,8 @@ static ssize_t mwl_debugfs_dfs_channel_write(struct file *file,
channel = &sband->channels[i];
if (channel->flags & IEEE80211_CHAN_RADAR) {
channel->dfs_state = dfs_state;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
if (cac_time != -1)
channel->dfs_cac_ms = cac_time * 1000;
#endif
}
}
ret = count;
Expand Down
4 changes: 0 additions & 4 deletions dev.h
Expand Up @@ -509,10 +509,6 @@ static inline struct mwl_sta *mwl_dev_get_sta(const struct ieee80211_sta *sta)
return (struct mwl_sta *)&sta->drv_priv;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
#define ether_addr_copy(dst, src) memcpy(dst, src, ETH_ALEN)
#endif

/* Defined in mac80211.c. */
extern const struct ieee80211_ops mwl_mac80211_ops;

Expand Down
12 changes: 0 additions & 12 deletions mac80211.c
Expand Up @@ -598,19 +598,11 @@ static int mwl_mac80211_get_survey(struct ieee80211_hw *hw,
return 0;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
enum ieee80211_ampdu_mlme_action action,
struct ieee80211_sta *sta,
u16 tid, u16 *ssn, u8 buf_size)
#else
static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
enum ieee80211_ampdu_mlme_action action,
struct ieee80211_sta *sta,
u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
#endif
{
int rc = 0;
struct mwl_priv *priv = hw->priv;
Expand Down Expand Up @@ -713,7 +705,6 @@ static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
return rc;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
static int mwl_mac80211_chnl_switch(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_channel_switch *ch_switch)
Expand All @@ -725,7 +716,6 @@ static int mwl_mac80211_chnl_switch(struct ieee80211_hw *hw,

return rc;
}
#endif

const struct ieee80211_ops mwl_mac80211_ops = {
.tx = mwl_mac80211_tx,
Expand All @@ -744,7 +734,5 @@ const struct ieee80211_ops mwl_mac80211_ops = {
.get_stats = mwl_mac80211_get_stats,
.get_survey = mwl_mac80211_get_survey,
.ampdu_action = mwl_mac80211_ampdu_action,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
.pre_channel_switch = mwl_mac80211_chnl_switch,
#endif
};
17 changes: 0 additions & 17 deletions main.c
Expand Up @@ -423,11 +423,7 @@ static void mwl_set_ht_caps(struct mwl_priv *priv,
band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
#else
ieee80211_hw_set(hw, AMPDU_AGGREGATION);
#endif
band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_4;

Expand Down Expand Up @@ -563,29 +559,16 @@ static int mwl_wl_init(struct mwl_priv *priv)
hw->queues = SYSADPT_TX_WMM_QUEUES;

/* Set rssi values to dBm */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
hw->flags |= IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_HAS_RATE_CONTROL;
#else
ieee80211_hw_set(hw, SIGNAL_DBM);
ieee80211_hw_set(hw, HAS_RATE_CONTROL);
#endif

/* Ask mac80211 not to trigger PS mode
* based on PM bit of incoming frames.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
hw->flags |= IEEE80211_HW_AP_LINK_PS;
#else
ieee80211_hw_set(hw, AP_LINK_PS);
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
hw->flags |= IEEE80211_HW_SUPPORTS_PER_STA_GTK |
IEEE80211_HW_MFP_CAPABLE;
#else
ieee80211_hw_set(hw, SUPPORTS_PER_STA_GTK);
ieee80211_hw_set(hw, MFP_CAPABLE);
#endif

hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
Expand Down
2 changes: 0 additions & 2 deletions rx.c
Expand Up @@ -232,10 +232,8 @@ static inline void mwl_rx_prepare_status(struct mwl_rx_desc *pdesc,
status->flag |= RX_FLAG_VHT;
if (bw == RX_RATE_INFO_HT40)
status->flag |= RX_FLAG_40MHZ;
#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 18, 0)
if (bw == RX_RATE_INFO_HT80)
status->vht_flag |= RX_VHT_FLAG_80MHZ;
#endif
if (gi == RX_RATE_INFO_SHORT_INTERVAL)
status->flag |= RX_FLAG_SHORT_GI;
status->vht_nss = (nss + 1);
Expand Down

14 comments on commit 265d314

@NemoAlex
Copy link

Choose a reason for hiding this comment

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

Does this mean that from this version, the driver doesn't support kernel 3.18?
Because I failed to compile it by using SDK of 15.05.1:

/main.c:404:2: error: implicit declaration of function 'ieee80211_hw_set' [-Werror=implicit-function-declaration]
  ieee80211_hw_set(hw, AMPDU_AGGREGATION);

@yuhhaurlin
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For OpenWrt, mwlwifi is built with compatible (backports) wireless package. It is possible that the compatible (backports) wireless package you used is old version. You can modify this driver to work with previous version of compatible (backports) wireless package. For example, you can use previous way to set flags (hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;).

@yuhhaurlin
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Another way is that you can update your compatible (backports) wireless package. Backports package is used to let updated drivers to work on old kernel.

@yuhhaurlin
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The package that you should update: package/kernel/mac80211.

@thagabe
Copy link

@thagabe thagabe commented on 265d314 Jun 1, 2016

Choose a reason for hiding this comment

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

@yuhhaurlin openwrt has not received the mac80211 updates yet. Right now only LEDE has the updated packages, CC is still the stable Openwrt release meaning we should create an inverse patch to add these checks. Then upload them to CC branch to patch the latest code.

@thagabe
Copy link

@thagabe thagabe commented on 265d314 Jun 1, 2016

Choose a reason for hiding this comment

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

Also have you added this patch to upstream? https://github.com/lede-project/source/blob/master/package/kernel/mwlwifi/patches/110-api_sync.patch

After trying to use the latest commit to build LEDE it fails at this patch and I was going to fix it but I can't fix it right now.

@yuhhaurlin
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please check README. I modified this driver based on "package/kernel/mac80211" of OpenWrt main trunk.

@yuhhaurlin
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please check README. If version of "package/kernel/mac80211" is 2016-01-10, you just need to rename the folder "patches".
Marvell will base on this version of code to create patch for upstream.

@yuhhaurlin
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed the API and let the driver accept AMSDU capability from mac80211. But I don't know why it needs to change IEEE80211XXX to NL802XXX. Mac80211 had redefined IEEE802XXX to NL802XXX. I still keep the driver use IEEE802XXX. BTW, you need to use 10.3.0.17-20160601 to have all these modifications. Thanks.

@jbsky
Copy link
Contributor

@jbsky jbsky commented on 265d314 Jun 1, 2016

Choose a reason for hiding this comment

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

Why remove Kconfig, McDebian need it.

@yuhhaurlin
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The version submitted to upstream will have Kconfig.

@ValCher1961
Copy link

Choose a reason for hiding this comment

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

Oh, and we were at a loss - as without Kconfig.

@yuhhaurlin
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had restored files Kconfig and Makefile.kernel.

@ValCher1961
Copy link

Choose a reason for hiding this comment

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

Tested on 4.6.0 kernel, everything is fine. Thank you.

Please sign in to comment.