[PATCH] libertas: make mesh functionality configurable

Marcelo Tosatti marcelo at kvack.org
Fri Feb 16 12:46:12 EST 2007


Holger,

I think that detection of mesh functionality should be done at runtime,
by checking if the firmware has mesh support, instead of being a
compile-time option.

On Fri, Feb 16, 2007 at 04:58:11PM +0100, Holger Schurig wrote:
> libertas: make mesh functionality configurable
> 
> For devices that don't support wireless mesh via it's firmware,
> it would be useless to compile the necessary code into the kernel.
> 
> Signed-off-by: Holger Schurig <hs4233 at mail.mn-solutions.de>
> 
> --- libertas-2.6.orig/drivers/net/wireless/Kconfig
> +++ libertas-2.6/drivers/net/wireless/Kconfig
> @@ -287,6 +287,13 @@
>  	---help---
>  	  A driver for Marvell Libertas 8388 USB devices.
>  
> +config LIBERTAS_MESH
> +	bool "Support Wireless mesh"
> +	depends on LIBERTAS_USB
> +	---help---
> +	  This enables the mshX device as well as ioctl's for
> +	  the wireless mesh and fwt tables.
> +
>  config LIBERTAS_USB_DEBUG
>  	bool "Enable full debugging output in the Libertas USB module."
>  	depends on LIBERTAS_USB
> --- libertas-2.6.orig/drivers/net/wireless/libertas/cmd.c
> +++ libertas-2.6/drivers/net/wireless/libertas/cmd.c
> @@ -866,6 +866,7 @@
>  	return 0;
>  }
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  static int wlan_cmd_fwt_access(wlan_private * priv,
>  			       struct cmd_ds_command *cmd,
>  			       u16 cmd_action, void *pdata_buf)
> @@ -909,6 +910,7 @@
>  
>  	return 0;
>  }
> +#endif
>  
>  void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u8 addtail)
>  {
> @@ -1395,6 +1397,7 @@
>  		ret = wlan_cmd_bt_access(priv, cmdptr, cmd_action, pdata_buf);
>  		break;
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  	case cmd_fwt_access:
>  		ret = wlan_cmd_fwt_access(priv, cmdptr, cmd_action, pdata_buf);
>  		break;
> @@ -1402,6 +1405,7 @@
>  	case cmd_mesh_access:
>  		ret = wlan_cmd_mesh_access(priv, cmdptr, cmd_action, pdata_buf);
>  		break;
> +#endif
>  
>  	case cmd_get_tsf:
>  		cmdptr->command = cpu_to_le16(cmd_get_tsf);
> --- libertas-2.6.orig/drivers/net/wireless/libertas/cmdresp.c
> +++ libertas-2.6/drivers/net/wireless/libertas/cmdresp.c
> @@ -222,7 +222,9 @@
>  	}
>  
>  	memcpy(priv->wlan_dev.netdev->dev_addr, adapter->current_addr, ETH_ALEN);
> +#ifdef CONFIG_LIBERTAS_MESH
>  	memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
> +#endif
>  
>  	if (libertas_set_regiontable(priv, adapter->regioncode, 0)) {
>  		ret = -1;
> @@ -723,6 +725,7 @@
>  			       &resp->params.bt.addr1, 2 * ETH_ALEN);
>  		spin_unlock_irqrestore(&adapter->driver_lock, flags);
>  		break;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	case cmd_ret_fwt_access:
>  		spin_lock_irqsave(&adapter->driver_lock, flags);
>  		if (adapter->cur_cmd->pdata_buf)
> @@ -737,6 +740,7 @@
>  			       &resp->params.mesh,
>  			       sizeof(resp->params.mesh));
>  		break;
> +#endif
>  	case cmd_rte_802_11_tx_rate_query:
>  		priv->adapter->txrate = resp->params.txrate.txrate;
>  		break;
> --- libertas-2.6.orig/drivers/net/wireless/libertas/defs.h
> +++ libertas-2.6/drivers/net/wireless/libertas/defs.h
> @@ -113,7 +113,9 @@
>   * TODO: change to proper mesh flag when MAC understands it.
>   */
>  #define TxPD_CONTROL_WDS_FRAME (1<<17)
> +#ifdef CONFIG_LIBERTAS_MESH
>  #define TxPD_MESH_FRAME TxPD_CONTROL_WDS_FRAME
> +#endif
>  
>  /** RxPD status */
>  
> @@ -125,7 +127,9 @@
>   * TODO: change to proper mesh flag when MAC understands it.
>   */
>  #define RxPD_CONTROL_WDS_FRAME (0x40)
> +#ifdef CONFIG_LIBERTAS_MESH
>  #define RxPD_MESH_FRAME RxPD_CONTROL_WDS_FRAME
> +#endif
>  
>  /** RSSI-related defines */
>  /*	RSSI constants are used to implement 802.11 RSSI threshold 
> @@ -190,9 +194,11 @@
>  
>  #define	MAX_LEDS			8
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  #define IS_MESH_FRAME(x) (x->cb[6])
>  #define SET_MESH_FRAME(x) (x->cb[6]=1)
>  #define UNSET_MESH_FRAME(x) (x->cb[6]=0)
> +#endif
>  
>  /** Global Variable Declaration */
>  typedef struct _wlan_private wlan_private;
> @@ -355,6 +361,7 @@
>  	SNMP_MIB_VALUE_ADHOC
>  };
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  /* Default values for fwt commands. */
>  #define FWT_DEFAULT_METRIC 0
>  #define FWT_DEFAULT_DIR 1
> @@ -365,5 +372,6 @@
>  #define FWT_DEFAULT_EXPIRATION 0
>  #define FWT_DEFAULT_SLEEPMODE 0
>  #define FWT_DEFAULT_SNR 0
> +#endif
>  
>  #endif				/* _WLAN_DEFS_H_ */
> --- libertas-2.6.orig/drivers/net/wireless/libertas/dev.h
> +++ libertas-2.6/drivers/net/wireless/libertas/dev.h
> @@ -115,6 +115,7 @@
>  	u8 dnld_sent;
>  } wlan_dev_t, *pwlan_dev_t;
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  /* Mesh statistics */
>  struct wlan_mesh_stats {
>  	u32	fwd_bcast_cnt;		/* Fwd: Broadcast counter */
> @@ -125,21 +126,28 @@
>  	u32	fwd_drop_nobuf;		/* Fwd: Run out of internal buffers */
>  	u32	drop_blind;		/* Rx:  Dropped by blinding table */
>  };
> +#endif
>  
>  /** Private structure for the MV device */
>  struct _wlan_private {
>  	int open;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	int mesh_open;
> +#endif
>  	int infra_open;
>  
>  	wlan_adapter *adapter;
>  	wlan_dev_t wlan_dev;
>  
>  	struct net_device_stats stats;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	struct net_device *mesh_dev ; /* Virtual device */
> +#endif
>  
>  	struct iw_statistics wstats;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	struct wlan_mesh_stats mstats;
> +#endif
>  	struct dentry *debugfs_dir;
>  	struct dentry *debugfs_debug;
>  	struct dentry *debugfs_files[6];
> --- libertas-2.6.orig/drivers/net/wireless/libertas/ethtool.c
> +++ libertas-2.6/drivers/net/wireless/libertas/ethtool.c
> @@ -10,6 +10,8 @@
>  #include "dev.h"
>  #include "join.h"
>  #include "wext.h"
> +
> +#ifdef CONFIG_LIBERTAS_MESH
>  static const char * mesh_stat_strings[]= {
>  			"drop_duplicate_bcast",
>  			"drop_ttl_zero",
> @@ -19,6 +21,7 @@
>  			"fwded_bcast_cnt",
>  			"drop_blind_table"
>  };
> +#endif
>  
>  static void libertas_ethtool_get_drvinfo(struct net_device *dev,
>  					 struct ethtool_drvinfo *info)
> @@ -104,6 +107,7 @@
>          return 0;
>  }
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  static void libertas_ethtool_get_stats(struct net_device * dev, 
>  				struct ethtool_stats * stats, u64 * data)
>  {
> @@ -172,13 +176,16 @@
>          }
>  	LEAVE();
>  }
> +#endif
>  
>  struct ethtool_ops libertas_ethtool_ops = {
>  	.get_drvinfo = libertas_ethtool_get_drvinfo,
>  	.get_eeprom =  libertas_ethtool_get_eeprom,
>  	.get_eeprom_len = libertas_ethtool_get_eeprom_len,
> +#ifdef CONFIG_LIBERTAS_MESH
>  	.get_stats_count = libertas_ethtool_get_stats_count,
>  	.get_ethtool_stats = libertas_ethtool_get_stats,
>  	.get_strings = libertas_ethtool_get_strings,
> +#endif
>  };
>   
> --- libertas-2.6.orig/drivers/net/wireless/libertas/host.h
> +++ libertas-2.6/drivers/net/wireless/libertas/host.h
> @@ -99,11 +99,13 @@
>  #define cmd_bt_access                 0x0087
>  #define cmd_ret_bt_access                 0x8087
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  #define cmd_fwt_access                0x0088
>  #define cmd_ret_fwt_access                0x8088
>  
>  #define cmd_mesh_access               0x0090
>  #define cmd_ret_mesh_access               0x8090
> +#endif
>  
>  /* For the IEEE Power Save */
>  #define cmd_subcmd_enter_ps               0x0030
> @@ -290,6 +292,7 @@
>  	cmd_act_bt_access_reset
>  };
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  /* Define action or option for cmd_fwt_access */
>  enum cmd_fwt_access_opts {
>  	cmd_act_fwt_access_add = 1,
> @@ -311,6 +314,7 @@
>  	cmd_act_mesh_get_mpp,
>  	cmd_act_mesh_set_mpp,
>  };
> +#endif
>  
>  /** Card Event definition */
>  #define MACREG_INT_CODE_TX_PPA_FREE             0x00000000
> --- libertas-2.6.orig/drivers/net/wireless/libertas/hostcmd.h
> +++ libertas-2.6/drivers/net/wireless/libertas/hostcmd.h
> @@ -604,6 +604,7 @@
>  	u8 addr2[ETH_ALEN];
>  } __attribute__ ((packed));
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  struct cmd_ds_fwt_access {
>  	u16 action;
>  	u32 id;
> @@ -626,6 +627,7 @@
>  	u16 action;
>  	u32 data[MESH_STATS_NUM + 1];	/* last position reserved */
>  } __attribute__ ((packed));
> +#endif
>  
>  struct cmd_ds_command {
>  	/* command header */
> @@ -683,8 +685,10 @@
>  
>  		struct cmd_tx_rate_query txrate;
>  		struct cmd_ds_bt_access bt;
> +#ifdef CONFIG_LIBERTAS_MESH
>  		struct cmd_ds_fwt_access fwt;
>  		struct cmd_ds_mesh_access mesh;
> +#endif
>  		struct cmd_ds_get_tsf gettsf;
>  		struct cmd_ds_802_11_subscribe_event subscribe_event;
>  	} params;
> --- libertas-2.6.orig/drivers/net/wireless/libertas/ioctl.c
> +++ libertas-2.6/drivers/net/wireless/libertas/ioctl.c
> @@ -1340,12 +1340,14 @@
>   *  @param ptr      A pointer to the input parameter string
>   *  @return         A pointer to the next parameter, or 0 if no parameters left.
>   */
> +#ifdef CONFIG_LIBERTAS_MESH
>  static char * next_param(char * ptr)
>  {
>  	if (!ptr) return NULL;
>  	while (*ptr == ' ' || *ptr == '\t') ++ptr;
>  	return (*ptr == '\0') ? NULL : ptr;
>  }
> +#endif
>  
>  /**
>   *  @brief          Add an entry to the FWT table
> @@ -1353,6 +1355,7 @@
>   *  @param req      A pointer to ifreq structure
>   *  @return         0 --success, otherwise fail
>   */
> +#ifdef CONFIG_LIBERTAS_MESH
>  static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
>  {
>  	struct iwreq *wrq = (struct iwreq *)req;
> @@ -1876,6 +1879,8 @@
>  	return ret;
>  }
>  
> +#endif
> +
>  /**
>   *  @brief ioctl function - entry point
>   *
> @@ -1931,9 +1936,11 @@
>  		case WLAN_SUBCMD_BT_RESET:	/* bt_reset */
>  			wlan_bt_reset_ioctl(priv);
>  			break;
> +#ifdef CONFIG_LIBERTAS_MESH
>  		case WLAN_SUBCMD_FWT_RESET:	/* fwt_reset */
>  			wlan_fwt_reset_ioctl(priv);
>  			break;
> +#endif
>  		}		/* End of switch */
>  		break;
>  
> @@ -2093,10 +2100,12 @@
>  			ret = wlan_set_debugmode_ioctl(priv, req);
>  			break;
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  		case WLAN_SUBCMD_MESH_SET_TTL:
>  			idata = SUBCMD_DATA(wrq);
>  			ret = wlan_mesh_set_ttl_ioctl(priv, idata);
>  			break;
> +#endif
>  
>  		default:
>  			ret = -EOPNOTSUPP;
> @@ -2146,6 +2155,7 @@
>  		case WLAN_SUBCMD_BT_LIST:
>  			ret = wlan_bt_list_ioctl(priv, req);
>  			break;
> +#ifdef CONFIG_LIBERTAS_MESH
>  		case WLAN_SUBCMD_FWT_ADD:
>  			ret = wlan_fwt_add_ioctl(priv, req);
>  			break;
> @@ -2164,6 +2174,7 @@
>  		case WLAN_SUBCMD_FWT_LIST_ROUTE:
>  			ret = wlan_fwt_list_route_ioctl(priv, req);
>  			break;
> +#endif
>  		}
>  		break;
>  
> @@ -2203,6 +2214,8 @@
>  		case WLAN_GET_TX_RATE:
>  			ret = wlan_get_txrate_ioctl(priv, req);
>  			break;
> +
> +#ifdef CONFIG_LIBERTAS_MESH
>  		case WLAN_SUBCMD_FWT_CLEANUP:	/* fwt_cleanup */
>  			ret = wlan_fwt_cleanup_ioctl(priv, req);
>  			break;
> @@ -2214,6 +2227,7 @@
>  		case WLAN_SUBCMD_MESH_GET_TTL:
>  			ret = wlan_mesh_get_ttl_ioctl(priv, req);
>  			break;
> +#endif
>  
>  		default:
>  			ret = -EOPNOTSUPP;
> --- libertas-2.6.orig/drivers/net/wireless/libertas/main.c
> +++ libertas-2.6/drivers/net/wireless/libertas/main.c
> @@ -183,6 +183,8 @@
>   */
>  #define to_net_dev(class) container_of(class, struct net_device, class_dev)
>  
> +#ifdef CONFIG_LIBERTAS_MESH
> +
>  /**
>   * @brief Get function for sysfs attribute libertas_mpp 
>   */
> @@ -222,6 +224,8 @@
>  static CLASS_DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, 
>  		libertas_mpp_set );
>  
> +#endif
> +
>  /** 
>   *  @brief Check if the device can be open and wait if necessary.
>   *  
> @@ -281,6 +285,7 @@
>   *  @param dev     A pointer to net_device structure
>   *  @return 	   0
>   */
> +#ifdef CONFIG_LIBERTAS_MESH
>  static int mesh_open(struct net_device *dev)
>  {
>  	wlan_private *priv = (wlan_private *) dev->priv ;
> @@ -293,6 +298,7 @@
>  		return wlan_dev_open(priv->wlan_dev.netdev) ;
>  	return 0;
>  }
> +#endif
>  
>  /** 
>   *  @brief This function opens the ethX interface
> @@ -332,6 +338,7 @@
>   *  @param dev     A pointer to net_device structure
>   *  @return 	   0
>   */
> +#ifdef CONFIG_LIBERTAS_MESH
>  static int mesh_close(struct net_device *dev)
>  {
>  	wlan_private *priv = (wlan_private *) (dev->priv);
> @@ -343,6 +350,7 @@
>  	else
>  		return 0;
>  }
> +#endif
>  
>  /** 
>   *  @brief This function closes the ethX interface
> @@ -355,10 +363,14 @@
>  	
>  	netif_stop_queue(priv->wlan_dev.netdev);
>  	priv->infra_open = 0;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	if (priv->mesh_open == 0)
>  		return wlan_dev_close( ((wlan_private *) dev->priv)->wlan_dev.netdev) ;
>  	else
>  		return 0;
> +#else
> +	return wlan_dev_close( ((wlan_private *) dev->priv)->wlan_dev.netdev) ;
> +#endif
>  }
>  
>  
> @@ -498,6 +510,7 @@
>   * @brief Mark mesh packets and handover them to wlan_hard_start_xmit
>   *
>   */
> +#ifdef CONFIG_LIBERTAS_MESH
>  static int mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  {
>  	wlan_private *priv = dev->priv;
> @@ -518,6 +531,7 @@
>  	LEAVE();
>  	return wlan_hard_start_xmit(skb, dev);
>  }
> +#endif
>  
>  static void wlan_tx_timeout(struct net_device *dev)
>  {
> @@ -586,7 +600,9 @@
>  
>  	lbs_dbg_hex("adapter->macaddr:", adapter->current_addr, ETH_ALEN);
>  	memcpy(dev->dev_addr, adapter->current_addr, ETH_ALEN);
> +#ifdef CONFIG_LIBERTAS_MESH
>  	memcpy(((wlan_private *) dev->priv)->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
> +#endif
>  
>  done:
>  	LEAVE();
> @@ -866,7 +882,9 @@
>  wlan_private *wlan_add_card(void *card)
>  {
>  	struct net_device *dev = NULL;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	struct net_device *mesh_dev = NULL;
> +#endif
>  	wlan_private *priv = NULL;
>  
>  	ENTER();
> @@ -885,6 +903,7 @@
>  		goto err_kmalloc;
>  	}
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  	/* Allocate a virtual mesh device */
>  	if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
>  		lbs_pr_debug(1, "Init ethernet device failed!\n");
> @@ -893,34 +912,45 @@
>  	
>  	/* Both intervaces share the priv structure */
>  	mesh_dev->priv = priv;
> +#endif
>  		
>  	/* init wlan_adapter */
>  	memset(priv->adapter, 0, sizeof(wlan_adapter));
>  
>  	priv->wlan_dev.netdev = dev;
>  	priv->wlan_dev.card = card;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	priv->mesh_open = 0;
> -	priv->infra_open = 0;
>  	priv->mesh_dev = mesh_dev;
> +#endif
> +	priv->infra_open = 0;
>  #ifdef ENABLE_PM
>  	wlanpriv = priv;
>  #endif
>  
>  	SET_MODULE_OWNER(dev);
> +#ifdef CONFIG_LIBERTAS_MESH
>  	SET_MODULE_OWNER(mesh_dev);
> +#endif
>  
>  	/* Setup the OS Interface to our functions */
>  	dev->open = wlan_open;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	dev->hard_start_xmit = wlan_pre_start_xmit;
> +#else
> +	dev->hard_start_xmit = wlan_hard_start_xmit;
> +#endif
>  	dev->stop = wlan_close;
>  	dev->do_ioctl = libertas_do_ioctl;
>  	dev->set_mac_address = wlan_set_mac_address;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	mesh_dev->open = mesh_open;
>  	mesh_dev->hard_start_xmit = mesh_pre_start_xmit;
>  	mesh_dev->stop = mesh_close;
>  	mesh_dev->do_ioctl = libertas_do_ioctl; 
>  	memcpy(mesh_dev->dev_addr, priv->wlan_dev.netdev->dev_addr,
>  			sizeof(priv->wlan_dev.netdev->dev_addr));
> +#endif
>  
>  #define	WLAN_WATCHDOG_TIMEOUT	(5 * HZ)
>  
> @@ -928,13 +958,17 @@
>  	dev->get_stats = wlan_get_stats;
>  	dev->watchdog_timeo = WLAN_WATCHDOG_TIMEOUT;
>  	dev->ethtool_ops = &libertas_ethtool_ops;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	mesh_dev->get_stats = wlan_get_stats; 
>  	mesh_dev->ethtool_ops = &libertas_ethtool_ops;
> +#endif
>  
>  #ifdef	WIRELESS_EXT
>  	dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	mesh_dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
>  #endif
> +#endif
>  #define NETIF_F_DYNALLOC 16
>  	dev->features |= NETIF_F_DYNALLOC;
>  	dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
> @@ -977,11 +1011,13 @@
>  		goto err_init_fw;
>  	}
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  	/* Register virtual mesh interface */
>  	if (register_netdev(mesh_dev)) {
>  		lbs_pr_info("Cannot register mesh virtual interface!\n");
>  		goto err_init_fw;
>  	}
> +#endif
>  
>  	lbs_pr_info("%s: Marvell Wlan 802.11 adapter\n", dev->name);
>  
> @@ -995,14 +1031,18 @@
>  	if (!(wlan_pm_dev = pm_register(PM_UNKNOWN_DEV, 0, wlan_pm_callback)))
>  		lbs_pr_alert( "failed to register PM callback\n");
>  #endif
> +#ifdef CONFIG_LIBERTAS_MESH
>  	if (class_device_create_file(&(mesh_dev->class_dev), &class_device_attr_libertas_mpp))
>  		goto err_create_file;
> +#endif
>  
>  	LEAVE();
>  	return priv;
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  err_create_file:
>  	class_device_remove_file(&(mesh_dev->class_dev), &class_device_attr_libertas_mpp);
> +#endif
>  err_init_fw:
>  	libertas_sbi_unregister_dev(priv);
>  err_registerdev:
> @@ -1013,7 +1053,9 @@
>  	kfree(priv->adapter);
>  err_kmalloc:
>  	free_netdev(dev);
> +#ifdef CONFIG_LIBERTAS_MESH
>  	free_netdev(mesh_dev);
> +#endif
>  #ifdef ENABLE_PM
>  	wlanpriv = NULL;
>  #endif
> @@ -1040,7 +1082,9 @@
>  {
>  	wlan_adapter *adapter;
>  	struct net_device *dev;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	struct net_device *mesh_dev;
> +#endif
>  	union iwreq_data wrqu;
>  	int i;
>  
> @@ -1059,16 +1103,21 @@
>  	}
>  
>  	dev = priv->wlan_dev.netdev;
> -	mesh_dev = priv->mesh_dev;
>  
> +#ifdef CONFIG_LIBERTAS_MESH
> +	mesh_dev = priv->mesh_dev;
>  	netif_stop_queue(mesh_dev);
> +#endif
> +
>  	netif_stop_queue(priv->wlan_dev.netdev);
>  	netif_carrier_off(priv->wlan_dev.netdev);
>  
>  	wake_pending_cmdnodes(priv);
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  	class_device_remove_file(&(mesh_dev->class_dev), &class_device_attr_libertas_mpp);
>  	unregister_netdev(mesh_dev);
> +#endif
>  	unregister_netdev(dev);
>  
>  	cancel_delayed_work(&priv->assoc_work);
> @@ -1108,8 +1157,10 @@
>  	lbs_pr_debug(1, "Unregister finish\n");
>  
>  	priv->wlan_dev.netdev = NULL;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	priv->mesh_dev = NULL ;
>  	free_netdev(mesh_dev);
> +#endif
>  	free_netdev(dev);
>  #ifdef ENABLE_PM
>  	wlanpriv = NULL;
> --- libertas-2.6.orig/drivers/net/wireless/libertas/rx.c
> +++ libertas-2.6/drivers/net/wireless/libertas/rx.c
> @@ -140,10 +140,14 @@
>  {
>  	lbs_pr_debug(1, "skb->data=%p\n", skb->data);
>  
> +#ifdef CONFIG_LIBERTAS_MESH
>  	if(IS_MESH_FRAME(skb))
>  		skb->dev = priv->mesh_dev;
>  	else
>  		skb->dev = priv->wlan_dev.netdev;
> +#else
> +	skb->dev = priv->wlan_dev.netdev;
> +#endif
>  	skb->protocol = eth_type_trans(skb, priv->wlan_dev.netdev);
>  	skb->ip_summed = CHECKSUM_UNNECESSARY;
>  
> @@ -184,10 +188,12 @@
>  
>  	p_rx_pkt = (struct rxpackethdr *) skb->data;
>  	p_rx_pd = &p_rx_pkt->rx_pd;
> +#ifdef CONFIG_LIBERTAS_MESH
>  	if (p_rx_pd->rx_control & RxPD_MESH_FRAME) 
>  		SET_MESH_FRAME(skb);
>  	else
>  		UNSET_MESH_FRAME(skb);
> +#endif
>  
>  	lbs_dbg_hex("RX Data: Before chop rxpd", skb->data,
>  		 min_t(unsigned int, skb->len, 100));
> --- libertas-2.6.orig/drivers/net/wireless/libertas/tx.c
> +++ libertas-2.6/drivers/net/wireless/libertas/tx.c
> @@ -122,9 +122,11 @@
>  
>  	lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd));
>  	
> +#ifdef CONFIG_LIBERTAS_MESH
>  	if (IS_MESH_FRAME(skb)) {
>  		plocaltxpd->tx_control |= TxPD_MESH_FRAME;
>  	}
> +#endif
>  
>  	memcpy(ptr, plocaltxpd, sizeof(struct txpd));
>  
> --- libertas-2.6.orig/drivers/net/wireless/libertas/wext.c
> +++ libertas-2.6/drivers/net/wireless/libertas/wext.c
> @@ -1144,11 +1144,13 @@
>  	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
>  	 IW_PRIV_TYPE_NONE,
>  	 "debugmode"},
> +#ifdef CONFIG_LIBERTAS_MESH
>  	{
>  	 WLAN_SUBCMD_MESH_SET_TTL,
>  	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
>  	 IW_PRIV_TYPE_NONE,
>  	 "mesh_set_ttl"},
> +#endif
>  	{
>  	 WLAN_SETNONE_GETONEINT,
>  	 IW_PRIV_TYPE_NONE,
> @@ -1194,6 +1196,7 @@
>  	 IW_PRIV_TYPE_NONE,
>  	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
>  	 "get_debugmode"},
> +#ifdef CONFIG_LIBERTAS_MESH
>  	{
>  	 WLAN_SUBCMD_FWT_CLEANUP,
>  	 IW_PRIV_TYPE_NONE,
> @@ -1209,6 +1212,7 @@
>  	 IW_PRIV_TYPE_NONE,
>  	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
>  	 "mesh_get_ttl"},
> +#endif
>  	{
>  	 WLAN_SETNONE_GETTWELVE_CHAR,
>  	 IW_PRIV_TYPE_NONE,
> @@ -1264,11 +1268,13 @@
>  	 IW_PRIV_TYPE_NONE,
>  	 IW_PRIV_TYPE_NONE,
>  	 "wlanidle-off"},
> +#ifdef CONFIG_LIBERTAS_MESH
>  	{
>  	 WLAN_SUBCMD_FWT_RESET,
>  	 IW_PRIV_TYPE_NONE,
>  	 IW_PRIV_TYPE_NONE,
>  	 "fwt_reset"},
> +#endif
>  	{
>  	 WLAN_SUBCMD_BT_RESET,
>  	 IW_PRIV_TYPE_NONE,
> @@ -1295,6 +1301,7 @@
>  	 IW_PRIV_TYPE_CHAR | 128,
>  	 IW_PRIV_TYPE_CHAR | 128,
>  	 "bt_list"},
> +#ifdef CONFIG_LIBERTAS_MESH
>  	/* FWT Management */
>  	{
>  	 WLAN_SUBCMD_FWT_ADD,
> @@ -1326,6 +1333,7 @@
>  	 IW_PRIV_TYPE_CHAR | 128,
>  	 IW_PRIV_TYPE_CHAR | 128,
>  	 "fwt_list_route"},
> +#endif
>  	{
>  	 WLANSCAN_MODE,
>  	 IW_PRIV_TYPE_CHAR | 128,
> --- libertas-2.6.orig/drivers/net/wireless/libertas/wext.h
> +++ libertas-2.6/drivers/net/wireless/libertas/wext.h
> @@ -31,7 +31,9 @@
>  #define WLANWLANIDLEON				10
>  #define WLANWLANIDLEOFF				11
>  #define WLAN_SUBCMD_BT_RESET			13
> +#ifdef CONFIG_LIBERTAS_MESH
>  #define WLAN_SUBCMD_FWT_RESET			14
> +#endif
>  
>  #define WLANGETLOG                  	(WLANIOCTL + 9)
>  #define GETLOG_BUFSIZE  300
> @@ -48,9 +50,11 @@
>  #define WLAN_GET_LINKMODE			6
>  #define WLAN_GET_RADIOMODE			7
>  #define WLAN_GET_DEBUGMODE			8
> +#ifdef CONFIG_LIBERTAS_MESH
>  #define WLAN_SUBCMD_FWT_CLEANUP			15
>  #define WLAN_SUBCMD_FWT_TIME			16
>  #define WLAN_SUBCMD_MESH_GET_TTL		17
> +#endif
>  
>  #define WLANREGCFRDWR			(WLANIOCTL + 18)
>  
> @@ -85,7 +89,9 @@
>  #define WLAN_SET_LINKMODE			15
>  #define WLAN_SET_RADIOMODE			16
>  #define WLAN_SET_DEBUGMODE			17
> +#ifdef CONFIG_LIBERTAS_MESH
>  #define WLAN_SUBCMD_MESH_SET_TTL		18
> +#endif
>  
>  #define WLAN_SET128CHAR_GET128CHAR	(WLANIOCTL + 25)
>  #define WLANSCAN_MODE				6
> @@ -95,12 +101,14 @@
>  #define WLAN_SUBCMD_BT_ADD			18
>  #define WLAN_SUBCMD_BT_DEL   			19
>  #define WLAN_SUBCMD_BT_LIST			20
> +#ifdef CONFIG_LIBERTAS_MESH
>  #define WLAN_SUBCMD_FWT_ADD				21
>  #define WLAN_SUBCMD_FWT_DEL   		22
>  #define WLAN_SUBCMD_FWT_LOOKUP		23
>  #define WLAN_SUBCMD_FWT_LIST_NEIGHBOR			24
>  #define WLAN_SUBCMD_FWT_LIST			25
>  #define WLAN_SUBCMD_FWT_LIST_ROUTE			26
> +#endif
>  
>  #define WLAN_SET_GET_SIXTEEN_INT       (WLANIOCTL + 29)
>  #define WLAN_TPCCFG                             1
> 
> _______________________________________________
> libertas-dev mailing list
> libertas-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libertas-dev



More information about the libertas-dev mailing list