#include "compat.h"
+/* Strings to describe the manufacturer, hardware, and software. This data
+ * is queriable through the version stats message. */
+static char mfr_desc[VERSION_STR_LEN] = "Nicira Networks";
+static char hw_desc[VERSION_STR_LEN] = "Reference Linux Kernel Module";
+static char sw_desc[VERSION_STR_LEN] = VERSION;
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+module_param_string(mfr_desc, mfr_desc, sizeof mfr_desc, 0444);
+module_param_string(hw_desc, hw_desc, sizeof hw_desc, 0444);
+module_param_string(sw_desc, sw_desc, sizeof sw_desc, 0444);
+#else
+MODULE_PARM(mfr_desc, "s");
+MODULE_PARM(hw_desc, "s");
+MODULE_PARM(sw_desc, "s");
+#endif
+
+
/* Number of milliseconds between runs of the maintenance thread. */
#define MAINT_SLEEP_MSECS 1000
case OFPP_IN_PORT:
/* Send it out the port it came in on, which is already set in
* the skb. */
- if (!skb->dev) {
+ if (!skb->dev) {
if (net_ratelimit())
printk("skb device not set forwarding to in_port\n");
kfree(skb);
[DP_GENL_A_DP_IDX] = { .type = NLA_U32 },
};
+static int version_stats_dump(struct datapath *dp, void *state,
+ void *body, int *body_len)
+{
+ struct ofp_version_stats *ovs = body;
+ int n_bytes = sizeof *ovs;
+
+ if (n_bytes > *body_len) {
+ return -ENOBUFS;
+ }
+ *body_len = n_bytes;
+
+ strncpy(ovs->mfr_desc, mfr_desc, sizeof ovs->mfr_desc);
+ strncpy(ovs->hw_desc, hw_desc, sizeof ovs->hw_desc);
+ strncpy(ovs->sw_desc, sw_desc, sizeof ovs->sw_desc);
+
+ return 0;
+}
+
struct flow_stats_state {
int table_idx;
struct sw_table_position position;
void *body, int *body_len)
{
struct ofp_table_stats *ots;
- int nbytes = dp->chain->n_tables * sizeof *ots;
+ int n_bytes = dp->chain->n_tables * sizeof *ots;
int i;
- if (nbytes > *body_len)
+ if (n_bytes > *body_len)
return -ENOBUFS;
- *body_len = nbytes;
+ *body_len = n_bytes;
for (i = 0, ots = body; i < dp->chain->n_tables; i++, ots++) {
struct sw_table_stats stats;
dp->chain->tables[i]->stats(dp->chain->tables[i], &stats);
stats = p->dev->get_stats(p->dev);
ops->port_no = htons(p->port_no);
memset(ops->pad, 0, sizeof ops->pad);
- ops->rx_count = cpu_to_be64(stats->rx_packets);
- ops->tx_count = cpu_to_be64(stats->tx_packets);
- ops->drop_count = cpu_to_be64(stats->rx_dropped
- + stats->tx_dropped);
+ ops->rx_packets = cpu_to_be64(stats->rx_packets);
+ ops->tx_packets = cpu_to_be64(stats->tx_packets);
+ ops->rx_bytes = cpu_to_be64(stats->rx_bytes);
+ ops->tx_bytes = cpu_to_be64(stats->tx_bytes);
+ ops->rx_dropped = cpu_to_be64(stats->rx_dropped);
+ ops->tx_dropped = cpu_to_be64(stats->tx_dropped);
+ ops->rx_errors = cpu_to_be64(stats->rx_errors);
+ ops->tx_errors = cpu_to_be64(stats->tx_errors);
+ ops->rx_frame_err = cpu_to_be64(stats->rx_frame_errors);
+ ops->rx_over_err = cpu_to_be64(stats->rx_over_errors);
+ ops->rx_crc_err = cpu_to_be64(stats->rx_crc_errors);
+ ops->collisions = cpu_to_be64(stats->collisions);
n_ports++;
ops++;
}
};
static const struct stats_type stats[] = {
+ [OFPST_VERSION] = {
+ 0,
+ 0,
+ NULL,
+ version_stats_dump,
+ NULL
+ },
[OFPST_FLOW] = {
sizeof(struct ofp_flow_stats_request),
sizeof(struct ofp_flow_stats_request),