Commit 5743fc81 authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Greg Kroah-Hartman

staging: vt6656: move move all commands to iw_handler.

Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 11d404cb
This diff is collapsed.
......@@ -42,104 +42,105 @@
struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev);
int iwctl_siwap(struct net_device *dev, struct iw_request_info *info,
struct sockaddr *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra);
int iwctl_giwrange(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info,
__u32 *wmode, char *extra);
int iwctl_giwmode(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info,
__u32 *wmode, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info,
struct iw_freq *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info,
struct iw_freq *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwname(struct net_device *dev, struct iw_request_info *info,
char *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwap(struct net_device *dev, struct iw_request_info *info,
struct sockaddr *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra);
int iwctl_giwessid(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
int iwctl_giwrate(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq);
int iwctl_siwrts(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info,
struct iw_param *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info,
struct iw_point *wrq, char *extra);
union iwreq_data *wrqu, char *extra);
extern const struct iw_handler_def iwctl_handler_def;
extern const struct iw_priv_args iwctl_private_args;
extern const struct iw_priv_args iwctl_priv_args;
#endif /* __IWCTL_H__ */
......@@ -1558,7 +1558,6 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &pDevice->sMgmtObj;
PSCmdRequest pReq;
u8 *buffer;
struct iwreq *wrq = (struct iwreq *) rq;
int rc = 0;
......@@ -1569,343 +1568,6 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
switch(cmd) {
case SIOCGIWNAME:
rc = iwctl_giwname(dev, NULL, (char *)&(wrq->u.name), NULL);
break;
case SIOCSIWNWID:
case SIOCGIWNWID: //0x8b03 support
rc = -EOPNOTSUPP;
break;
// Set frequency/channel
case SIOCSIWFREQ:
rc = iwctl_siwfreq(dev, NULL, &(wrq->u.freq), NULL);
break;
// Get frequency/channel
case SIOCGIWFREQ:
rc = iwctl_giwfreq(dev, NULL, &(wrq->u.freq), NULL);
break;
// Set desired network name (ESSID)
case SIOCSIWESSID:
{
char essid[IW_ESSID_MAX_SIZE+1];
if (wrq->u.essid.length > IW_ESSID_MAX_SIZE) {
rc = -E2BIG;
break;
}
if (copy_from_user(essid, wrq->u.essid.pointer,
wrq->u.essid.length)) {
rc = -EFAULT;
break;
}
rc = iwctl_siwessid(dev, NULL,
&(wrq->u.essid), essid);
}
break;
// Get current network name (ESSID)
case SIOCGIWESSID:
{
char essid[IW_ESSID_MAX_SIZE+1];
if (wrq->u.essid.pointer) {
iwctl_giwessid(dev, NULL,
&(wrq->u.essid), essid);
if (copy_to_user(wrq->u.essid.pointer,
essid,
wrq->u.essid.length) )
rc = -EFAULT;
}
}
break;
case SIOCSIWAP:
rc = iwctl_siwap(dev, NULL, &(wrq->u.ap_addr), NULL);
break;
// Get current Access Point (BSSID)
case SIOCGIWAP:
rc = iwctl_giwap(dev, NULL, &(wrq->u.ap_addr), NULL);
break;
// Set desired station name
case SIOCSIWNICKN:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWNICKN \n");
rc = -EOPNOTSUPP;
break;
// Get current station name
case SIOCGIWNICKN:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWNICKN \n");
rc = -EOPNOTSUPP;
break;
// Set the desired bit-rate
case SIOCSIWRATE:
rc = iwctl_siwrate(dev, NULL, &(wrq->u.bitrate), NULL);
break;
// Get the current bit-rate
case SIOCGIWRATE:
iwctl_giwrate(dev, NULL, &(wrq->u.bitrate), NULL);
break;
// Set the desired RTS threshold
case SIOCSIWRTS:
rc = iwctl_siwrts(dev, &(wrq->u.rts));
break;
// Get the current RTS threshold
case SIOCGIWRTS:
rc = iwctl_giwrts(dev, NULL, &(wrq->u.rts), NULL);
break;
// Set the desired fragmentation threshold
case SIOCSIWFRAG:
rc = iwctl_siwfrag(dev, NULL, &(wrq->u.frag), NULL);
break;
// Get the current fragmentation threshold
case SIOCGIWFRAG:
rc = iwctl_giwfrag(dev, NULL, &(wrq->u.frag), NULL);
break;
// Set mode of operation
case SIOCSIWMODE:
rc = iwctl_siwmode(dev, NULL, &(wrq->u.mode), NULL);
break;
// Get mode of operation
case SIOCGIWMODE:
iwctl_giwmode(dev, NULL, &(wrq->u.mode), NULL);
break;
// Set WEP keys and mode
case SIOCSIWENCODE:
{
char abyKey[WLAN_WEP232_KEYLEN];
if (wrq->u.encoding.pointer) {
if (wrq->u.encoding.length > WLAN_WEP232_KEYLEN) {
rc = -E2BIG;
break;
}
memset(abyKey, 0, WLAN_WEP232_KEYLEN);
if (copy_from_user(abyKey,
wrq->u.encoding.pointer,
wrq->u.encoding.length)) {
rc = -EFAULT;
break;
}
} else if (wrq->u.encoding.length != 0) {
rc = -EINVAL;
break;
}
rc = iwctl_siwencode(dev, NULL, &(wrq->u.encoding), abyKey);
}
break;
// Get the WEP keys and mode
case SIOCGIWENCODE:
if (!capable(CAP_NET_ADMIN)) {
rc = -EPERM;
break;
}
{
char abyKey[WLAN_WEP232_KEYLEN];
rc = iwctl_giwencode(dev, NULL, &(wrq->u.encoding), abyKey);
if (rc != 0) break;
if (wrq->u.encoding.pointer) {
if (copy_to_user(wrq->u.encoding.pointer,
abyKey,
wrq->u.encoding.length))
rc = -EFAULT;
}
}
break;
// Get the current Tx-Power
case SIOCGIWTXPOW:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW \n");
rc = -EOPNOTSUPP;
break;
case SIOCSIWTXPOW:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW \n");
rc = -EOPNOTSUPP;
break;
case SIOCSIWRETRY:
rc = iwctl_siwretry(dev, NULL, &(wrq->u.retry), NULL);
break;
case SIOCGIWRETRY:
rc = iwctl_giwretry(dev, NULL, &(wrq->u.retry), NULL);
break;
// Get range of parameters
case SIOCGIWRANGE:
{
struct iw_range range;
iwctl_giwrange(dev, NULL, &(wrq->u.data), (char *) &range);
if (copy_to_user(wrq->u.data.pointer, &range, sizeof(struct iw_range)))
rc = -EFAULT;
}
break;
case SIOCGIWPOWER:
rc = iwctl_giwpower(dev, NULL, &(wrq->u.power), NULL);
break;
case SIOCSIWPOWER:
rc = iwctl_siwpower(dev, NULL, &(wrq->u.power), NULL);
break;
case SIOCGIWSENS:
rc = iwctl_giwsens(dev, NULL, &(wrq->u.sens), NULL);
break;
case SIOCSIWSENS:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSENS \n");
rc = -EOPNOTSUPP;
break;
case SIOCGIWAPLIST:
if (wrq->u.data.pointer) {
buffer = kzalloc((sizeof(struct sockaddr) +
sizeof(struct iw_quality)) * IW_MAX_AP,
GFP_KERNEL);
if (buffer == NULL) {
rc = -ENOMEM;
break;
}
rc = iwctl_giwaplist(dev, NULL, &(wrq->u.data), buffer);
if (rc < 0) {
kfree(buffer);
break;
}
if (copy_to_user(wrq->u.data.pointer, buffer,
wrq->u.data.length * (sizeof(struct sockaddr)
+ sizeof(struct iw_quality))))
rc = -EFAULT;
kfree(buffer);
}
break;
#ifdef WIRELESS_SPY
// Set the spy list
case SIOCSIWSPY:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY \n");
rc = -EOPNOTSUPP;
break;
// Get the spy list
case SIOCGIWSPY:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY \n");
rc = -EOPNOTSUPP;
break;
#endif // WIRELESS_SPY
case SIOCGIWPRIV:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPRIV \n");
rc = -EOPNOTSUPP;
/*
if(wrq->u.data.pointer) {
wrq->u.data.length = sizeof(iwctl_private_args) / sizeof( iwctl_private_args[0]);
if(copy_to_user(wrq->u.data.pointer,
(u_char *) iwctl_private_args,
sizeof(iwctl_private_args)))
rc = -EFAULT;
}
*/
break;
case SIOCSIWAUTH:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH\n");
rc = iwctl_siwauth(dev, NULL, &(wrq->u.param), NULL);
break;
case SIOCGIWAUTH:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAUTH \n");
rc = iwctl_giwauth(dev, NULL, &(wrq->u.param), NULL);
break;
case SIOCSIWGENIE:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWGENIE \n");
rc = iwctl_siwgenie(dev, NULL, &(wrq->u.data), wrq->u.data.pointer);
break;
case SIOCGIWGENIE:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWGENIE \n");
rc = iwctl_giwgenie(dev, NULL, &(wrq->u.data), wrq->u.data.pointer);
break;
case SIOCSIWENCODEEXT:
{
char extra[sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1];
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODEEXT \n");
if(wrq->u.encoding.pointer){
memset(extra, 0, sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1);
if(wrq->u.encoding.length > (sizeof(struct iw_encode_ext)+ MAX_KEY_LEN)){
rc = -E2BIG;
break;
}
if(copy_from_user(extra, wrq->u.encoding.pointer,wrq->u.encoding.length)){
rc = -EFAULT;
break;
}
}else if(wrq->u.encoding.length != 0){
rc = -EINVAL;
break;
}
rc = iwctl_siwencodeext(dev, NULL, &(wrq->u.encoding), extra);
}
break;
case SIOCGIWENCODEEXT:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODEEXT \n");
rc = iwctl_giwencodeext(dev, NULL, &(wrq->u.encoding), NULL);
break;
case SIOCSIWMLME:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMLME \n");
rc = iwctl_siwmlme(dev, NULL, &(wrq->u.data), wrq->u.data.pointer);
break;
case IOCTL_CMD_TEST:
......@@ -1968,50 +1630,9 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
case SIOCETHTOOL:
return ethtool_ioctl(dev, (void *) rq->ifr_data);
// All other calls are currently unsupported
default:
rc = -EOPNOTSUPP;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Ioctl command not supported..%x\n", cmd);
}
if (pDevice->bCommit) {
if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
netif_stop_queue(pDevice->dev);
spin_lock_irq(&pDevice->lock);
bScheduleCommand((void *) pDevice, WLAN_CMD_RUN_AP, NULL);
spin_unlock_irq(&pDevice->lock);
}
else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Commit the settings\n");
spin_lock_irq(&pDevice->lock);
//2007-1121-01<Modify>by EinsnLiu
if (pDevice->bLinkPass &&
memcmp(pMgmt->abyCurrSSID,pMgmt->abyDesireSSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN)) {
bScheduleCommand((void *) pDevice, WLAN_CMD_DISASSOCIATE, NULL);
} else {
pDevice->bLinkPass = FALSE;
pMgmt->eCurrState = WMAC_STATE_IDLE;
memset(pMgmt->abyCurrBSSID, 0, 6);
}
ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW);
//End Modify
netif_stop_queue(pDevice->dev);
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
if (!pDevice->bWPASuppWextEnabled)
bScheduleCommand((void *) pDevice,
WLAN_CMD_BSSID_SCAN,
pMgmt->abyDesireSSID);
bScheduleCommand((void *) pDevice,
WLAN_CMD_SSID,
NULL);
spin_unlock_irq(&pDevice->lock);
}
pDevice->bCommit = FALSE;
}
return rc;
}
......
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