Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
alloc_netdev_etherdev [2018/08/28 07:52] – [alloc_etherdev*()] rpjdayalloc_netdev_etherdev [2018/08/28 08:00] (current) – [netdev private data] rpjday
Line 5: Line 5:
 ===== netdev private data ===== ===== netdev private data =====
  
-From ''netdevice.h'', optional private data is stored (aligned) after the end of the structure:+From ''include/linux/netdevice.h'', optional private data is stored (aligned) after the end of the structure:
  
 <code> <code>
Line 94: Line 94:
 </code> </code>
  
-==== alloc_etherdev(),alloc_etherdev_mq() ====+==== alloc_etherdev(),alloc_etherdev_mq(),alloc_etherdev_mqs() ====
  
-From ''include/linux/netdevice.h'':+From ''include/linux/etherdevice.h'':
  
 <code> <code>
Line 113: Line 113:
  return alloc_netdev_mqs(sizeof_priv, "eth%d", NET_NAME_UNKNOWN,  return alloc_netdev_mqs(sizeof_priv, "eth%d", NET_NAME_UNKNOWN,
  ether_setup, txqs, rxqs);  ether_setup, txqs, rxqs);
 +}
 +</code>
 +
 +==== devm_alloc_etherdev*() ====
 +
 +From ''include/linux/etherdevice.h'':
 +
 +<code>
 +struct net_device *devm_alloc_etherdev_mqs(struct device *dev, int sizeof_priv,
 +    unsigned int txqs,
 +    unsigned int rxqs);
 +#define devm_alloc_etherdev(dev, sizeof_priv) devm_alloc_etherdev_mqs(dev, sizeof_priv, 1, 1)
 +</code>
 +
 +From ''net/ethernet/net.c'':
 +
 +<code>
 +struct net_device *devm_alloc_etherdev_mqs(struct device *dev, int sizeof_priv,
 +    unsigned int txqs, unsigned int rxqs)
 +{
 + struct net_device **dr;
 + struct net_device *netdev;
 +
 + dr = devres_alloc(devm_free_netdev, sizeof(*dr), GFP_KERNEL);
 + if (!dr)
 + return NULL;
 +
 + netdev = alloc_etherdev_mqs(sizeof_priv, txqs, rxqs);
 + if (!netdev) {
 + devres_free(dr);
 + return NULL;
 + }
 +
 + *dr = netdev;
 + devres_add(dev, dr);
 +
 + return netdev;
 } }
 </code> </code>
  • alloc_netdev_etherdev.1535442773.txt.gz
  • Last modified: 2018/08/28 07:52
  • by rpjday