aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2012-09-17 06:03:26 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-19 16:35:22 -0400
commit6b6e27255f29a6191ef8ad96bfcc392ab2ef6c71 (patch)
treea5ccefbbb2862f3777b83eefd1d10a2f550345f8
parent1d3ff76759b70e201e6b379c37ac106c487ff506 (diff)
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>
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c4
-rw-r--r--drivers/net/macvlan.c4
-rw-r--r--include/linux/netdevice.h28
-rw-r--r--net/bridge/br_fdb.c6
-rw-r--r--net/bridge/br_private.h4
-rw-r--r--net/core/dev_addr_lists.c40
6 files changed, 44 insertions, 42 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 2dc9d91e2b67..70d27a361857 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6890,7 +6890,7 @@ static int ixgbe_set_features(struct net_device *netdev,
6890 6890
6891static int ixgbe_ndo_fdb_add(struct ndmsg *ndm, 6891static int ixgbe_ndo_fdb_add(struct ndmsg *ndm,
6892 struct net_device *dev, 6892 struct net_device *dev,
6893 unsigned char *addr, 6893 const unsigned char *addr,
6894 u16 flags) 6894 u16 flags)
6895{ 6895{
6896 struct ixgbe_adapter *adapter = netdev_priv(dev); 6896 struct ixgbe_adapter *adapter = netdev_priv(dev);
@@ -6927,7 +6927,7 @@ static int ixgbe_ndo_fdb_add(struct ndmsg *ndm,
6927 6927
6928static int ixgbe_ndo_fdb_del(struct ndmsg *ndm, 6928static int ixgbe_ndo_fdb_del(struct ndmsg *ndm,
6929 struct net_device *dev, 6929 struct net_device *dev,
6930 unsigned char *addr) 6930 const unsigned char *addr)
6931{ 6931{
6932 struct ixgbe_adapter *adapter = netdev_priv(dev); 6932 struct ixgbe_adapter *adapter = netdev_priv(dev);
6933 int err = -EOPNOTSUPP; 6933 int err = -EOPNOTSUPP;
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 66a9bfe7b1c8..815dfcfbc7b9 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -548,7 +548,7 @@ static int macvlan_vlan_rx_kill_vid(struct net_device *dev,
548 548
549static int macvlan_fdb_add(struct ndmsg *ndm, 549static int macvlan_fdb_add(struct ndmsg *ndm,
550 struct net_device *dev, 550 struct net_device *dev,
551 unsigned char *addr, 551 const unsigned char *addr,
552 u16 flags) 552 u16 flags)
553{ 553{
554 struct macvlan_dev *vlan = netdev_priv(dev); 554 struct macvlan_dev *vlan = netdev_priv(dev);
@@ -567,7 +567,7 @@ static int macvlan_fdb_add(struct ndmsg *ndm,
567 567
568static int macvlan_fdb_del(struct ndmsg *ndm, 568static int macvlan_fdb_del(struct ndmsg *ndm,
569 struct net_device *dev, 569 struct net_device *dev,
570 unsigned char *addr) 570 const unsigned char *addr)
571{ 571{
572 struct macvlan_dev *vlan = netdev_priv(dev); 572 struct macvlan_dev *vlan = netdev_priv(dev);
573 int err = -EINVAL; 573 int err = -EINVAL;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ae3153c0db0a..82264e717e53 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -907,10 +907,10 @@ struct netdev_fcoe_hbainfo {
907 * Must return >0 or -errno if it changed dev->features itself. 907 * Must return >0 or -errno if it changed dev->features itself.
908 * 908 *
909 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev, 909 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev,
910 * unsigned char *addr, u16 flags) 910 * const unsigned char *addr, u16 flags)
911 * Adds an FDB entry to dev for addr. 911 * Adds an FDB entry to dev for addr.
912 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, 912 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev,
913 * unsigned char *addr) 913 * const unsigned char *addr)
914 * Deletes the FDB entry from dev coresponding to addr. 914 * Deletes the FDB entry from dev coresponding to addr.
915 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, 915 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
916 * struct net_device *dev, int idx) 916 * struct net_device *dev, int idx)
@@ -1017,11 +1017,11 @@ struct net_device_ops {
1017 1017
1018 int (*ndo_fdb_add)(struct ndmsg *ndm, 1018 int (*ndo_fdb_add)(struct ndmsg *ndm,
1019 struct net_device *dev, 1019 struct net_device *dev,
1020 unsigned char *addr, 1020 const unsigned char *addr,
1021 u16 flags); 1021 u16 flags);
1022 int (*ndo_fdb_del)(struct ndmsg *ndm, 1022 int (*ndo_fdb_del)(struct ndmsg *ndm,
1023 struct net_device *dev, 1023 struct net_device *dev,
1024 unsigned char *addr); 1024 const unsigned char *addr);
1025 int (*ndo_fdb_dump)(struct sk_buff *skb, 1025 int (*ndo_fdb_dump)(struct sk_buff *skb,
1026 struct netlink_callback *cb, 1026 struct netlink_callback *cb,
1027 struct net_device *dev, 1027 struct net_device *dev,
@@ -2561,9 +2561,9 @@ extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
2561extern void __hw_addr_init(struct netdev_hw_addr_list *list); 2561extern void __hw_addr_init(struct netdev_hw_addr_list *list);
2562 2562
2563/* Functions used for device addresses handling */ 2563/* Functions used for device addresses handling */
2564extern int dev_addr_add(struct net_device *dev, unsigned char *addr, 2564extern int dev_addr_add(struct net_device *dev, const unsigned char *addr,
2565 unsigned char addr_type); 2565 unsigned char addr_type);
2566extern int dev_addr_del(struct net_device *dev, unsigned char *addr, 2566extern int dev_addr_del(struct net_device *dev, const unsigned char *addr,
2567 unsigned char addr_type); 2567 unsigned char addr_type);
2568extern int dev_addr_add_multiple(struct net_device *to_dev, 2568extern int dev_addr_add_multiple(struct net_device *to_dev,
2569 struct net_device *from_dev, 2569 struct net_device *from_dev,
@@ -2575,20 +2575,20 @@ extern void dev_addr_flush(struct net_device *dev);
2575extern int dev_addr_init(struct net_device *dev); 2575extern int dev_addr_init(struct net_device *dev);
2576 2576
2577/* Functions used for unicast addresses handling */ 2577/* Functions used for unicast addresses handling */
2578extern int dev_uc_add(struct net_device *dev, unsigned char *addr); 2578extern int dev_uc_add(struct net_device *dev, const unsigned char *addr);
2579extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr); 2579extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
2580extern int dev_uc_del(struct net_device *dev, unsigned char *addr); 2580extern int dev_uc_del(struct net_device *dev, const unsigned char *addr);
2581extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2581extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2582extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2582extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
2583extern void dev_uc_flush(struct net_device *dev); 2583extern void dev_uc_flush(struct net_device *dev);
2584extern void dev_uc_init(struct net_device *dev); 2584extern void dev_uc_init(struct net_device *dev);
2585 2585
2586/* Functions used for multicast addresses handling */ 2586/* Functions used for multicast addresses handling */
2587extern int dev_mc_add(struct net_device *dev, unsigned char *addr); 2587extern int dev_mc_add(struct net_device *dev, const unsigned char *addr);
2588extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr); 2588extern int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
2589extern int dev_mc_add_excl(struct net_device *dev, unsigned char *addr); 2589extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
2590extern int dev_mc_del(struct net_device *dev, unsigned char *addr); 2590extern int dev_mc_del(struct net_device *dev, const unsigned char *addr);
2591extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr); 2591extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
2592extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2592extern int dev_mc_sync(struct net_device *to, struct net_device *from);
2593extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 2593extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
2594extern void dev_mc_flush(struct net_device *dev); 2594extern void dev_mc_flush(struct net_device *dev);
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index ddf93efc133c..02861190a3d4 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -609,7 +609,7 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
609 609
610/* Add new permanent fdb entry with RTM_NEWNEIGH */ 610/* Add new permanent fdb entry with RTM_NEWNEIGH */
611int br_fdb_add(struct ndmsg *ndm, struct net_device *dev, 611int br_fdb_add(struct ndmsg *ndm, struct net_device *dev,
612 unsigned char *addr, u16 nlh_flags) 612 const unsigned char *addr, u16 nlh_flags)
613{ 613{
614 struct net_bridge_port *p; 614 struct net_bridge_port *p;
615 int err = 0; 615 int err = 0;
@@ -639,7 +639,7 @@ int br_fdb_add(struct ndmsg *ndm, struct net_device *dev,
639 return err; 639 return err;
640} 640}
641 641
642static int fdb_delete_by_addr(struct net_bridge_port *p, u8 *addr) 642static int fdb_delete_by_addr(struct net_bridge_port *p, const u8 *addr)
643{ 643{
644 struct net_bridge *br = p->br; 644 struct net_bridge *br = p->br;
645 struct hlist_head *head = &br->hash[br_mac_hash(addr)]; 645 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)
655 655
656/* Remove neighbor entry with RTM_DELNEIGH */ 656/* Remove neighbor entry with RTM_DELNEIGH */
657int br_fdb_delete(struct ndmsg *ndm, struct net_device *dev, 657int br_fdb_delete(struct ndmsg *ndm, struct net_device *dev,
658 unsigned char *addr) 658 const unsigned char *addr)
659{ 659{
660 struct net_bridge_port *p; 660 struct net_bridge_port *p;
661 int err; 661 int err;
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index f507d2af9646..11a984b87e62 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -363,10 +363,10 @@ extern void br_fdb_update(struct net_bridge *br,
363 363
364extern int br_fdb_delete(struct ndmsg *ndm, 364extern int br_fdb_delete(struct ndmsg *ndm,
365 struct net_device *dev, 365 struct net_device *dev,
366 unsigned char *addr); 366 const unsigned char *addr);
367extern int br_fdb_add(struct ndmsg *nlh, 367extern int br_fdb_add(struct ndmsg *nlh,
368 struct net_device *dev, 368 struct net_device *dev,
369 unsigned char *addr, 369 const unsigned char *addr,
370 u16 nlh_flags); 370 u16 nlh_flags);
371extern int br_fdb_dump(struct sk_buff *skb, 371extern int br_fdb_dump(struct sk_buff *skb,
372 struct netlink_callback *cb, 372 struct netlink_callback *cb,
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index c4cc2bc49f06..87cc17db2d56 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -22,7 +22,7 @@
22 */ 22 */
23 23
24static int __hw_addr_create_ex(struct netdev_hw_addr_list *list, 24static int __hw_addr_create_ex(struct netdev_hw_addr_list *list,
25 unsigned char *addr, int addr_len, 25 const unsigned char *addr, int addr_len,
26 unsigned char addr_type, bool global) 26 unsigned char addr_type, bool global)
27{ 27{
28 struct netdev_hw_addr *ha; 28 struct netdev_hw_addr *ha;
@@ -46,7 +46,7 @@ static int __hw_addr_create_ex(struct netdev_hw_addr_list *list,
46} 46}
47 47
48static int __hw_addr_add_ex(struct netdev_hw_addr_list *list, 48static int __hw_addr_add_ex(struct netdev_hw_addr_list *list,
49 unsigned char *addr, int addr_len, 49 const unsigned char *addr, int addr_len,
50 unsigned char addr_type, bool global) 50 unsigned char addr_type, bool global)
51{ 51{
52 struct netdev_hw_addr *ha; 52 struct netdev_hw_addr *ha;
@@ -72,14 +72,15 @@ static int __hw_addr_add_ex(struct netdev_hw_addr_list *list,
72 return __hw_addr_create_ex(list, addr, addr_len, addr_type, global); 72 return __hw_addr_create_ex(list, addr, addr_len, addr_type, global);
73} 73}
74 74
75static int __hw_addr_add(struct netdev_hw_addr_list *list, unsigned char *addr, 75static int __hw_addr_add(struct netdev_hw_addr_list *list,
76 int addr_len, unsigned char addr_type) 76 const unsigned char *addr, int addr_len,
77 unsigned char addr_type)
77{ 78{
78 return __hw_addr_add_ex(list, addr, addr_len, addr_type, false); 79 return __hw_addr_add_ex(list, addr, addr_len, addr_type, false);
79} 80}
80 81
81static int __hw_addr_del_ex(struct netdev_hw_addr_list *list, 82static int __hw_addr_del_ex(struct netdev_hw_addr_list *list,
82 unsigned char *addr, int addr_len, 83 const unsigned char *addr, int addr_len,
83 unsigned char addr_type, bool global) 84 unsigned char addr_type, bool global)
84{ 85{
85 struct netdev_hw_addr *ha; 86 struct netdev_hw_addr *ha;
@@ -104,8 +105,9 @@ static int __hw_addr_del_ex(struct netdev_hw_addr_list *list,
104 return -ENOENT; 105 return -ENOENT;
105} 106}
106 107
107static int __hw_addr_del(struct netdev_hw_addr_list *list, unsigned char *addr, 108static int __hw_addr_del(struct netdev_hw_addr_list *list,
108 int addr_len, unsigned char addr_type) 109 const unsigned char *addr, int addr_len,
110 unsigned char addr_type)
109{ 111{
110 return __hw_addr_del_ex(list, addr, addr_len, addr_type, false); 112 return __hw_addr_del_ex(list, addr, addr_len, addr_type, false);
111} 113}
@@ -278,7 +280,7 @@ EXPORT_SYMBOL(dev_addr_init);
278 * 280 *
279 * The caller must hold the rtnl_mutex. 281 * The caller must hold the rtnl_mutex.
280 */ 282 */
281int dev_addr_add(struct net_device *dev, unsigned char *addr, 283int dev_addr_add(struct net_device *dev, const unsigned char *addr,
282 unsigned char addr_type) 284 unsigned char addr_type)
283{ 285{
284 int err; 286 int err;
@@ -303,7 +305,7 @@ EXPORT_SYMBOL(dev_addr_add);
303 * 305 *
304 * The caller must hold the rtnl_mutex. 306 * The caller must hold the rtnl_mutex.
305 */ 307 */
306int dev_addr_del(struct net_device *dev, unsigned char *addr, 308int dev_addr_del(struct net_device *dev, const unsigned char *addr,
307 unsigned char addr_type) 309 unsigned char addr_type)
308{ 310{
309 int err; 311 int err;
@@ -390,7 +392,7 @@ EXPORT_SYMBOL(dev_addr_del_multiple);
390 * @dev: device 392 * @dev: device
391 * @addr: address to add 393 * @addr: address to add
392 */ 394 */
393int dev_uc_add_excl(struct net_device *dev, unsigned char *addr) 395int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr)
394{ 396{
395 struct netdev_hw_addr *ha; 397 struct netdev_hw_addr *ha;
396 int err; 398 int err;
@@ -421,7 +423,7 @@ EXPORT_SYMBOL(dev_uc_add_excl);
421 * Add a secondary unicast address to the device or increase 423 * Add a secondary unicast address to the device or increase
422 * the reference count if it already exists. 424 * the reference count if it already exists.
423 */ 425 */
424int dev_uc_add(struct net_device *dev, unsigned char *addr) 426int dev_uc_add(struct net_device *dev, const unsigned char *addr)
425{ 427{
426 int err; 428 int err;
427 429
@@ -443,7 +445,7 @@ EXPORT_SYMBOL(dev_uc_add);
443 * Release reference to a secondary unicast address and remove it 445 * Release reference to a secondary unicast address and remove it
444 * from the device if the reference count drops to zero. 446 * from the device if the reference count drops to zero.
445 */ 447 */
446int dev_uc_del(struct net_device *dev, unsigned char *addr) 448int dev_uc_del(struct net_device *dev, const unsigned char *addr)
447{ 449{
448 int err; 450 int err;
449 451
@@ -543,7 +545,7 @@ EXPORT_SYMBOL(dev_uc_init);
543 * @dev: device 545 * @dev: device
544 * @addr: address to add 546 * @addr: address to add
545 */ 547 */
546int dev_mc_add_excl(struct net_device *dev, unsigned char *addr) 548int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr)
547{ 549{
548 struct netdev_hw_addr *ha; 550 struct netdev_hw_addr *ha;
549 int err; 551 int err;
@@ -566,7 +568,7 @@ out:
566} 568}
567EXPORT_SYMBOL(dev_mc_add_excl); 569EXPORT_SYMBOL(dev_mc_add_excl);
568 570
569static int __dev_mc_add(struct net_device *dev, unsigned char *addr, 571static int __dev_mc_add(struct net_device *dev, const unsigned char *addr,
570 bool global) 572 bool global)
571{ 573{
572 int err; 574 int err;
@@ -587,7 +589,7 @@ static int __dev_mc_add(struct net_device *dev, unsigned char *addr,
587 * Add a multicast address to the device or increase 589 * Add a multicast address to the device or increase
588 * the reference count if it already exists. 590 * the reference count if it already exists.
589 */ 591 */
590int dev_mc_add(struct net_device *dev, unsigned char *addr) 592int dev_mc_add(struct net_device *dev, const unsigned char *addr)
591{ 593{
592 return __dev_mc_add(dev, addr, false); 594 return __dev_mc_add(dev, addr, false);
593} 595}
@@ -600,13 +602,13 @@ EXPORT_SYMBOL(dev_mc_add);
600 * 602 *
601 * Add a global multicast address to the device. 603 * Add a global multicast address to the device.
602 */ 604 */
603int dev_mc_add_global(struct net_device *dev, unsigned char *addr) 605int dev_mc_add_global(struct net_device *dev, const unsigned char *addr)
604{ 606{
605 return __dev_mc_add(dev, addr, true); 607 return __dev_mc_add(dev, addr, true);
606} 608}
607EXPORT_SYMBOL(dev_mc_add_global); 609EXPORT_SYMBOL(dev_mc_add_global);
608 610
609static int __dev_mc_del(struct net_device *dev, unsigned char *addr, 611static int __dev_mc_del(struct net_device *dev, const unsigned char *addr,
610 bool global) 612 bool global)
611{ 613{
612 int err; 614 int err;
@@ -628,7 +630,7 @@ static int __dev_mc_del(struct net_device *dev, unsigned char *addr,
628 * Release reference to a multicast address and remove it 630 * Release reference to a multicast address and remove it
629 * from the device if the reference count drops to zero. 631 * from the device if the reference count drops to zero.
630 */ 632 */
631int dev_mc_del(struct net_device *dev, unsigned char *addr) 633int dev_mc_del(struct net_device *dev, const unsigned char *addr)
632{ 634{
633 return __dev_mc_del(dev, addr, false); 635 return __dev_mc_del(dev, addr, false);
634} 636}
@@ -642,7 +644,7 @@ EXPORT_SYMBOL(dev_mc_del);
642 * Release reference to a multicast address and remove it 644 * Release reference to a multicast address and remove it
643 * from the device if the reference count drops to zero. 645 * from the device if the reference count drops to zero.
644 */ 646 */
645int dev_mc_del_global(struct net_device *dev, unsigned char *addr) 647int dev_mc_del_global(struct net_device *dev, const unsigned char *addr)
646{ 648{
647 return __dev_mc_del(dev, addr, true); 649 return __dev_mc_del(dev, addr, true);
648} 650}