lp->hw = hw;
lp->spi = spi;
hw->parent = &spi->dev;
+ hw->vif_data_size = sizeof(*lp);
lp->regmap = devm_regmap_init_spi(spi, &at86rf230_regmap_spi_config);
if (IS_ERR(lp->regmap)) {
priv->hw->priv = priv;
priv->hw->parent = &priv->spi->dev;
priv->hw->extra_tx_headroom = 0;
+ priv->hw->vif_data_size = sizeof(*priv);
/* We do support only 2.4 Ghz */
priv->hw->phy->channels_supported[0] = 0x7FFF800;
u8 pan_coord;
};
+struct ieee802154_vif {
+ int type;
+
+ /* must be last */
+ u8 drv_priv[0] __aligned(sizeof(void *));
+};
+
struct ieee802154_hw {
/* filled by the driver */
int extra_tx_headroom;
struct ieee802154_hw_addr_filt hw_filt;
void *priv;
struct wpan_phy *phy;
+ size_t vif_data_size;
};
/* Checksum is in hardware and is omitted from a packet
struct ieee802154_local *local;
struct net_device *dev;
- int type;
unsigned long state;
char name[IFNAMSIZ];
struct mutex sec_mtx;
struct mac802154_llsec sec;
+ /* must be last, dynamically sized area in this! */
+ struct ieee802154_vif vif;
};
#define MAC802154_CHAN_NONE 0xff /* No channel is assigned */
ASSERT_RTNL();
- if (sdata->type == IEEE802154_DEV_WPAN) {
+ if (sdata->vif.type == IEEE802154_DEV_WPAN) {
mutex_lock(&sdata->local->iflist_mtx);
list_for_each_entry(subif, &sdata->local->interfaces, list) {
- if (subif != sdata && subif->type == sdata->type &&
+ if (subif != sdata &&
+ subif->vif.type == sdata->vif.type &&
ieee802154_sdata_running(subif)) {
mutex_unlock(&sdata->local->iflist_mtx);
return -EBUSY;
ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, int type)
{
/* set some type-dependent values */
- sdata->type = type;
+ sdata->vif.type = type;
get_random_bytes(&sdata->bsn, 1);
get_random_bytes(&sdata->dsn, 1);
ASSERT_RTNL();
- ndev = alloc_netdev(sizeof(*sdata), name, NET_NAME_UNKNOWN,
- ieee802154_if_setup);
+ ndev = alloc_netdev(sizeof(*sdata) + local->hw.vif_data_size, name,
+ NET_NAME_UNKNOWN, ieee802154_if_setup);
if (!ndev)
return ERR_PTR(-ENOMEM);
}
list_for_each_entry_rcu(sdata, &local->interfaces, list) {
- if (sdata->type != IEEE802154_DEV_WPAN ||
+ if (sdata->vif.type != IEEE802154_DEV_WPAN ||
!netif_running(sdata->dev))
continue;
skb->protocol = htons(ETH_P_IEEE802154);
list_for_each_entry_rcu(sdata, &local->interfaces, list) {
- if (sdata->type != IEEE802154_DEV_MONITOR)
+ if (sdata->vif.type != IEEE802154_DEV_MONITOR)
continue;
if (!ieee802154_sdata_running(sdata))