Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
David S. Miller [Mon, 17 May 2010 05:26:58 +0000 (22:26 -0700)]
Conflicts:
include/linux/if_link.h

1  2 
drivers/vhost/vhost.c
include/linux/if_link.h
include/net/tcp.h
net/core/rtnetlink.c
net/ipv4/tcp.c
net/sctp/transport.c

Simple merge
@@@ -111,11 -79,7 +111,8 @@@ enum 
        IFLA_NET_NS_PID,
        IFLA_IFALIAS,
        IFLA_NUM_VF,            /* Number of VFs if device is SR-IOV PF */
-       IFLA_VF_MAC,            /* Hardware queue specific attributes */
-       IFLA_VF_VLAN,
-       IFLA_VF_TX_RATE,        /* TX Bandwidth Allocation */
-       IFLA_VFINFO,
+       IFLA_VFINFO_LIST,
 +      IFLA_STATS64,
        __IFLA_MAX
  };
  
Simple merge
@@@ -608,48 -600,21 +608,55 @@@ static void copy_rtnl_link_stats(struc
  
        a->rx_compressed = b->rx_compressed;
        a->tx_compressed = b->tx_compressed;
 -};
 +}
 +
 +static void copy_rtnl_link_stats64(void *v, const struct net_device_stats *b)
 +{
 +      struct rtnl_link_stats64 a;
 +
 +      a.rx_packets = b->rx_packets;
 +      a.tx_packets = b->tx_packets;
 +      a.rx_bytes = b->rx_bytes;
 +      a.tx_bytes = b->tx_bytes;
 +      a.rx_errors = b->rx_errors;
 +      a.tx_errors = b->tx_errors;
 +      a.rx_dropped = b->rx_dropped;
 +      a.tx_dropped = b->tx_dropped;
 +
 +      a.multicast = b->multicast;
 +      a.collisions = b->collisions;
 +
 +      a.rx_length_errors = b->rx_length_errors;
 +      a.rx_over_errors = b->rx_over_errors;
 +      a.rx_crc_errors = b->rx_crc_errors;
 +      a.rx_frame_errors = b->rx_frame_errors;
 +      a.rx_fifo_errors = b->rx_fifo_errors;
 +      a.rx_missed_errors = b->rx_missed_errors;
 +
 +      a.tx_aborted_errors = b->tx_aborted_errors;
 +      a.tx_carrier_errors = b->tx_carrier_errors;
 +      a.tx_fifo_errors = b->tx_fifo_errors;
 +      a.tx_heartbeat_errors = b->tx_heartbeat_errors;
 +      a.tx_window_errors = b->tx_window_errors;
 +
 +      a.rx_compressed = b->rx_compressed;
 +      a.tx_compressed = b->tx_compressed;
 +      memcpy(v, &a, sizeof(a));
 +}
  
+ /* All VF info */
  static inline int rtnl_vfinfo_size(const struct net_device *dev)
  {
-       if (dev->dev.parent && dev_is_pci(dev->dev.parent))
-               return dev_num_vf(dev->dev.parent) *
-                       sizeof(struct ifla_vf_info);
-       else
+       if (dev->dev.parent && dev_is_pci(dev->dev.parent)) {
+               int num_vfs = dev_num_vf(dev->dev.parent);
+               size_t size = nlmsg_total_size(sizeof(struct nlattr));
+               size += nlmsg_total_size(num_vfs * sizeof(struct nlattr));
+               size += num_vfs * (sizeof(struct ifla_vf_mac) +
+                                 sizeof(struct ifla_vf_vlan) +
+                                 sizeof(struct ifla_vf_tx_rate));
+               return size;
+       } else
                return 0;
  }
  
@@@ -741,22 -705,39 +748,45 @@@ static int rtnl_fill_ifinfo(struct sk_b
        stats = dev_get_stats(dev);
        copy_rtnl_link_stats(nla_data(attr), stats);
  
 +      attr = nla_reserve(skb, IFLA_STATS64,
 +                      sizeof(struct rtnl_link_stats64));
 +      if (attr == NULL)
 +              goto nla_put_failure;
 +      copy_rtnl_link_stats64(nla_data(attr), stats);
 +
        if (dev->netdev_ops->ndo_get_vf_config && dev->dev.parent) {
                int i;
-               struct ifla_vf_info ivi;
  
-               NLA_PUT_U32(skb, IFLA_NUM_VF, dev_num_vf(dev->dev.parent));
-               for (i = 0; i < dev_num_vf(dev->dev.parent); i++) {
+               struct nlattr *vfinfo, *vf;
+               int num_vfs = dev_num_vf(dev->dev.parent);
+               NLA_PUT_U32(skb, IFLA_NUM_VF, num_vfs);
+               vfinfo = nla_nest_start(skb, IFLA_VFINFO_LIST);
+               if (!vfinfo)
+                       goto nla_put_failure;
+               for (i = 0; i < num_vfs; i++) {
+                       struct ifla_vf_info ivi;
+                       struct ifla_vf_mac vf_mac;
+                       struct ifla_vf_vlan vf_vlan;
+                       struct ifla_vf_tx_rate vf_tx_rate;
                        if (dev->netdev_ops->ndo_get_vf_config(dev, i, &ivi))
                                break;
-                       NLA_PUT(skb, IFLA_VFINFO, sizeof(ivi), &ivi);
+                       vf_mac.vf = vf_vlan.vf = vf_tx_rate.vf = ivi.vf;
+                       memcpy(vf_mac.mac, ivi.mac, sizeof(ivi.mac));
+                       vf_vlan.vlan = ivi.vlan;
+                       vf_vlan.qos = ivi.qos;
+                       vf_tx_rate.rate = ivi.tx_rate;
+                       vf = nla_nest_start(skb, IFLA_VF_INFO);
+                       if (!vf) {
+                               nla_nest_cancel(skb, vfinfo);
+                               goto nla_put_failure;
+                       }
+                       NLA_PUT(skb, IFLA_VF_MAC, sizeof(vf_mac), &vf_mac);
+                       NLA_PUT(skb, IFLA_VF_VLAN, sizeof(vf_vlan), &vf_vlan);
+                       NLA_PUT(skb, IFLA_VF_TX_RATE, sizeof(vf_tx_rate), &vf_tx_rate);
+                       nla_nest_end(skb, vf);
                }
+               nla_nest_end(skb, vfinfo);
        }
        if (dev->rtnl_link_ops) {
                if (rtnl_link_fill(skb, dev) < 0)
diff --cc net/ipv4/tcp.c
Simple merge
Simple merge