Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4cac481 authored by Glen Lee's avatar Glen Lee Committed by Greg Kroah-Hartman
Browse files

staging: wilc1000: move perInterface_wlan_t to wilc_vif



perInterface_wlan_t and wilc_vif are all about interface control informations.
We will combine those two structures and maintain as one network interface
control information.
Move all the members of perInterface_wlan_t to wilc_vif and remove the
structure. Rename perInterace_wlan_t to wilc_vif and rename variable name nic
to vif which is proper name for it.

Signed-off-by: default avatarGlen Lee <glen.lee@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 320edd03
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -3779,11 +3779,11 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
	s32 result = 0;
	s32 result = 0;
	struct host_if_drv *hif_drv;
	struct host_if_drv *hif_drv;
	int err;
	int err;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1);
	PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1);


+125 −126
Original line number Original line Diff line number Diff line
@@ -64,7 +64,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
	struct host_if_drv *hif_drv;
	struct host_if_drv *hif_drv;
	struct net_device *dev;
	struct net_device *dev;
	u8 *ip_addr_buf;
	u8 *ip_addr_buf;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	u8 null_ip[4] = {0};
	u8 null_ip[4] = {0};
	char wlan_dev_name[5] = "wlan0";
	char wlan_dev_name[5] = "wlan0";


@@ -90,8 +90,8 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
		return NOTIFY_DONE;
		return NOTIFY_DONE;
	}
	}
	hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
	hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv;
	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	if (!nic || !hif_drv) {
	if (!vif || !hif_drv) {
		PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
		PRINT_D(GENERIC_DBG, "No Wireless Priv\n");
		return NOTIFY_DONE;
		return NOTIFY_DONE;
	}
	}
@@ -104,7 +104,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event


		PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Obtained ===============\n\n");
		PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Obtained ===============\n\n");


		if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) {
		if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
			hif_drv->IFC_UP = 1;
			hif_drv->IFC_UP = 1;
			wilc_optaining_ip = false;
			wilc_optaining_ip = false;
			del_timer(&wilc_during_ip_timer);
			del_timer(&wilc_during_ip_timer);
@@ -120,7 +120,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
		PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n",
		PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n",
			ip_addr_buf[0], ip_addr_buf[1],
			ip_addr_buf[0], ip_addr_buf[1],
			ip_addr_buf[2], ip_addr_buf[3]);
			ip_addr_buf[2], ip_addr_buf[3]);
		wilc_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx);
		wilc_setup_ipaddress(hif_drv, ip_addr_buf, vif->u8IfIdx);


		break;
		break;


@@ -128,7 +128,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
		PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_DOWN %p\n", dev);
		PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_DOWN %p\n", dev);


		PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Released ===============\n\n");
		PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Released ===============\n\n");
		if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) {
		if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) {
			hif_drv->IFC_UP = 0;
			hif_drv->IFC_UP = 0;
			wilc_optaining_ip = false;
			wilc_optaining_ip = false;
		}
		}
@@ -145,7 +145,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event
			ip_addr_buf[0], ip_addr_buf[1],
			ip_addr_buf[0], ip_addr_buf[1],
			ip_addr_buf[2], ip_addr_buf[3]);
			ip_addr_buf[2], ip_addr_buf[3]);


		wilc_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx);
		wilc_setup_ipaddress(hif_drv, ip_addr_buf, vif->u8IfIdx);


		break;
		break;


@@ -161,12 +161,12 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event


static irqreturn_t isr_uh_routine(int irq, void *user_data)
static irqreturn_t isr_uh_routine(int irq, void *user_data)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;
	struct net_device *dev = (struct net_device *)user_data;
	struct net_device *dev = (struct net_device *)user_data;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;
	PRINT_D(INT_DBG, "Interrupt received UH\n");
	PRINT_D(INT_DBG, "Interrupt received UH\n");


	if (wilc->close) {
	if (wilc->close) {
@@ -178,11 +178,11 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data)


static irqreturn_t isr_bh_routine(int irq, void *userdata)
static irqreturn_t isr_bh_routine(int irq, void *userdata)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(userdata);
	vif = netdev_priv(userdata);
	wilc = nic->wilc;
	wilc = vif->wilc;


	if (wilc->close) {
	if (wilc->close) {
		PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n");
		PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n");
@@ -198,11 +198,11 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
static int init_irq(struct net_device *dev)
static int init_irq(struct net_device *dev)
{
{
	int ret = 0;
	int ret = 0;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wl;
	struct wilc *wl;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wl = nic->wilc;
	wl = vif->wilc;


	if ((gpio_request(wl->gpio, "WILC_INTR") == 0) &&
	if ((gpio_request(wl->gpio, "WILC_INTR") == 0) &&
	    (gpio_direction_input(wl->gpio) == 0)) {
	    (gpio_direction_input(wl->gpio) == 0)) {
@@ -230,11 +230,11 @@ static int init_irq(struct net_device *dev)


static void deinit_irq(struct net_device *dev)
static void deinit_irq(struct net_device *dev)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	/* Deintialize IRQ */
	/* Deintialize IRQ */
	if (wilc->dev_irq_num) {
	if (wilc->dev_irq_num) {
@@ -311,11 +311,11 @@ int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid)
{
{
	int i = 0;
	int i = 0;
	int ret = -1;
	int ret = -1;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(wilc_netdev);
	vif = netdev_priv(wilc_netdev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	for (i = 0; i < wilc->vif_num; i++)
	for (i = 0; i < wilc->vif_num; i++)
		if (wilc->vif[i].ndev == wilc_netdev) {
		if (wilc->vif[i].ndev == wilc_netdev) {
@@ -345,7 +345,7 @@ int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc)
static int linux_wlan_txq_task(void *vp)
static int linux_wlan_txq_task(void *vp)
{
{
	int ret, txq_count;
	int ret, txq_count;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wl;
	struct wilc *wl;
	struct net_device *dev = vp;
	struct net_device *dev = vp;
#if defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
#if defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS
@@ -357,8 +357,8 @@ static int linux_wlan_txq_task(void *vp)
	int backoff_weight = TX_BACKOFF_WEIGHT_MIN;
	int backoff_weight = TX_BACKOFF_WEIGHT_MIN;
#endif
#endif


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wl = nic->wilc;
	wl = vif->wilc;


	up(&wl->txq_thread_started);
	up(&wl->txq_thread_started);
	while (1) {
	while (1) {
@@ -417,31 +417,31 @@ void wilc_rx_complete(struct wilc *nic)


int wilc_wlan_get_firmware(struct net_device *dev)
int wilc_wlan_get_firmware(struct net_device *dev)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;
	int ret = 0;
	int ret = 0;
	const struct firmware *wilc_firmware;
	const struct firmware *wilc_firmware;
	char *firmware;
	char *firmware;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	if (nic->iftype == AP_MODE) {
	if (vif->iftype == AP_MODE) {
		firmware = AP_FIRMWARE;
		firmware = AP_FIRMWARE;
	} else if (nic->iftype == STATION_MODE) {
	} else if (vif->iftype == STATION_MODE) {
		firmware = STA_FIRMWARE;
		firmware = STA_FIRMWARE;
	} else {
	} else {
		PRINT_D(INIT_DBG, "Get P2P_CONCURRENCY_FIRMWARE\n");
		PRINT_D(INIT_DBG, "Get P2P_CONCURRENCY_FIRMWARE\n");
		firmware = P2P_CONCURRENCY_FIRMWARE;
		firmware = P2P_CONCURRENCY_FIRMWARE;
	}
	}


	if (!nic) {
	if (!vif) {
		PRINT_ER("NIC is NULL\n");
		PRINT_ER("vif is NULL\n");
		goto _fail_;
		goto _fail_;
	}
	}


	if (!(&nic->wilc_netdev->dev)) {
	if (!(&vif->wilc_netdev->dev)) {
		PRINT_ER("&nic->wilc_netdev->dev  is NULL\n");
		PRINT_ER("&vif->wilc_netdev->dev  is NULL\n");
		goto _fail_;
		goto _fail_;
	}
	}


@@ -459,12 +459,12 @@ int wilc_wlan_get_firmware(struct net_device *dev)


static int linux_wlan_start_firmware(struct net_device *dev)
static int linux_wlan_start_firmware(struct net_device *dev)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;
	int ret = 0;
	int ret = 0;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	PRINT_D(INIT_DBG, "Starting Firmware ...\n");
	PRINT_D(INIT_DBG, "Starting Firmware ...\n");
	ret = wilc_wlan_start(wilc);
	ret = wilc_wlan_start(wilc);
@@ -486,12 +486,12 @@ static int linux_wlan_start_firmware(struct net_device *dev)


static int wilc1000_firmware_download(struct net_device *dev)
static int wilc1000_firmware_download(struct net_device *dev)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;
	int ret = 0;
	int ret = 0;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	if (!wilc->firmware) {
	if (!wilc->firmware) {
		PRINT_ER("Firmware buffer is NULL\n");
		PRINT_ER("Firmware buffer is NULL\n");
@@ -734,11 +734,11 @@ static int linux_wlan_init_test_config(struct net_device *dev,


void wilc1000_wlan_deinit(struct net_device *dev)
void wilc1000_wlan_deinit(struct net_device *dev)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wl;
	struct wilc *wl;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wl = nic->wilc;
	wl = vif->wilc;


	if (!wl) {
	if (!wl) {
		netdev_err(dev, "wl is NULL\n");
		netdev_err(dev, "wl is NULL\n");
@@ -794,11 +794,11 @@ void wilc1000_wlan_deinit(struct net_device *dev)


static int wlan_init_locks(struct net_device *dev)
static int wlan_init_locks(struct net_device *dev)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wl;
	struct wilc *wl;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wl = nic->wilc;
	wl = vif->wilc;


	PRINT_D(INIT_DBG, "Initializing Locks ...\n");
	PRINT_D(INIT_DBG, "Initializing Locks ...\n");


@@ -820,11 +820,11 @@ static int wlan_init_locks(struct net_device *dev)


static int wlan_deinit_locks(struct net_device *dev)
static int wlan_deinit_locks(struct net_device *dev)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	PRINT_D(INIT_DBG, "De-Initializing Locks\n");
	PRINT_D(INIT_DBG, "De-Initializing Locks\n");


@@ -839,11 +839,11 @@ static int wlan_deinit_locks(struct net_device *dev)


static int wlan_initialize_threads(struct net_device *dev)
static int wlan_initialize_threads(struct net_device *dev)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	PRINT_D(INIT_DBG, "Initializing Threads ...\n");
	PRINT_D(INIT_DBG, "Initializing Threads ...\n");
	PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
	PRINT_D(INIT_DBG, "Creating kthread for transmission\n");
@@ -861,10 +861,10 @@ static int wlan_initialize_threads(struct net_device *dev)


static void wlan_deinitialize_threads(struct net_device *dev)
static void wlan_deinitialize_threads(struct net_device *dev)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wl;
	struct wilc *wl;
	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wl = nic->wilc;
	wl = vif->wilc;


	wl->close = 1;
	wl->close = 1;
	PRINT_D(INIT_DBG, "Deinitializing Threads\n");
	PRINT_D(INIT_DBG, "Deinitializing Threads\n");
@@ -878,11 +878,10 @@ static void wlan_deinitialize_threads(struct net_device *dev)
	}
	}
}
}


int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)
{
{
	perInterface_wlan_t *nic = p_nic;
	int ret = 0;
	int ret = 0;
	struct wilc *wl = nic->wilc;
	struct wilc *wl = vif->wilc;


	if (!wl->initialized) {
	if (!wl->initialized) {
		wl->mac_status = WILC_MAC_STATUS_INIT;
		wl->mac_status = WILC_MAC_STATUS_INIT;
@@ -992,7 +991,7 @@ static int mac_init_fn(struct net_device *ndev)


int wilc_mac_open(struct net_device *ndev)
int wilc_mac_open(struct net_device *ndev)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	unsigned char mac_add[ETH_ALEN] = {0};
	unsigned char mac_add[ETH_ALEN] = {0};
@@ -1001,17 +1000,17 @@ int wilc_mac_open(struct net_device *ndev)
	struct wilc_priv *priv;
	struct wilc_priv *priv;
	struct wilc *wl;
	struct wilc *wl;


	nic = netdev_priv(ndev);
	vif = netdev_priv(ndev);
	wl = nic->wilc;
	wl = vif->wilc;


	if (!wl|| !wl->dev) {
	if (!wl|| !wl->dev) {
		netdev_err(ndev, "wilc1000: SPI device not ready\n");
		netdev_err(ndev, "wilc1000: SPI device not ready\n");
		return -ENODEV;
		return -ENODEV;
	}
	}


	nic = netdev_priv(ndev);
	vif = netdev_priv(ndev);
	wilc = nic->wilc;
	wilc = vif->wilc;
	priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
	priv = wiphy_priv(vif->wilc_netdev->ieee80211_ptr->wiphy);
	PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);
	PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);


	ret = wilc_init_host_int(ndev);
	ret = wilc_init_host_int(ndev);
@@ -1022,7 +1021,7 @@ int wilc_mac_open(struct net_device *ndev)
	}
	}


	PRINT_D(INIT_DBG, "*** re-init ***\n");
	PRINT_D(INIT_DBG, "*** re-init ***\n");
	ret = wilc1000_wlan_init(ndev, nic);
	ret = wilc1000_wlan_init(ndev, vif);
	if (ret < 0) {
	if (ret < 0) {
		PRINT_ER("Failed to initialize wilc1000\n");
		PRINT_ER("Failed to initialize wilc1000\n");
		wilc_deinit_host_int(ndev);
		wilc_deinit_host_int(ndev);
@@ -1051,25 +1050,25 @@ int wilc_mac_open(struct net_device *ndev)
		return -EINVAL;
		return -EINVAL;
	}
	}


	wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy,
	wilc_mgmt_frame_register(vif->wilc_netdev->ieee80211_ptr->wiphy,
				 nic->wilc_netdev->ieee80211_ptr,
				 vif->wilc_netdev->ieee80211_ptr,
				 nic->g_struct_frame_reg[0].frame_type,
				 vif->g_struct_frame_reg[0].frame_type,
				 nic->g_struct_frame_reg[0].reg);
				 vif->g_struct_frame_reg[0].reg);
	wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy,
	wilc_mgmt_frame_register(vif->wilc_netdev->ieee80211_ptr->wiphy,
				 nic->wilc_netdev->ieee80211_ptr,
				 vif->wilc_netdev->ieee80211_ptr,
				 nic->g_struct_frame_reg[1].frame_type,
				 vif->g_struct_frame_reg[1].frame_type,
				 nic->g_struct_frame_reg[1].reg);
				 vif->g_struct_frame_reg[1].reg);
	netif_wake_queue(ndev);
	netif_wake_queue(ndev);
	wl->open_ifcs++;
	wl->open_ifcs++;
	nic->mac_opened = 1;
	vif->mac_opened = 1;
	return 0;
	return 0;
}
}


static struct net_device_stats *mac_stats(struct net_device *dev)
static struct net_device_stats *mac_stats(struct net_device *dev)
{
{
	perInterface_wlan_t *nic = netdev_priv(dev);
	struct wilc_vif *vif= netdev_priv(dev);


	return &nic->netstats;
	return &vif->netstats;
}
}


static void wilc_set_multicast_list(struct net_device *dev)
static void wilc_set_multicast_list(struct net_device *dev)
@@ -1137,7 +1136,7 @@ static void linux_wlan_tx_complete(void *priv, int status)


int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct tx_complete_data *tx_data = NULL;
	struct tx_complete_data *tx_data = NULL;
	int queue_count;
	int queue_count;
	char *udp_buf;
	char *udp_buf;
@@ -1145,8 +1144,8 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
	struct ethhdr *eth_h;
	struct ethhdr *eth_h;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(ndev);
	vif = netdev_priv(ndev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n");
	PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n");


@@ -1181,9 +1180,9 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)


	PRINT_D(TX_DBG, "Sending packet - Size = %d - Address = %p - SKB = %p\n", tx_data->size, tx_data->buff, tx_data->skb);
	PRINT_D(TX_DBG, "Sending packet - Size = %d - Address = %p - SKB = %p\n", tx_data->size, tx_data->buff, tx_data->skb);
	PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
	PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n");
	nic->netstats.tx_packets++;
	vif->netstats.tx_packets++;
	nic->netstats.tx_bytes += tx_data->size;
	vif->netstats.tx_bytes += tx_data->size;
	tx_data->pBssid = wilc->vif[nic->u8IfIdx].bssid;
	tx_data->pBssid = wilc->vif[vif->u8IfIdx].bssid;
	queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
	queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data,
						tx_data->buff, tx_data->size,
						tx_data->buff, tx_data->size,
						linux_wlan_tx_complete);
						linux_wlan_tx_complete);
@@ -1199,20 +1198,20 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev)
int wilc_mac_close(struct net_device *ndev)
int wilc_mac_close(struct net_device *ndev)
{
{
	struct wilc_priv *priv;
	struct wilc_priv *priv;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct host_if_drv *hif_drv;
	struct host_if_drv *hif_drv;
	struct wilc *wl;
	struct wilc *wl;


	nic = netdev_priv(ndev);
	vif = netdev_priv(ndev);


	if (!nic || !nic->wilc_netdev || !nic->wilc_netdev->ieee80211_ptr ||
	if (!vif || !vif->wilc_netdev || !vif->wilc_netdev->ieee80211_ptr ||
	    !nic->wilc_netdev->ieee80211_ptr->wiphy) {
	    !vif->wilc_netdev->ieee80211_ptr->wiphy) {
		PRINT_ER("nic = NULL\n");
		PRINT_ER("vif = NULL\n");
		return 0;
		return 0;
	}
	}


	priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
	priv = wiphy_priv(vif->wilc_netdev->ieee80211_ptr->wiphy);
	wl = nic->wilc;
	wl = vif->wilc;


	if (!priv) {
	if (!priv) {
		PRINT_ER("priv = NULL\n");
		PRINT_ER("priv = NULL\n");
@@ -1240,10 +1239,10 @@ int wilc_mac_close(struct net_device *ndev)
		return 0;
		return 0;
	}
	}


	if (nic->wilc_netdev) {
	if (vif->wilc_netdev) {
		netif_stop_queue(nic->wilc_netdev);
		netif_stop_queue(vif->wilc_netdev);


		wilc_deinit_host_int(nic->wilc_netdev);
		wilc_deinit_host_int(vif->wilc_netdev);
	}
	}


	if (wl->open_ifcs == 0) {
	if (wl->open_ifcs == 0) {
@@ -1254,7 +1253,7 @@ int wilc_mac_close(struct net_device *ndev)
	}
	}


	up(&close_exit_sync);
	up(&close_exit_sync);
	nic->mac_opened = 0;
	vif->mac_opened = 0;


	return 0;
	return 0;
}
}
@@ -1264,13 +1263,13 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
	u8 *buff = NULL;
	u8 *buff = NULL;
	s8 rssi;
	s8 rssi;
	u32 size = 0, length = 0;
	u32 size = 0, length = 0;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc_priv *priv;
	struct wilc_priv *priv;
	s32 ret = 0;
	s32 ret = 0;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(ndev);
	vif = netdev_priv(ndev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	if (!wilc->initialized)
	if (!wilc->initialized)
		return 0;
		return 0;
@@ -1289,7 +1288,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
				return PTR_ERR(buff);
				return PTR_ERR(buff);


			if (strncasecmp(buff, "RSSI", length) == 0) {
			if (strncasecmp(buff, "RSSI", length) == 0) {
				priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
				priv = wiphy_priv(vif->wilc_netdev->ieee80211_ptr->wiphy);
				ret = wilc_get_rssi(priv->hWILCWFIDrv, &rssi);
				ret = wilc_get_rssi(priv->hWILCWFIDrv, &rssi);
				if (ret)
				if (ret)
					PRINT_ER("Failed to send get rssi param's message queue ");
					PRINT_ER("Failed to send get rssi param's message queue ");
@@ -1331,14 +1330,14 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
	unsigned char *buff_to_send = NULL;
	unsigned char *buff_to_send = NULL;
	struct sk_buff *skb;
	struct sk_buff *skb;
	struct net_device *wilc_netdev;
	struct net_device *wilc_netdev;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;


	wilc_netdev = get_if_handler(wilc, buff);
	wilc_netdev = get_if_handler(wilc, buff);
	if (!wilc_netdev)
	if (!wilc_netdev)
		return;
		return;


	buff += pkt_offset;
	buff += pkt_offset;
	nic = netdev_priv(wilc_netdev);
	vif = netdev_priv(wilc_netdev);


	if (size > 0) {
	if (size > 0) {
		frame_len = size;
		frame_len = size;
@@ -1360,8 +1359,8 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
		memcpy(skb_put(skb, frame_len), buff_to_send, frame_len);
		memcpy(skb_put(skb, frame_len), buff_to_send, frame_len);


		skb->protocol = eth_type_trans(skb, wilc_netdev);
		skb->protocol = eth_type_trans(skb, wilc_netdev);
		nic->netstats.rx_packets++;
		vif->netstats.rx_packets++;
		nic->netstats.rx_bytes += frame_len;
		vif->netstats.rx_bytes += frame_len;
		skb->ip_summed = CHECKSUM_UNNECESSARY;
		skb->ip_summed = CHECKSUM_UNNECESSARY;
		stats = netif_rx(skb);
		stats = netif_rx(skb);
		PRINT_D(RX_DBG, "netif_rx ret value is: %d\n", stats);
		PRINT_D(RX_DBG, "netif_rx ret value is: %d\n", stats);
@@ -1371,32 +1370,32 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset)
void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size)
{
{
	int i = 0;
	int i = 0;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;


	for (i = 0; i < wilc->vif_num; i++) {
	for (i = 0; i < wilc->vif_num; i++) {
		nic = netdev_priv(wilc->vif[i].ndev);
		vif = netdev_priv(wilc->vif[i].ndev);
		if (nic->monitor_flag) {
		if (vif->monitor_flag) {
			WILC_WFI_monitor_rx(buff, size);
			WILC_WFI_monitor_rx(buff, size);
			return;
			return;
		}
		}
	}
	}


	nic = netdev_priv(wilc->vif[1].ndev);
	vif = netdev_priv(wilc->vif[1].ndev);
	if ((buff[0] == nic->g_struct_frame_reg[0].frame_type && nic->g_struct_frame_reg[0].reg) ||
	if ((buff[0] == vif->g_struct_frame_reg[0].frame_type && vif->g_struct_frame_reg[0].reg) ||
	    (buff[0] == nic->g_struct_frame_reg[1].frame_type && nic->g_struct_frame_reg[1].reg))
	    (buff[0] == vif->g_struct_frame_reg[1].frame_type && vif->g_struct_frame_reg[1].reg))
		WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size);
		WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size);
}
}


void wilc_netdev_cleanup(struct wilc *wilc)
void wilc_netdev_cleanup(struct wilc *wilc)
{
{
	int i = 0;
	int i = 0;
	perInterface_wlan_t *nic[NUM_CONCURRENT_IFC];
	struct wilc_vif *vif[NUM_CONCURRENT_IFC];


	if (wilc && (wilc->vif[0].ndev || wilc->vif[1].ndev)) {
	if (wilc && (wilc->vif[0].ndev || wilc->vif[1].ndev)) {
		unregister_inetaddr_notifier(&g_dev_notifier);
		unregister_inetaddr_notifier(&g_dev_notifier);


		for (i = 0; i < NUM_CONCURRENT_IFC; i++)
		for (i = 0; i < NUM_CONCURRENT_IFC; i++)
			nic[i] = netdev_priv(wilc->vif[i].ndev);
			vif[i] = netdev_priv(wilc->vif[i].ndev);
	}
	}


	if (wilc && wilc->firmware)
	if (wilc && wilc->firmware)
@@ -1407,7 +1406,7 @@ void wilc_netdev_cleanup(struct wilc *wilc)


		for (i = 0; i < NUM_CONCURRENT_IFC; i++)
		for (i = 0; i < NUM_CONCURRENT_IFC; i++)
			if (wilc->vif[i].ndev)
			if (wilc->vif[i].ndev)
				if (nic[i]->mac_opened)
				if (vif[i]->mac_opened)
					wilc_mac_close(wilc->vif[i].ndev);
					wilc_mac_close(wilc->vif[i].ndev);


		for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
		for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
@@ -1425,7 +1424,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
		     int gpio, const struct wilc_hif_func *ops)
		     int gpio, const struct wilc_hif_func *ops)
{
{
	int i;
	int i;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct net_device *ndev;
	struct net_device *ndev;
	struct wilc *wl;
	struct wilc *wl;


@@ -1443,23 +1442,23 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
	register_inetaddr_notifier(&g_dev_notifier);
	register_inetaddr_notifier(&g_dev_notifier);


	for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
	for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
		ndev = alloc_etherdev(sizeof(perInterface_wlan_t));
		ndev = alloc_etherdev(sizeof(struct wilc_vif));
		if (!ndev) {
		if (!ndev) {
			PRINT_ER("Failed to allocate ethernet dev\n");
			PRINT_ER("Failed to allocate ethernet dev\n");
			return -1;
			return -1;
		}
		}


		nic = netdev_priv(ndev);
		vif = netdev_priv(ndev);
		memset(nic, 0, sizeof(perInterface_wlan_t));
		memset(vif, 0, sizeof(struct wilc_vif));


		if (i == 0)
		if (i == 0)
			strcpy(ndev->name, "wlan%d");
			strcpy(ndev->name, "wlan%d");
		else
		else
			strcpy(ndev->name, "p2p%d");
			strcpy(ndev->name, "p2p%d");


		nic->u8IfIdx = wl->vif_num;
		vif->u8IfIdx = wl->vif_num;
		nic->wilc_netdev = ndev;
		vif->wilc_netdev = ndev;
		nic->wilc = *wilc;
		vif->wilc = *wilc;
		wl->vif[wl->vif_num].ndev = ndev;
		wl->vif[wl->vif_num].ndev = ndev;
		wl->vif_num++;
		wl->vif_num++;
		ndev->netdev_ops = &wilc_netdev_ops;
		ndev->netdev_ops = &wilc_netdev_ops;
@@ -1476,13 +1475,13 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
				return -1;
				return -1;
			}
			}


			nic->wilc_netdev->ieee80211_ptr = wdev;
			vif->wilc_netdev->ieee80211_ptr = wdev;
			nic->wilc_netdev->ml_priv = nic;
			vif->wilc_netdev->ml_priv = vif;
			wdev->netdev = nic->wilc_netdev;
			wdev->netdev = vif->wilc_netdev;
			nic->netstats.rx_packets = 0;
			vif->netstats.rx_packets = 0;
			nic->netstats.tx_packets = 0;
			vif->netstats.tx_packets = 0;
			nic->netstats.rx_bytes = 0;
			vif->netstats.rx_bytes = 0;
			nic->netstats.tx_bytes = 0;
			vif->netstats.tx_bytes = 0;
		}
		}


		if (register_netdev(ndev)) {
		if (register_netdev(ndev)) {
@@ -1491,8 +1490,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
			return -1;
			return -1;
		}
		}


		nic->iftype = STATION_MODE;
		vif->iftype = STATION_MODE;
		nic->mac_opened = 0;
		vif->mac_opened = 0;
	}
	}


	return 0;
	return 0;
+74 −74

File changed.

Preview size limit exceeded, changes collapsed.

+9 −12
Original line number Original line Diff line number Diff line
@@ -149,6 +149,14 @@ typedef struct {
} struct_frame_reg;
} struct_frame_reg;


struct wilc_vif {
struct wilc_vif {
	u8 u8IfIdx;
	u8 iftype;
	int monitor_flag;
	int mac_opened;
	struct_frame_reg g_struct_frame_reg[num_reg_frame];
	struct net_device *wilc_netdev;
	struct net_device_stats netstats;
	struct wilc *wilc;
	u8 src_addr[ETH_ALEN];
	u8 src_addr[ETH_ALEN];
	u8 bssid[ETH_ALEN];
	u8 bssid[ETH_ALEN];
	struct host_if_drv *hif_drv;
	struct host_if_drv *hif_drv;
@@ -210,22 +218,11 @@ struct wilc {
	struct device *dev;
	struct device *dev;
};
};


typedef struct {
	u8 u8IfIdx;
	u8 iftype;
	int monitor_flag;
	int mac_opened;
	struct_frame_reg g_struct_frame_reg[num_reg_frame];
	struct net_device *wilc_netdev;
	struct net_device_stats netstats;
	struct wilc *wilc;
} perInterface_wlan_t;

struct WILC_WFI_mon_priv {
struct WILC_WFI_mon_priv {
	struct net_device *real_ndev;
	struct net_device *real_ndev;
};
};


int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif);


void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
void wilc_mac_indicate(struct wilc *wilc, int flag);
void wilc_mac_indicate(struct wilc *wilc, int flag);
+30 −30
Original line number Original line Diff line number Diff line
@@ -72,11 +72,11 @@ wilc_wlan_txq_remove_from_head(struct net_device *dev)
{
{
	struct txq_entry_t *tqe;
	struct txq_entry_t *tqe;
	unsigned long flags;
	unsigned long flags;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	spin_lock_irqsave(&wilc->txq_spinlock, flags);
	spin_lock_irqsave(&wilc->txq_spinlock, flags);
	if (wilc->txq_head) {
	if (wilc->txq_head) {
@@ -97,11 +97,11 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev,
				      struct txq_entry_t *tqe)
				      struct txq_entry_t *tqe)
{
{
	unsigned long flags;
	unsigned long flags;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	spin_lock_irqsave(&wilc->txq_spinlock, flags);
	spin_lock_irqsave(&wilc->txq_spinlock, flags);


@@ -239,11 +239,11 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
	unsigned short h_proto;
	unsigned short h_proto;
	int i;
	int i;
	unsigned long flags;
	unsigned long flags;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;




	eth_hdr_ptr = &buffer[0];
	eth_hdr_ptr = &buffer[0];
@@ -301,13 +301,13 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)


static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev)
{
{
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;
	u32 i = 0;
	u32 i = 0;
	u32 dropped = 0;
	u32 dropped = 0;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	spin_lock_irqsave(&wilc->txq_spinlock, wilc->txq_spinlock_flags);
	spin_lock_irqsave(&wilc->txq_spinlock, wilc->txq_spinlock_flags);
	for (i = pending_base; i < (pending_base + pending_acks); i++) {
	for (i = pending_base; i < (pending_base + pending_acks); i++) {
@@ -397,10 +397,10 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
			      u32 buffer_size, wilc_tx_complete_func_t func)
			      u32 buffer_size, wilc_tx_complete_func_t func)
{
{
	struct txq_entry_t *tqe;
	struct txq_entry_t *tqe;
	perInterface_wlan_t *nic = netdev_priv(dev);
	struct wilc_vif *vif = netdev_priv(dev);
	struct wilc *wilc;
	struct wilc *wilc;


	wilc = nic->wilc;
	wilc = vif->wilc;


	if (wilc->quit)
	if (wilc->quit)
		return 0;
		return 0;
@@ -429,10 +429,10 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
			       u32 buffer_size, wilc_tx_complete_func_t func)
			       u32 buffer_size, wilc_tx_complete_func_t func)
{
{
	struct txq_entry_t *tqe;
	struct txq_entry_t *tqe;
	perInterface_wlan_t *nic = netdev_priv(dev);
	struct wilc_vif *vif = netdev_priv(dev);
	struct wilc *wilc;
	struct wilc *wilc;


	wilc = nic->wilc;
	wilc = vif->wilc;


	if (wilc->quit)
	if (wilc->quit)
		return 0;
		return 0;
@@ -676,11 +676,11 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
	int counter;
	int counter;
	int timeout;
	int timeout;
	u32 vmm_table[WILC_VMM_TBL_SIZE];
	u32 vmm_table[WILC_VMM_TBL_SIZE];
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	txb = wilc->tx_buffer;
	txb = wilc->tx_buffer;
	wilc->txq_exit = 0;
	wilc->txq_exit = 0;
@@ -1348,11 +1348,11 @@ void wilc_wlan_cleanup(struct net_device *dev)
	struct rxq_entry_t *rqe;
	struct rxq_entry_t *rqe;
	u32 reg = 0;
	u32 reg = 0;
	int ret;
	int ret;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	wilc->quit = 1;
	wilc->quit = 1;
	do {
	do {
@@ -1510,11 +1510,11 @@ static u32 init_chip(struct net_device *dev)
{
{
	u32 chipid;
	u32 chipid;
	u32 reg, ret = 0;
	u32 reg, ret = 0;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	acquire_bus(wilc, ACQUIRE_ONLY);
	acquire_bus(wilc, ACQUIRE_ONLY);


@@ -1580,10 +1580,10 @@ u32 wilc_get_chipid(struct wilc *wilc, u8 update)
int wilc_wlan_init(struct net_device *dev)
int wilc_wlan_init(struct net_device *dev)
{
{
	int ret = 0;
	int ret = 0;
	perInterface_wlan_t *nic = netdev_priv(dev);
	struct wilc_vif *vif = netdev_priv(dev);
	struct wilc *wilc;
	struct wilc *wilc;


	wilc = nic->wilc;
	wilc = vif->wilc;


	PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n");
	PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n");


@@ -1640,11 +1640,11 @@ u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value)
{
{
	u16 ret;
	u16 ret;
	u32 reg;
	u32 reg;
	perInterface_wlan_t *nic;
	struct wilc_vif *vif;
	struct wilc *wilc;
	struct wilc *wilc;


	nic = netdev_priv(dev);
	vif = netdev_priv(dev);
	wilc = nic->wilc;
	wilc = vif->wilc;


	mutex_lock(&wilc->hif_cs);
	mutex_lock(&wilc->hif_cs);
	ret = wilc->hif_func->hif_read_reg(wilc, WILC_CHANGING_VIR_IF,
	ret = wilc->hif_func->hif_read_reg(wilc, WILC_CHANGING_VIR_IF,