Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to 4.15 #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions include/rtmp_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ typedef struct _RALINK_TIMER_STRUCT {
#ifdef RTMP_TIMER_TASK_SUPPORT
RTMP_TIMER_TASK_HANDLE handle;
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
TIMER_FUNCTION timer_callback;
#endif
} RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT;


Expand Down
20 changes: 18 additions & 2 deletions os/linux/cfg80211/cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,11 @@ Return Value:
For iw utility: set type, set monitor
========================================================================
*/
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
static int CFG80211_OpsVirtualInfChg(struct wiphy *pWiphy,
struct net_device *pNetDevIn, enum nl80211_iftype Type,
struct vif_params *pParams)
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
static int CFG80211_OpsVirtualInfChg(struct wiphy *pWiphy,
struct net_device *pNetDevIn, enum nl80211_iftype Type, u32 *pFlags,
struct vif_params *pParams)
Expand All @@ -284,6 +288,9 @@ static int CFG80211_OpsVirtualInfChg(struct wiphy *pWiphy, int IfIndex,
struct net_device *pNetDev;
CMD_RTPRIV_IOCTL_80211_VIF_PARM VifInfo;
UINT oldType = pNetDevIn->ieee80211_ptr->iftype;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
u32 *pFlags;
#endif /* LINUX_VERSION_CODE */

CFG80211DBG(RT_DEBUG_TRACE, ("80211> %s ==>\n", __FUNCTION__));
CFG80211DBG(RT_DEBUG_TRACE, ("80211> IfTypeChange %d ==> %d\n", oldType, Type));
Expand Down Expand Up @@ -322,7 +329,12 @@ static int CFG80211_OpsVirtualInfChg(struct wiphy *pWiphy, int IfIndex,
VifInfo.newIfType = Type;
VifInfo.oldIfType = oldType;

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
if (pParams != NULL) {
pFlags = & (pParams->flags);
#else
if (pFlags != NULL) {
#endif /* LINUX_VERSION_CODE */
VifInfo.MonFilterFlag = 0;

if (((*pFlags) & NL80211_MNTR_FLAG_FCSFAIL) == NL80211_MNTR_FLAG_FCSFAIL)
Expand Down Expand Up @@ -2181,7 +2193,11 @@ static int CFG80211_OpsStaChg(struct wiphy *pWiphy, struct net_device *dev,
return 0;
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
static struct wireless_dev* CFG80211_OpsVirtualInfAdd(struct wiphy *pWiphy,
const char *name, unsigned char name_assign_type, enum nl80211_iftype Type,
struct vif_params *pParams)
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0))
static struct wireless_dev* CFG80211_OpsVirtualInfAdd(struct wiphy *pWiphy,
const char *name, unsigned char name_assign_type, enum nl80211_iftype Type,
u32 *pFlags, struct vif_params *pParams)
Expand Down
4 changes: 4 additions & 0 deletions os/linux/cfg80211/cfg80211_inf.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,11 @@ void RTMP_CFG80211_VirtualIF_Init(void *pAdSrc, CHAR *pDevName, UINT32 DevType)
RTMP_OS_NETDEV_GET_DEVNAME(new_dev_p)));
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
new_dev_p->needs_free_netdev = true;
#else
new_dev_p->destructor = free_netdev;
#endif /* LINUX_VERSION_CODE */
RtmpOsSetNetDevPriv(new_dev_p, pAd);
NdisMoveMemory(&pNetDevOps->devAddr[0], &pAd->CurrentAddress[0], MAC_ADDR_LEN);

Expand Down
17 changes: 17 additions & 0 deletions os/linux/rt_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#include "rtmp_comm.h"
#include "rt_os_util.h"
#include "dot11i_wpa.h"
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
# include "rtmp_timer.h"
#endif
#include <linux/rtnetlink.h>

#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
Expand Down Expand Up @@ -98,15 +101,29 @@ static inline void __RTMP_SetPeriodicTimer(struct timer_list * pTimer,
add_timer(pTimer);
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
static void rtmp_timer_callback(struct timer_list *tl)
{
RALINK_TIMER_STRUCT *pTimer = from_timer(pTimer, tl, TimerObj);

pTimer->timer_callback((unsigned long) pTimer);
}
#endif /* LINUX_VERSION_CODE */

/* convert NdisMInitializeTimer --> RTMP_OS_Init_Timer */
static inline void __RTMP_OS_Init_Timer(void *pReserved,
struct timer_list * pTimer, TIMER_FUNCTION function,
PVOID data)
{
if (!timer_pending(pTimer)) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
pTimer->timer_callback = function;
timer_setup(pTimer, rtmp_timer_callback, 0);
#else
init_timer(pTimer);
pTimer->data = (unsigned long)data;
pTimer->function = function;
#endif /* LINUX_VERSION_CODE */
}
}

Expand Down
2 changes: 1 addition & 1 deletion os/linux/sta_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ static int rt_ioctl_iwaplist(struct net_device *dev, struct iw_request_info *inf
set_quality(pAd, &qual[i], pList); /*&pAd->ScanTab.BssEntry[i]); */
}
data->length = i;
memcpy(extra, &addr, i*sizeof(addr[0]));
memcpy(extra, addr, i*sizeof(addr[0]));
data->flags = 1; /* signal quality present (sort of) */
memcpy(extra + i*sizeof(addr[0]), &qual, i*sizeof(qual[i]));

Expand Down
3 changes: 3 additions & 0 deletions os/linux/usb_main_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ static int rt2870_probe(struct usb_interface *intf, struct usb_device *usb_dev,
return 0;

err_out_free_netdev:

#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0))
RtmpOSNetDevFree(net_dev);
#endif

err_out_free_radev:
RTMPFreeAdapter(pAd);
Expand Down