netdev: make address const in device address management
The internal functions for add/deleting addresses don't change their argument. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1d3ff76759
commit
6b6e27255f
|
@ -6890,7 +6890,7 @@ static int ixgbe_set_features(struct net_device *netdev,
|
||||||
|
|
||||||
static int ixgbe_ndo_fdb_add(struct ndmsg *ndm,
|
static int ixgbe_ndo_fdb_add(struct ndmsg *ndm,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
unsigned char *addr,
|
const unsigned char *addr,
|
||||||
u16 flags)
|
u16 flags)
|
||||||
{
|
{
|
||||||
struct ixgbe_adapter *adapter = netdev_priv(dev);
|
struct ixgbe_adapter *adapter = netdev_priv(dev);
|
||||||
|
@ -6927,7 +6927,7 @@ static int ixgbe_ndo_fdb_add(struct ndmsg *ndm,
|
||||||
|
|
||||||
static int ixgbe_ndo_fdb_del(struct ndmsg *ndm,
|
static int ixgbe_ndo_fdb_del(struct ndmsg *ndm,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
unsigned char *addr)
|
const unsigned char *addr)
|
||||||
{
|
{
|
||||||
struct ixgbe_adapter *adapter = netdev_priv(dev);
|
struct ixgbe_adapter *adapter = netdev_priv(dev);
|
||||||
int err = -EOPNOTSUPP;
|
int err = -EOPNOTSUPP;
|
||||||
|
|
|
@ -548,7 +548,7 @@ static int macvlan_vlan_rx_kill_vid(struct net_device *dev,
|
||||||
|
|
||||||
static int macvlan_fdb_add(struct ndmsg *ndm,
|
static int macvlan_fdb_add(struct ndmsg *ndm,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
unsigned char *addr,
|
const unsigned char *addr,
|
||||||
u16 flags)
|
u16 flags)
|
||||||
{
|
{
|
||||||
struct macvlan_dev *vlan = netdev_priv(dev);
|
struct macvlan_dev *vlan = netdev_priv(dev);
|
||||||
|
@ -567,7 +567,7 @@ static int macvlan_fdb_add(struct ndmsg *ndm,
|
||||||
|
|
||||||
static int macvlan_fdb_del(struct ndmsg *ndm,
|
static int macvlan_fdb_del(struct ndmsg *ndm,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
unsigned char *addr)
|
const unsigned char *addr)
|
||||||
{
|
{
|
||||||
struct macvlan_dev *vlan = netdev_priv(dev);
|
struct macvlan_dev *vlan = netdev_priv(dev);
|
||||||
int err = -EINVAL;
|
int err = -EINVAL;
|
||||||
|
|
|
@ -907,10 +907,10 @@ struct netdev_fcoe_hbainfo {
|
||||||
* Must return >0 or -errno if it changed dev->features itself.
|
* Must return >0 or -errno if it changed dev->features itself.
|
||||||
*
|
*
|
||||||
* int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev,
|
* int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev,
|
||||||
* unsigned char *addr, u16 flags)
|
* const unsigned char *addr, u16 flags)
|
||||||
* Adds an FDB entry to dev for addr.
|
* Adds an FDB entry to dev for addr.
|
||||||
* int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev,
|
* int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev,
|
||||||
* unsigned char *addr)
|
* const unsigned char *addr)
|
||||||
* Deletes the FDB entry from dev coresponding to addr.
|
* Deletes the FDB entry from dev coresponding to addr.
|
||||||
* int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
|
* int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
|
||||||
* struct net_device *dev, int idx)
|
* struct net_device *dev, int idx)
|
||||||
|
@ -1017,11 +1017,11 @@ struct net_device_ops {
|
||||||
|
|
||||||
int (*ndo_fdb_add)(struct ndmsg *ndm,
|
int (*ndo_fdb_add)(struct ndmsg *ndm,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
unsigned char *addr,
|
const unsigned char *addr,
|
||||||
u16 flags);
|
u16 flags);
|
||||||
int (*ndo_fdb_del)(struct ndmsg *ndm,
|
int (*ndo_fdb_del)(struct ndmsg *ndm,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
unsigned char *addr);
|
const unsigned char *addr);
|
||||||
int (*ndo_fdb_dump)(struct sk_buff *skb,
|
int (*ndo_fdb_dump)(struct sk_buff *skb,
|
||||||
struct netlink_callback *cb,
|
struct netlink_callback *cb,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
|
@ -2561,9 +2561,9 @@ extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
|
||||||
extern void __hw_addr_init(struct netdev_hw_addr_list *list);
|
extern void __hw_addr_init(struct netdev_hw_addr_list *list);
|
||||||
|
|
||||||
/* Functions used for device addresses handling */
|
/* Functions used for device addresses handling */
|
||||||
extern int dev_addr_add(struct net_device *dev, unsigned char *addr,
|
extern int dev_addr_add(struct net_device *dev, const unsigned char *addr,
|
||||||
unsigned char addr_type);
|
unsigned char addr_type);
|
||||||
extern int dev_addr_del(struct net_device *dev, unsigned char *addr,
|
extern int dev_addr_del(struct net_device *dev, const unsigned char *addr,
|
||||||
unsigned char addr_type);
|
unsigned char addr_type);
|
||||||
extern int dev_addr_add_multiple(struct net_device *to_dev,
|
extern int dev_addr_add_multiple(struct net_device *to_dev,
|
||||||
struct net_device *from_dev,
|
struct net_device *from_dev,
|
||||||
|
@ -2575,20 +2575,20 @@ extern void dev_addr_flush(struct net_device *dev);
|
||||||
extern int dev_addr_init(struct net_device *dev);
|
extern int dev_addr_init(struct net_device *dev);
|
||||||
|
|
||||||
/* Functions used for unicast addresses handling */
|
/* Functions used for unicast addresses handling */
|
||||||
extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
|
extern int dev_uc_add(struct net_device *dev, const unsigned char *addr);
|
||||||
extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr);
|
extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
|
||||||
extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
|
extern int dev_uc_del(struct net_device *dev, const unsigned char *addr);
|
||||||
extern int dev_uc_sync(struct net_device *to, struct net_device *from);
|
extern int dev_uc_sync(struct net_device *to, struct net_device *from);
|
||||||
extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
|
extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
|
||||||
extern void dev_uc_flush(struct net_device *dev);
|
extern void dev_uc_flush(struct net_device *dev);
|
||||||
extern void dev_uc_init(struct net_device *dev);
|
extern void dev_uc_init(struct net_device *dev);
|
||||||
|
|
||||||
/* Functions used for multicast addresses handling */
|
/* Functions used for multicast addresses handling */
|
||||||
extern int dev_mc_add(struct net_device *dev, unsigned char *addr);
|
extern int dev_mc_add(struct net_device *dev, const unsigned char *addr);
|
||||||
extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr);
|
extern int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
|
||||||
extern int dev_mc_add_excl(struct net_device *dev, unsigned char *addr);
|
extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
|
||||||
extern int dev_mc_del(struct net_device *dev, unsigned char *addr);
|
extern int dev_mc_del(struct net_device *dev, const unsigned char *addr);
|
||||||
extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr);
|
extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
|
||||||
extern int dev_mc_sync(struct net_device *to, struct net_device *from);
|
extern int dev_mc_sync(struct net_device *to, struct net_device *from);
|
||||||
extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
|
extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
|
||||||
extern void dev_mc_flush(struct net_device *dev);
|
extern void dev_mc_flush(struct net_device *dev);
|
||||||
|
|
|
@ -609,7 +609,7 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
|
||||||
|
|
||||||
/* Add new permanent fdb entry with RTM_NEWNEIGH */
|
/* Add new permanent fdb entry with RTM_NEWNEIGH */
|
||||||
int br_fdb_add(struct ndmsg *ndm, struct net_device *dev,
|
int br_fdb_add(struct ndmsg *ndm, struct net_device *dev,
|
||||||
unsigned char *addr, u16 nlh_flags)
|
const unsigned char *addr, u16 nlh_flags)
|
||||||
{
|
{
|
||||||
struct net_bridge_port *p;
|
struct net_bridge_port *p;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
@ -639,7 +639,7 @@ int br_fdb_add(struct ndmsg *ndm, struct net_device *dev,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fdb_delete_by_addr(struct net_bridge_port *p, u8 *addr)
|
static int fdb_delete_by_addr(struct net_bridge_port *p, const u8 *addr)
|
||||||
{
|
{
|
||||||
struct net_bridge *br = p->br;
|
struct net_bridge *br = p->br;
|
||||||
struct hlist_head *head = &br->hash[br_mac_hash(addr)];
|
struct hlist_head *head = &br->hash[br_mac_hash(addr)];
|
||||||
|
@ -655,7 +655,7 @@ static int fdb_delete_by_addr(struct net_bridge_port *p, u8 *addr)
|
||||||
|
|
||||||
/* Remove neighbor entry with RTM_DELNEIGH */
|
/* Remove neighbor entry with RTM_DELNEIGH */
|
||||||
int br_fdb_delete(struct ndmsg *ndm, struct net_device *dev,
|
int br_fdb_delete(struct ndmsg *ndm, struct net_device *dev,
|
||||||
unsigned char *addr)
|
const unsigned char *addr)
|
||||||
{
|
{
|
||||||
struct net_bridge_port *p;
|
struct net_bridge_port *p;
|
||||||
int err;
|
int err;
|
||||||
|
|
|
@ -363,10 +363,10 @@ extern void br_fdb_update(struct net_bridge *br,
|
||||||
|
|
||||||
extern int br_fdb_delete(struct ndmsg *ndm,
|
extern int br_fdb_delete(struct ndmsg *ndm,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
unsigned char *addr);
|
const unsigned char *addr);
|
||||||
extern int br_fdb_add(struct ndmsg *nlh,
|
extern int br_fdb_add(struct ndmsg *nlh,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
unsigned char *addr,
|
const unsigned char *addr,
|
||||||
u16 nlh_flags);
|
u16 nlh_flags);
|
||||||
extern int br_fdb_dump(struct sk_buff *skb,
|
extern int br_fdb_dump(struct sk_buff *skb,
|
||||||
struct netlink_callback *cb,
|
struct netlink_callback *cb,
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int __hw_addr_create_ex(struct netdev_hw_addr_list *list,
|
static int __hw_addr_create_ex(struct netdev_hw_addr_list *list,
|
||||||
unsigned char *addr, int addr_len,
|
const unsigned char *addr, int addr_len,
|
||||||
unsigned char addr_type, bool global)
|
unsigned char addr_type, bool global)
|
||||||
{
|
{
|
||||||
struct netdev_hw_addr *ha;
|
struct netdev_hw_addr *ha;
|
||||||
|
@ -46,7 +46,7 @@ static int __hw_addr_create_ex(struct netdev_hw_addr_list *list,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __hw_addr_add_ex(struct netdev_hw_addr_list *list,
|
static int __hw_addr_add_ex(struct netdev_hw_addr_list *list,
|
||||||
unsigned char *addr, int addr_len,
|
const unsigned char *addr, int addr_len,
|
||||||
unsigned char addr_type, bool global)
|
unsigned char addr_type, bool global)
|
||||||
{
|
{
|
||||||
struct netdev_hw_addr *ha;
|
struct netdev_hw_addr *ha;
|
||||||
|
@ -72,14 +72,15 @@ static int __hw_addr_add_ex(struct netdev_hw_addr_list *list,
|
||||||
return __hw_addr_create_ex(list, addr, addr_len, addr_type, global);
|
return __hw_addr_create_ex(list, addr, addr_len, addr_type, global);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __hw_addr_add(struct netdev_hw_addr_list *list, unsigned char *addr,
|
static int __hw_addr_add(struct netdev_hw_addr_list *list,
|
||||||
int addr_len, unsigned char addr_type)
|
const unsigned char *addr, int addr_len,
|
||||||
|
unsigned char addr_type)
|
||||||
{
|
{
|
||||||
return __hw_addr_add_ex(list, addr, addr_len, addr_type, false);
|
return __hw_addr_add_ex(list, addr, addr_len, addr_type, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __hw_addr_del_ex(struct netdev_hw_addr_list *list,
|
static int __hw_addr_del_ex(struct netdev_hw_addr_list *list,
|
||||||
unsigned char *addr, int addr_len,
|
const unsigned char *addr, int addr_len,
|
||||||
unsigned char addr_type, bool global)
|
unsigned char addr_type, bool global)
|
||||||
{
|
{
|
||||||
struct netdev_hw_addr *ha;
|
struct netdev_hw_addr *ha;
|
||||||
|
@ -104,8 +105,9 @@ static int __hw_addr_del_ex(struct netdev_hw_addr_list *list,
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __hw_addr_del(struct netdev_hw_addr_list *list, unsigned char *addr,
|
static int __hw_addr_del(struct netdev_hw_addr_list *list,
|
||||||
int addr_len, unsigned char addr_type)
|
const unsigned char *addr, int addr_len,
|
||||||
|
unsigned char addr_type)
|
||||||
{
|
{
|
||||||
return __hw_addr_del_ex(list, addr, addr_len, addr_type, false);
|
return __hw_addr_del_ex(list, addr, addr_len, addr_type, false);
|
||||||
}
|
}
|
||||||
|
@ -278,7 +280,7 @@ EXPORT_SYMBOL(dev_addr_init);
|
||||||
*
|
*
|
||||||
* The caller must hold the rtnl_mutex.
|
* The caller must hold the rtnl_mutex.
|
||||||
*/
|
*/
|
||||||
int dev_addr_add(struct net_device *dev, unsigned char *addr,
|
int dev_addr_add(struct net_device *dev, const unsigned char *addr,
|
||||||
unsigned char addr_type)
|
unsigned char addr_type)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
@ -303,7 +305,7 @@ EXPORT_SYMBOL(dev_addr_add);
|
||||||
*
|
*
|
||||||
* The caller must hold the rtnl_mutex.
|
* The caller must hold the rtnl_mutex.
|
||||||
*/
|
*/
|
||||||
int dev_addr_del(struct net_device *dev, unsigned char *addr,
|
int dev_addr_del(struct net_device *dev, const unsigned char *addr,
|
||||||
unsigned char addr_type)
|
unsigned char addr_type)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
@ -390,7 +392,7 @@ EXPORT_SYMBOL(dev_addr_del_multiple);
|
||||||
* @dev: device
|
* @dev: device
|
||||||
* @addr: address to add
|
* @addr: address to add
|
||||||
*/
|
*/
|
||||||
int dev_uc_add_excl(struct net_device *dev, unsigned char *addr)
|
int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr)
|
||||||
{
|
{
|
||||||
struct netdev_hw_addr *ha;
|
struct netdev_hw_addr *ha;
|
||||||
int err;
|
int err;
|
||||||
|
@ -421,7 +423,7 @@ EXPORT_SYMBOL(dev_uc_add_excl);
|
||||||
* Add a secondary unicast address to the device or increase
|
* Add a secondary unicast address to the device or increase
|
||||||
* the reference count if it already exists.
|
* the reference count if it already exists.
|
||||||
*/
|
*/
|
||||||
int dev_uc_add(struct net_device *dev, unsigned char *addr)
|
int dev_uc_add(struct net_device *dev, const unsigned char *addr)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -443,7 +445,7 @@ EXPORT_SYMBOL(dev_uc_add);
|
||||||
* Release reference to a secondary unicast address and remove it
|
* Release reference to a secondary unicast address and remove it
|
||||||
* from the device if the reference count drops to zero.
|
* from the device if the reference count drops to zero.
|
||||||
*/
|
*/
|
||||||
int dev_uc_del(struct net_device *dev, unsigned char *addr)
|
int dev_uc_del(struct net_device *dev, const unsigned char *addr)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -543,7 +545,7 @@ EXPORT_SYMBOL(dev_uc_init);
|
||||||
* @dev: device
|
* @dev: device
|
||||||
* @addr: address to add
|
* @addr: address to add
|
||||||
*/
|
*/
|
||||||
int dev_mc_add_excl(struct net_device *dev, unsigned char *addr)
|
int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr)
|
||||||
{
|
{
|
||||||
struct netdev_hw_addr *ha;
|
struct netdev_hw_addr *ha;
|
||||||
int err;
|
int err;
|
||||||
|
@ -566,7 +568,7 @@ out:
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(dev_mc_add_excl);
|
EXPORT_SYMBOL(dev_mc_add_excl);
|
||||||
|
|
||||||
static int __dev_mc_add(struct net_device *dev, unsigned char *addr,
|
static int __dev_mc_add(struct net_device *dev, const unsigned char *addr,
|
||||||
bool global)
|
bool global)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
@ -587,7 +589,7 @@ static int __dev_mc_add(struct net_device *dev, unsigned char *addr,
|
||||||
* Add a multicast address to the device or increase
|
* Add a multicast address to the device or increase
|
||||||
* the reference count if it already exists.
|
* the reference count if it already exists.
|
||||||
*/
|
*/
|
||||||
int dev_mc_add(struct net_device *dev, unsigned char *addr)
|
int dev_mc_add(struct net_device *dev, const unsigned char *addr)
|
||||||
{
|
{
|
||||||
return __dev_mc_add(dev, addr, false);
|
return __dev_mc_add(dev, addr, false);
|
||||||
}
|
}
|
||||||
|
@ -600,13 +602,13 @@ EXPORT_SYMBOL(dev_mc_add);
|
||||||
*
|
*
|
||||||
* Add a global multicast address to the device.
|
* Add a global multicast address to the device.
|
||||||
*/
|
*/
|
||||||
int dev_mc_add_global(struct net_device *dev, unsigned char *addr)
|
int dev_mc_add_global(struct net_device *dev, const unsigned char *addr)
|
||||||
{
|
{
|
||||||
return __dev_mc_add(dev, addr, true);
|
return __dev_mc_add(dev, addr, true);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(dev_mc_add_global);
|
EXPORT_SYMBOL(dev_mc_add_global);
|
||||||
|
|
||||||
static int __dev_mc_del(struct net_device *dev, unsigned char *addr,
|
static int __dev_mc_del(struct net_device *dev, const unsigned char *addr,
|
||||||
bool global)
|
bool global)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
@ -628,7 +630,7 @@ static int __dev_mc_del(struct net_device *dev, unsigned char *addr,
|
||||||
* Release reference to a multicast address and remove it
|
* Release reference to a multicast address and remove it
|
||||||
* from the device if the reference count drops to zero.
|
* from the device if the reference count drops to zero.
|
||||||
*/
|
*/
|
||||||
int dev_mc_del(struct net_device *dev, unsigned char *addr)
|
int dev_mc_del(struct net_device *dev, const unsigned char *addr)
|
||||||
{
|
{
|
||||||
return __dev_mc_del(dev, addr, false);
|
return __dev_mc_del(dev, addr, false);
|
||||||
}
|
}
|
||||||
|
@ -642,7 +644,7 @@ EXPORT_SYMBOL(dev_mc_del);
|
||||||
* Release reference to a multicast address and remove it
|
* Release reference to a multicast address and remove it
|
||||||
* from the device if the reference count drops to zero.
|
* from the device if the reference count drops to zero.
|
||||||
*/
|
*/
|
||||||
int dev_mc_del_global(struct net_device *dev, unsigned char *addr)
|
int dev_mc_del_global(struct net_device *dev, const unsigned char *addr)
|
||||||
{
|
{
|
||||||
return __dev_mc_del(dev, addr, true);
|
return __dev_mc_del(dev, addr, true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue