rtnetlink.c (d314774cf2cd5dfeb39a00d37deee65d4c627927) | rtnetlink.c (eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 537 unchanged lines hidden (view full) --- 546 write_lock_bh(&dev_base_lock); 547 dev->operstate = operstate; 548 write_unlock_bh(&dev_base_lock); 549 netdev_state_change(dev); 550 } 551} 552 553static void copy_rtnl_link_stats(struct rtnl_link_stats *a, | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 537 unchanged lines hidden (view full) --- 546 write_lock_bh(&dev_base_lock); 547 dev->operstate = operstate; 548 write_unlock_bh(&dev_base_lock); 549 netdev_state_change(dev); 550 } 551} 552 553static void copy_rtnl_link_stats(struct rtnl_link_stats *a, |
554 struct net_device_stats *b) | 554 const struct net_device_stats *b) |
555{ 556 a->rx_packets = b->rx_packets; 557 a->tx_packets = b->tx_packets; 558 a->rx_bytes = b->rx_bytes; 559 a->tx_bytes = b->tx_bytes; 560 a->rx_errors = b->rx_errors; 561 a->tx_errors = b->tx_errors; 562 a->rx_dropped = b->rx_dropped; --- 41 unchanged lines hidden (view full) --- 604 605static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, 606 int type, u32 pid, u32 seq, u32 change, 607 unsigned int flags) 608{ 609 struct netdev_queue *txq; 610 struct ifinfomsg *ifm; 611 struct nlmsghdr *nlh; | 555{ 556 a->rx_packets = b->rx_packets; 557 a->tx_packets = b->tx_packets; 558 a->rx_bytes = b->rx_bytes; 559 a->tx_bytes = b->tx_bytes; 560 a->rx_errors = b->rx_errors; 561 a->tx_errors = b->tx_errors; 562 a->rx_dropped = b->rx_dropped; --- 41 unchanged lines hidden (view full) --- 604 605static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, 606 int type, u32 pid, u32 seq, u32 change, 607 unsigned int flags) 608{ 609 struct netdev_queue *txq; 610 struct ifinfomsg *ifm; 611 struct nlmsghdr *nlh; |
612 struct net_device_stats *stats; | 612 const struct net_device_stats *stats; |
613 struct nlattr *attr; 614 615 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags); 616 if (nlh == NULL) 617 return -EMSGSIZE; 618 619 ifm = nlmsg_data(nlh); 620 ifm->ifi_family = AF_UNSPEC; --- 40 unchanged lines hidden (view full) --- 661 NLA_PUT(skb, IFLA_BROADCAST, dev->addr_len, dev->broadcast); 662 } 663 664 attr = nla_reserve(skb, IFLA_STATS, 665 sizeof(struct rtnl_link_stats)); 666 if (attr == NULL) 667 goto nla_put_failure; 668 | 613 struct nlattr *attr; 614 615 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags); 616 if (nlh == NULL) 617 return -EMSGSIZE; 618 619 ifm = nlmsg_data(nlh); 620 ifm->ifi_family = AF_UNSPEC; --- 40 unchanged lines hidden (view full) --- 661 NLA_PUT(skb, IFLA_BROADCAST, dev->addr_len, dev->broadcast); 662 } 663 664 attr = nla_reserve(skb, IFLA_STATS, 665 sizeof(struct rtnl_link_stats)); 666 if (attr == NULL) 667 goto nla_put_failure; 668 |
669 stats = dev->get_stats(dev); | 669 stats = dev_get_stats(dev); |
670 copy_rtnl_link_stats(nla_data(attr), stats); 671 672 if (dev->rtnl_link_ops) { 673 if (rtnl_link_fill(skb, dev) < 0) 674 goto nla_put_failure; 675 } 676 677 return nlmsg_end(skb, nlh); --- 753 unchanged lines hidden --- | 670 copy_rtnl_link_stats(nla_data(attr), stats); 671 672 if (dev->rtnl_link_ops) { 673 if (rtnl_link_fill(skb, dev) < 0) 674 goto nla_put_failure; 675 } 676 677 return nlmsg_end(skb, nlh); --- 753 unchanged lines hidden --- |