wlan: Stop traffic as soon as driver started unloading.

If driver unload happens through GUI, supplicant issue
hdd_stop and do initial cleanup before putting driver
in unloading mode while this is not case with CLI.
In case of CLI, as soon as rmmod happens,
driver goes into unloading state and traffic queues are still
active.
Ideally As soon as driver has set unload flag; driver
should stop traffic.
Need to flush traffic queue as soon as unload flag is set.

CRs-Fixed: 753417
Change-Id: I4e684f8cd1f75aa342c4f0f24393c15670bfafa7
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 13b783a..7ddcf39 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -7084,8 +7084,6 @@
    while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
    {
       pAdapter = pAdapterNode->pAdapter;
-      netif_tx_disable(pAdapter->dev);
-      netif_carrier_off(pAdapter->dev);
 
       hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE );
 
@@ -7897,6 +7895,19 @@
          pAdapter = pAdapterNode->pAdapter;
          if (NULL != pAdapter)
          {
+            /* Disable TX on the interface, after this hard_start_xmit() will
+             * not be called on that interface
+             */
+            netif_tx_disable(pAdapter->dev);
+
+            /* Mark the interface status as "down" for outside world */
+            netif_carrier_off(pAdapter->dev);
+
+            /* DeInit the adapter. This ensures that all data packets
+             * are freed.
+             */
+            hdd_deinit_adapter(pHddCtx, pAdapter);
+
             if (WLAN_HDD_INFRA_STATION ==  pAdapter->device_mode ||
                 WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)
             {