+++ /dev/null
-#ifndef __LINUX_IF_LINK_WRAPPER_H
-#define __LINUX_IF_LINK_WRAPPER_H 1
-
-#include_next <linux/if_link.h>
-
-#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
-/* The main device statistics structure */
-struct rtnl_link_stats64 {
- __u64 rx_packets; /* total packets received */
- __u64 tx_packets; /* total packets transmitted */
- __u64 rx_bytes; /* total bytes received */
- __u64 tx_bytes; /* total bytes transmitted */
- __u64 rx_errors; /* bad packets received */
- __u64 tx_errors; /* packet transmit problems */
- __u64 rx_dropped; /* no space in linux buffers */
- __u64 tx_dropped; /* no space available in linux */
- __u64 multicast; /* multicast packets received */
- __u64 collisions;
-
- /* detailed rx_errors: */
- __u64 rx_length_errors;
- __u64 rx_over_errors; /* receiver ring buff overflow */
- __u64 rx_crc_errors; /* recved pkt with crc error */
- __u64 rx_frame_errors; /* recv'd frame alignment error */
- __u64 rx_fifo_errors; /* recv'r fifo overrun */
- __u64 rx_missed_errors; /* receiver missed packet */
-
- /* detailed tx_errors */
- __u64 tx_aborted_errors;
- __u64 tx_carrier_errors;
- __u64 tx_fifo_errors;
- __u64 tx_heartbeat_errors;
- __u64 tx_window_errors;
-
- /* for cslip etc */
- __u64 rx_compressed;
- __u64 tx_compressed;
-};
-#endif /* linux kernel < 2.6.35 */
-
-#endif
struct net_device_stats *stats = &internal_dev_priv(netdev)->stats;
if (vport) {
- struct odp_vport_stats vport_stats;
+ struct rtnl_link_stats64 vport_stats;
vport_get_stats(vport, &vport_stats);
/* If we are using the vport stats layer initialize it to the current
* values so we are roughly consistent with the device stats. */
if (USE_VPORT_STATS) {
- struct odp_vport_stats stats;
+ struct rtnl_link_stats64 stats;
err = netdev_get_stats(vport, &stats);
if (!err)
return &netdev_vport->dev->NETDEV_DEV_MEMBER.kobj;
}
-int netdev_get_stats(const struct vport *vport, struct odp_vport_stats *stats)
+int netdev_get_stats(const struct vport *vport, struct rtnl_link_stats64 *stats)
{
const struct netdev_vport *netdev_vport = netdev_vport_priv(vport);
- struct rtnl_link_stats64 netdev_stats;
-
- dev_get_stats(netdev_vport->dev, &netdev_stats);
-
- stats->rx_bytes = netdev_stats.rx_bytes;
- stats->rx_packets = netdev_stats.rx_packets;
- stats->tx_bytes = netdev_stats.tx_bytes;
- stats->tx_packets = netdev_stats.tx_packets;
- stats->rx_dropped = netdev_stats.rx_dropped;
- stats->rx_errors = netdev_stats.rx_errors;
- stats->rx_frame_err = netdev_stats.rx_frame_errors;
- stats->rx_over_err = netdev_stats.rx_over_errors;
- stats->rx_crc_err = netdev_stats.rx_crc_errors;
- stats->tx_dropped = netdev_stats.tx_dropped;
- stats->tx_errors = netdev_stats.tx_errors;
- stats->collisions = netdev_stats.collisions;
-
+ dev_get_stats(netdev_vport->dev, stats);
return 0;
}
const char *netdev_get_name(const struct vport *);
const unsigned char *netdev_get_addr(const struct vport *);
struct kobject *netdev_get_kobj(const struct vport *);
-int netdev_get_stats(const struct vport *, struct odp_vport_stats *);
+int netdev_get_stats(const struct vport *, struct rtnl_link_stats64 *);
unsigned netdev_get_dev_flags(const struct vport *);
int netdev_is_running(const struct vport *);
unsigned char netdev_get_operstate(const struct vport *);
* support setting the stats, in which case the result will always be
* -EOPNOTSUPP. RTNL lock must be held.
*/
-int vport_set_stats(struct vport *vport, struct odp_vport_stats *stats)
+int vport_set_stats(struct vport *vport, struct rtnl_link_stats64 *stats)
{
ASSERT_RTNL();
*
* Retrieves transmit, receive, and error stats for the given device.
*/
-int vport_get_stats(struct vport *vport, struct odp_vport_stats *stats)
+int vport_get_stats(struct vport *vport, struct rtnl_link_stats64 *stats)
{
- struct odp_vport_stats dev_stats;
- struct odp_vport_stats *dev_statsp = NULL;
+ struct rtnl_link_stats64 dev_stats;
+ struct rtnl_link_stats64 *dev_statsp = NULL;
int err;
if (vport->ops->get_stats) {
stats->tx_errors += vport->err_stats.tx_errors;
stats->tx_dropped += vport->err_stats.tx_dropped;
stats->rx_dropped += vport->err_stats.rx_dropped;
- stats->rx_over_err += vport->err_stats.rx_over_err;
- stats->rx_crc_err += vport->err_stats.rx_crc_err;
- stats->rx_frame_err += vport->err_stats.rx_frame_err;
+ stats->rx_over_errors += vport->err_stats.rx_over_err;
+ stats->rx_crc_errors += vport->err_stats.rx_crc_err;
+ stats->rx_frame_errors += vport->err_stats.rx_frame_err;
stats->collisions += vport->err_stats.collisions;
spin_unlock_bh(&vport->stats_lock);
if (dev_statsp) {
- stats->rx_errors += dev_statsp->rx_errors;
- stats->tx_errors += dev_statsp->tx_errors;
- stats->rx_dropped += dev_statsp->rx_dropped;
- stats->tx_dropped += dev_statsp->tx_dropped;
- stats->rx_over_err += dev_statsp->rx_over_err;
- stats->rx_crc_err += dev_statsp->rx_crc_err;
- stats->rx_frame_err += dev_statsp->rx_frame_err;
- stats->collisions += dev_statsp->collisions;
+ stats->rx_packets += dev_statsp->rx_packets;
+ stats->tx_packets += dev_statsp->tx_packets;
+ stats->rx_bytes += dev_statsp->rx_bytes;
+ stats->tx_bytes += dev_statsp->tx_bytes;
+ stats->rx_errors += dev_statsp->rx_errors;
+ stats->tx_errors += dev_statsp->tx_errors;
+ stats->rx_dropped += dev_statsp->rx_dropped;
+ stats->tx_dropped += dev_statsp->tx_dropped;
+ stats->multicast += dev_statsp->multicast;
+ stats->collisions += dev_statsp->collisions;
+ stats->rx_length_errors += dev_statsp->rx_length_errors;
+ stats->rx_over_errors += dev_statsp->rx_over_errors;
+ stats->rx_crc_errors += dev_statsp->rx_crc_errors;
+ stats->rx_frame_errors += dev_statsp->rx_frame_errors;
+ stats->rx_fifo_errors += dev_statsp->rx_fifo_errors;
+ stats->rx_missed_errors += dev_statsp->rx_missed_errors;
+ stats->tx_aborted_errors += dev_statsp->tx_aborted_errors;
+ stats->tx_carrier_errors += dev_statsp->tx_carrier_errors;
+ stats->tx_fifo_errors += dev_statsp->tx_fifo_errors;
+ stats->tx_heartbeat_errors += dev_statsp->tx_heartbeat_errors;
+ stats->tx_window_errors += dev_statsp->tx_window_errors;
+ stats->rx_compressed += dev_statsp->rx_compressed;
+ stats->tx_compressed += dev_statsp->tx_compressed;
}
for_each_possible_cpu(i) {
int vport_set_mtu(struct vport *, int mtu);
int vport_set_addr(struct vport *, const unsigned char *);
-int vport_set_stats(struct vport *, struct odp_vport_stats *);
+int vport_set_stats(struct vport *, struct rtnl_link_stats64 *);
const char *vport_get_name(const struct vport *);
const char *vport_get_type(const struct vport *);
struct dp_port *vport_get_dp_port(const struct vport *);
struct kobject *vport_get_kobj(const struct vport *);
-int vport_get_stats(struct vport *, struct odp_vport_stats *);
+int vport_get_stats(struct vport *, struct rtnl_link_stats64 *);
unsigned vport_get_flags(const struct vport *);
int vport_is_running(const struct vport *);
spinlock_t stats_lock;
struct vport_err_stats err_stats;
- struct odp_vport_stats offset_stats;
+ struct rtnl_link_stats64 offset_stats;
};
#define VPORT_F_REQUIRED (1 << 0) /* If init fails, module loading fails. */
int (*set_mtu)(struct vport *, int mtu);
int (*set_addr)(struct vport *, const unsigned char *);
- int (*set_stats)(const struct vport *, struct odp_vport_stats *);
+ int (*set_stats)(const struct vport *, struct rtnl_link_stats64 *);
/* Called with rcu_read_lock or RTNL lock. */
const char *(*get_name)(const struct vport *);
const unsigned char *(*get_addr)(const struct vport *);
struct kobject *(*get_kobj)(const struct vport *);
- int (*get_stats)(const struct vport *, struct odp_vport_stats *);
+ int (*get_stats)(const struct vport *, struct rtnl_link_stats64 *);
unsigned (*get_dev_flags)(const struct vport *);
int (*is_running)(const struct vport *);
--- /dev/null
+#ifndef __LINUX_IF_LINK_WRAPPER_H
+#define __LINUX_IF_LINK_WRAPPER_H 1
+
+#include_next <linux/if_link.h>
+
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
+/* The main device statistics structure */
+struct rtnl_link_stats64 {
+ __u64 rx_packets; /* total packets received */
+ __u64 tx_packets; /* total packets transmitted */
+ __u64 rx_bytes; /* total bytes received */
+ __u64 tx_bytes; /* total bytes transmitted */
+ __u64 rx_errors; /* bad packets received */
+ __u64 tx_errors; /* packet transmit problems */
+ __u64 rx_dropped; /* no space in linux buffers */
+ __u64 tx_dropped; /* no space available in linux */
+ __u64 multicast; /* multicast packets received */
+ __u64 collisions;
+
+ /* detailed rx_errors: */
+ __u64 rx_length_errors;
+ __u64 rx_over_errors; /* receiver ring buff overflow */
+ __u64 rx_crc_errors; /* recved pkt with crc error */
+ __u64 rx_frame_errors; /* recv'd frame alignment error */
+ __u64 rx_fifo_errors; /* recv'r fifo overrun */
+ __u64 rx_missed_errors; /* receiver missed packet */
+
+ /* detailed tx_errors */
+ __u64 tx_aborted_errors;
+ __u64 tx_carrier_errors;
+ __u64 tx_fifo_errors;
+ __u64 tx_heartbeat_errors;
+ __u64 tx_window_errors;
+
+ /* for cslip etc */
+ __u64 rx_compressed;
+ __u64 tx_compressed;
+};
+#endif /* linux kernel < 2.6.35 */
+
+#endif
* those types when compiling the kernel. */
#ifdef __KERNEL__
#include <linux/types.h>
+#include <linux/socket.h>
#define ovs_be16 __be16
#define ovs_be32 __be32
#define ovs_be64 __be64
#else
#include "openvswitch/types.h"
+#include <sys/socket.h>
#endif
+#include <linux/if_link.h>
+
#define ODP_MAX 256 /* Maximum number of datapaths. */
#define ODP_DP_CREATE _IO('O', 0)
void *config;
};
-struct odp_vport_stats {
- uint64_t rx_packets;
- uint64_t tx_packets;
- uint64_t rx_bytes;
- uint64_t tx_bytes;
- uint64_t rx_dropped;
- uint64_t tx_dropped;
- uint64_t rx_errors;
- uint64_t tx_errors;
- uint64_t rx_frame_err;
- uint64_t rx_over_err;
- uint64_t rx_crc_err;
- uint64_t collisions;
-};
-
struct odp_vport_stats_req {
char devname[16]; /* IFNAMSIZ */
- struct odp_vport_stats stats;
+ struct rtnl_link_stats64 stats;
};
struct odp_vport_ether {
stats->tx_errors = ovsr.stats.tx_errors;
stats->rx_dropped = ovsr.stats.rx_dropped;
stats->tx_dropped = ovsr.stats.tx_dropped;
- stats->multicast = UINT64_MAX;
+ stats->multicast = ovsr.stats.multicast;
stats->collisions = ovsr.stats.collisions;
- stats->rx_length_errors = UINT64_MAX;
- stats->rx_over_errors = ovsr.stats.rx_over_err;
- stats->rx_crc_errors = ovsr.stats.rx_crc_err;
- stats->rx_frame_errors = ovsr.stats.rx_frame_err;
- stats->rx_fifo_errors = UINT64_MAX;
- stats->rx_missed_errors = UINT64_MAX;
- stats->tx_aborted_errors = UINT64_MAX;
- stats->tx_carrier_errors = UINT64_MAX;
- stats->tx_fifo_errors = UINT64_MAX;
- stats->tx_heartbeat_errors = UINT64_MAX;
- stats->tx_window_errors = UINT64_MAX;
+ stats->rx_length_errors = ovsr.stats.rx_length_errors;
+ stats->rx_over_errors = ovsr.stats.rx_over_errors;
+ stats->rx_crc_errors = ovsr.stats.rx_crc_errors;
+ stats->rx_frame_errors = ovsr.stats.rx_frame_errors;
+ stats->rx_fifo_errors = ovsr.stats.rx_fifo_errors;
+ stats->rx_missed_errors = ovsr.stats.rx_missed_errors;
+ stats->tx_aborted_errors = ovsr.stats.tx_aborted_errors;
+ stats->tx_carrier_errors = ovsr.stats.tx_carrier_errors;
+ stats->tx_fifo_errors = ovsr.stats.tx_fifo_errors;
+ stats->tx_heartbeat_errors = ovsr.stats.tx_heartbeat_errors;
+ stats->tx_window_errors = ovsr.stats.tx_window_errors;
return 0;
}
ovsr.stats.tx_errors = stats->tx_errors;
ovsr.stats.rx_dropped = stats->rx_dropped;
ovsr.stats.tx_dropped = stats->tx_dropped;
+ ovsr.stats.multicast = stats->multicast;
ovsr.stats.collisions = stats->collisions;
- ovsr.stats.rx_over_err = stats->rx_over_errors;
- ovsr.stats.rx_crc_err = stats->rx_crc_errors;
- ovsr.stats.rx_frame_err = stats->rx_frame_errors;
+ ovsr.stats.rx_length_errors = stats->rx_length_errors;
+ ovsr.stats.rx_over_errors = stats->rx_over_errors;
+ ovsr.stats.rx_crc_errors = stats->rx_crc_errors;
+ ovsr.stats.rx_frame_errors = stats->rx_frame_errors;
+ ovsr.stats.rx_fifo_errors = stats->rx_fifo_errors;
+ ovsr.stats.rx_missed_errors = stats->rx_missed_errors;
+ ovsr.stats.tx_aborted_errors = stats->tx_aborted_errors;
+ ovsr.stats.tx_carrier_errors = stats->tx_carrier_errors;
+ ovsr.stats.tx_fifo_errors = stats->tx_fifo_errors;
+ ovsr.stats.tx_heartbeat_errors = stats->tx_heartbeat_errors;
+ ovsr.stats.tx_window_errors = stats->tx_window_errors;
err = netdev_vport_do_ioctl(ODP_VPORT_STATS_SET, &ovsr);