Introduce name_node structure to hold name of device and put it into hashlist instead of putting there struct net_device directly. Add a necessary infrastructure to manipulate the hashlist. This prepares the code to use the same hashlist for alternative names introduced later in this set.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -925,6 +925,12 @@ struct dev_ifalias { · 924 unmodified lines | ||
| 925 | 925 | struct devlink; |
| 926 | 926 | struct tlsdev_ops; |
| 927 | 927 | |
| 928 | +struct netdev_name_node { | |
| 929 | + struct hlist_node hlist; | |
| 930 | + struct net_device *dev; | |
| 931 | + const char *name; | |
| 932 | +}; | |
| 933 | + | |
| 928 | 934 | /* |
| 929 | 935 | * This structure defines the management hooks for network devices. |
| 930 | 936 | * The following hooks can be defined; unless noted otherwise, they are |
| @@ -1564,7 +1570,7 @@ enum netdev_priv_flags { · 633 unmodified lines | ||
| 1564 | 1570 | * (i.e. as seen by users in the "Space.c" file). It is the name |
| 1565 | 1571 | * of the interface. |
| 1566 | 1572 | * |
| 1567 | − * @name_hlist: Device name hash chain, please keep it close to name[] | |
| 1573 | + * @name_node: Name hashlist node | |
| 1568 | 1574 | * @ifalias: SNMP alias |
| 1569 | 1575 | * @mem_end: Shared memory end |
| 1570 | 1576 | * @mem_start: Shared memory start |
| @@ -1774,7 +1780,7 @@ enum netdev_priv_flags { · 203 unmodified lines | ||
| 1774 | 1780 | |
| 1775 | 1781 | struct net_device { |
| 1776 | 1782 | char name[IFNAMSIZ]; |
| 1777 | − struct hlist_node name_hlist; | |
| 1783 | + struct netdev_name_node *name_node; | |
| 1778 | 1784 | struct dev_ifalias __rcu *ifalias; |
| 1779 | 1785 | /* |
| 1780 | 1786 | * I/O specific fields |