lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1475066582-1971-6-git-send-email-simon.horman@netronome.com>
Date:   Wed, 28 Sep 2016 14:42:55 +0200
From:   Simon Horman <simon.horman@...ronome.com>
To:     netdev@...r.kernel.org, dev@...nvswitch.org
Cc:     Simon Horman <simon.horman@...ronome.com>
Subject: [PATCH/RFC 05/12] rocker: Support Open vSwitch (-like) flow stats

Prototype an implementation of the new switchdev_port_obj_get SDO for the
SWITCHDEV_OBJ_OVS_FLOW object type. This allows retrieval of
statistics for Open vSwitch (-like) flows which have been programmed into
hardware.

Signed-off-by: Simon Horman <simon.horman@...ronome.com>
---
 drivers/net/ethernet/rocker/rocker.h      |  2 ++
 drivers/net/ethernet/rocker/rocker_main.c | 30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/drivers/net/ethernet/rocker/rocker.h b/drivers/net/ethernet/rocker/rocker.h
index ebcc863fd25e..332adce701fa 100644
--- a/drivers/net/ethernet/rocker/rocker.h
+++ b/drivers/net/ethernet/rocker/rocker.h
@@ -122,6 +122,8 @@ struct rocker_world_ops {
 				    struct switchdev_trans *trans);
 	int (*port_obj_sw_flow_del)(struct rocker_port *rocker_port,
 				    const struct switchdev_obj_sw_flow *sw_flow);
+	int (*port_obj_sw_flow_get_stats)(struct rocker_port *rocker_port,
+					  const struct switchdev_obj_sw_flow *sw_flow);
 	int (*port_obj_fib4_add)(struct rocker_port *rocker_port,
 				 const struct switchdev_obj_ipv4_fib *fib4,
 				 struct switchdev_trans *trans);
diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c
index e019772689a6..6c6a486cced6 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -1703,6 +1703,16 @@ static int rocker_world_port_obj_sw_flow_del(struct rocker_port *rocker_port,
 	return wops->port_obj_sw_flow_del(rocker_port, sw_flow);
 }
 
+static int rocker_world_port_obj_sw_flow_get_stats(struct rocker_port *rocker_port,
+				const struct switchdev_obj_sw_flow *sw_flow)
+{
+	struct rocker_world_ops *wops = rocker_port->rocker->wops;
+
+	if (!wops->port_obj_sw_flow_get_stats)
+		return -EOPNOTSUPP;
+	return wops->port_obj_sw_flow_get_stats(rocker_port, sw_flow);
+}
+
 static int rocker_world_port_master_linked(struct rocker_port *rocker_port,
 					   struct net_device *master)
 {
@@ -2197,12 +2207,32 @@ static int rocker_port_obj_dump(struct net_device *dev,
 	return err;
 }
 
+static int rocker_port_obj_get(struct net_device *dev,
+			       struct switchdev_obj *obj)
+{
+	struct rocker_port *rocker_port = netdev_priv(dev);
+	int err = 0;
+
+	switch (obj->id) {
+	case SWITCHDEV_OBJ_SW_FLOW:
+		err = rocker_world_port_obj_sw_flow_get_stats(rocker_port,
+						 SWITCHDEV_OBJ_SW_FLOW(obj));
+		break;
+	default:
+		err = -EOPNOTSUPP;
+		break;
+	}
+
+	return err;
+}
+
 static const struct switchdev_ops rocker_port_switchdev_ops = {
 	.switchdev_port_attr_get	= rocker_port_attr_get,
 	.switchdev_port_attr_set	= rocker_port_attr_set,
 	.switchdev_port_obj_add		= rocker_port_obj_add,
 	.switchdev_port_obj_del		= rocker_port_obj_del,
 	.switchdev_port_obj_dump	= rocker_port_obj_dump,
+	.switchdev_port_obj_get		= rocker_port_obj_get,
 };
 
 /********************
-- 
2.7.0.rc3.207.g0ac5344

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ