All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mac80211: move out the non-statistics variable estab_plinks from mesh_stat
@ 2012-10-09 20:27 Ashok Nagarajan
  2012-10-09 20:27 ` [PATCH 2/2] [nl,cfg,mac]80211: Add nl80211 command to get mesh network statistics Ashok Nagarajan
  2012-10-10  9:02 ` [PATCH 1/2] mac80211: move out the non-statistics variable estab_plinks from mesh_stat Johannes Berg
  0 siblings, 2 replies; 10+ messages in thread
From: Ashok Nagarajan @ 2012-10-09 20:27 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, linville, javier, devel, Ashok Nagarajan

estab_plinks is not a statistics member. Hence move estab_plinks from
struct mesh_stat to struct ieee80211_if_mesh

Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
---
 net/mac80211/debugfs_netdev.c |    2 +-
 net/mac80211/ieee80211_i.h    |    2 +-
 net/mac80211/mesh.c           |    2 +-
 net/mac80211/mesh.h           |    2 +-
 net/mac80211/mesh_plink.c     |    4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 6d5aec9..34f0ca4 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -471,7 +471,7 @@ IEEE80211_IF_FILE(dropped_frames_congestion,
 		  u.mesh.mshstats.dropped_frames_congestion, DEC);
 IEEE80211_IF_FILE(dropped_frames_no_route,
 		  u.mesh.mshstats.dropped_frames_no_route, DEC);
-IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC);
+IEEE80211_IF_FILE(estab_plinks, u.mesh.estab_plinks, ATOMIC);
 
 /* Mesh parameters */
 IEEE80211_IF_FILE(dot11MeshMaxRetries,
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 8c80455..34f3cda 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -316,7 +316,6 @@ struct mesh_stats {
 	__u32 dropped_frames_ttl;	/* Not transmitted since mesh_ttl == 0*/
 	__u32 dropped_frames_no_route;	/* Not transmitted, no route found */
 	__u32 dropped_frames_congestion;/* Not forwarded due to congestion */
-	atomic_t estab_plinks;
 };
 
 #define PREQ_Q_F_START		0x1
@@ -599,6 +598,7 @@ struct ieee80211_if_mesh {
 	int preq_queue_len;
 	struct mesh_stats mshstats;
 	struct mesh_config mshcfg;
+	atomic_t estab_plinks;
 	u32 mesh_seqnum;
 	bool accepting_plinks;
 	int num_gates;
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index ff0296c..5cc7a91 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -264,7 +264,7 @@ mesh_add_meshconf_ie(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
 	/* Authentication Protocol identifier */
 	*pos++ = ifmsh->mesh_auth_id;
 	/* Mesh Formation Info - number of neighbors */
-	neighbors = atomic_read(&ifmsh->mshstats.estab_plinks);
+	neighbors = atomic_read(&ifmsh->estab_plinks);
 	/* Number of neighbor mesh STAs or 15 whichever is smaller */
 	neighbors = (neighbors > 15) ? 15 : neighbors;
 	*pos++ = neighbors << 1;
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 25d0f17..8334e94 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -324,7 +324,7 @@ extern int mesh_allocated;
 static inline int mesh_plink_free_count(struct ieee80211_sub_if_data *sdata)
 {
 	return sdata->u.mesh.mshcfg.dot11MeshMaxPeerLinks -
-	       atomic_read(&sdata->u.mesh.mshstats.estab_plinks);
+	       atomic_read(&sdata->u.mesh.estab_plinks);
 }
 
 static inline bool mesh_plink_availables(struct ieee80211_sub_if_data *sdata)
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 3ab34d8..0f45ac9 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -50,14 +50,14 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
 static inline
 u32 mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata)
 {
-	atomic_inc(&sdata->u.mesh.mshstats.estab_plinks);
+	atomic_inc(&sdata->u.mesh.estab_plinks);
 	return mesh_accept_plinks_update(sdata);
 }
 
 static inline
 u32 mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata)
 {
-	atomic_dec(&sdata->u.mesh.mshstats.estab_plinks);
+	atomic_dec(&sdata->u.mesh.estab_plinks);
 	return mesh_accept_plinks_update(sdata);
 }
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] [nl,cfg,mac]80211: Add nl80211 command to get mesh network statistics
  2012-10-09 20:27 [PATCH 1/2] mac80211: move out the non-statistics variable estab_plinks from mesh_stat Ashok Nagarajan
@ 2012-10-09 20:27 ` Ashok Nagarajan
  2012-10-10  1:31   ` [PATCH 2/2] [nl, cfg, mac]80211: " Yeoh Chun-Yeow
                     ` (2 more replies)
  2012-10-10  9:02 ` [PATCH 1/2] mac80211: move out the non-statistics variable estab_plinks from mesh_stat Johannes Berg
  1 sibling, 3 replies; 10+ messages in thread
From: Ashok Nagarajan @ 2012-10-09 20:27 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, linville, javier, devel, Ashok Nagarajan

The command NL80211_CMD_GET_MESH_STATS gets the statistical information about
the mesh network. Currently, the following statistics are provided:

1. Mesh forwarded multicast frames
2. Mesh forwarded unicast frames
3. Mesh total forwarded frames
4. Dropped frames due to mesh_ttl == 0
5. Dropped frames due to no route found
6. Dropped frames due to congestion

The attibute NL80211_ATTR_MESH_PARAMS enumerates the various mesh statistical
parameters. A new call back get_mesh_stats() is added. mesh_stats struct is
moved from mac80211/ieee80211_i.h to net/cfg80211.h.

Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
---
 include/linux/nl80211.h    |   40 ++++++++++++++++++++++++
 include/net/cfg80211.h     |   26 ++++++++++++++++
 net/mac80211/cfg.c         |   12 +++++++
 net/mac80211/ieee80211_i.h |    9 -----
 net/wireless/nl80211.c     |   71 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 149 insertions(+), 9 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 7df9b50..1a30195 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -578,6 +578,9 @@
  *	station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON
  *	is used for this.
  *
+ * @NL80211_CMD_GET_MESH_STATS: Get mesh networking statistics for the
+ *	interface identified by %NL80211_ATTR_IFINDEX
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -726,6 +729,8 @@ enum nl80211_commands {
 
 	NL80211_CMD_CONN_FAILED,
 
+	NL80211_CMD_GET_MESH_STATS,
+
 	/* add new commands above here */
 
 	/* used to define NL80211_CMD_MAX below */
@@ -1530,6 +1535,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_CONN_FAILED_REASON,
 
+	NL80211_ATTR_MESH_STATS,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -2188,6 +2195,39 @@ enum nl80211_mntr_flags {
 };
 
 /**
+ * enum nl80211_mesh_stats - mesh statisitics
+ *
+ * Provide statistical information about mesh.
+ *
+ * @__NL80211_MESH_STATS_INVALID: internal use
+ * @NL80211_MESH_STATS_FWDED_MCAST: specifies the number of mesh forwarded
+ *	multicast frames
+ * @NL80211_MESH_STATS_FWDED_UNICAST: specifies the number of mesh forwarded
+ *	unicast frames
+ * @NL80211_MESH_STATS_FWDED_FRAMES: specifies the total number of mesh
+ *	forwarded frames
+ * @NL80211_MESH_STATS_DROPPED_FRAMES_TTL: specifies the number of mesh frames
+ *	dropped since mesh_ttl == 0
+ * @NL80211_MESH_STATS_DROPPED_FRAMES_NO_ROUTE: specifies the number of mesh
+ *	frames dropped due to no route found
+ * @NL80211_MESH_STATS_DROPPED_FRAMES_CONGESTION: specifies the number of mesh
+ *	frames dropped due to congestion
+ */
+enum nl80211_mesh_stats {
+	__NL80211_MESH_STATS_INVALID,
+	NL80211_MESH_STATS_FWDED_MCAST,
+	NL80211_MESH_STATS_FWDED_UNICAST,
+	NL80211_MESH_STATS_FWDED_FRAMES,
+	NL80211_MESH_STATS_DROPPED_FRAMES_TTL,
+	NL80211_MESH_STATS_DROPPED_FRAMES_NO_ROUTE,
+	NL80211_MESH_STATS_DROPPED_FRAMES_CONGESTION,
+
+	/* keep last */
+	__NL80211_MESH_STATS_ATTR_AFTER_LAST,
+	NL80211_MESH_STATS_ATTR_MAX = __NL80211_MESH_STATS_ATTR_AFTER_LAST - 1
+};
+
+/**
  * enum nl80211_meshconf_params - mesh configuration parameters
  *
  * Mesh configuration parameters. These can be changed while the mesh is
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index ab78b53..1926502 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -815,6 +815,27 @@ struct bss_parameters {
 };
 
 /**
+ * struct mesh_stats - 802.11s mesh statistics
+ *
+ * Used to provide statistical information about mesh
+ *
+ * @fwded_mcast: Mesh forwarded multicast frames
+ * @fwded_unicast: Mesh forwarded unicast frames
+ * @fwded_frames: Mesh total forwarded frames
+ * @dropped_frames_ttl: Not transmitted since mesh_ttl == 0
+ * @dropped_frames_no_route: Not transmitted, no route found
+ * @dropped_frames_congestion: Not forwarded due to congestion
+ */
+struct mesh_stats {
+	u32 fwded_mcast;
+	u32 fwded_unicast;
+	u32 fwded_frames;
+	u32 dropped_frames_ttl;
+	u32 dropped_frames_no_route;
+	u32 dropped_frames_congestion;
+};
+
+/**
  * struct mesh_config - 802.11s mesh configuration
  *
  * These parameters can be changed while the mesh is active.
@@ -1492,6 +1513,8 @@ struct cfg80211_gtk_rekey_data {
  *
  * @get_mesh_config: Get the current mesh configuration
  *
+ * @get_mesh_stats: Get the current mesh statistics
+ *
  * @update_mesh_config: Update mesh parameters on a running mesh.
  *	The mask is a bitfield which tells us which parameters to
  *	set, and which to leave alone.
@@ -1688,6 +1711,9 @@ struct cfg80211_ops {
 	int	(*get_mesh_config)(struct wiphy *wiphy,
 				struct net_device *dev,
 				struct mesh_config *conf);
+	int	(*get_mesh_stats)(struct wiphy *wiphy,
+				  struct net_device *dev,
+				  struct mesh_stats *stats);
 	int	(*update_mesh_config)(struct wiphy *wiphy,
 				      struct net_device *dev, u32 mask,
 				      const struct mesh_config *nconf);
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 05f3a31..5af9260 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1496,6 +1496,17 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
 	return 0;
 }
 
+static int ieee80211_get_mesh_stats(struct wiphy *wiphy,
+				    struct net_device *dev,
+				    struct mesh_stats *stats)
+{
+	struct ieee80211_sub_if_data *sdata;
+	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+	memcpy(stats, &sdata->u.mesh.mshstats, sizeof(*stats));
+	return 0;
+}
+
 static int ieee80211_get_mesh_config(struct wiphy *wiphy,
 				struct net_device *dev,
 				struct mesh_config *conf)
@@ -3082,6 +3093,7 @@ struct cfg80211_ops mac80211_config_ops = {
 	.get_mpath = ieee80211_get_mpath,
 	.dump_mpath = ieee80211_dump_mpath,
 	.update_mesh_config = ieee80211_update_mesh_config,
+	.get_mesh_stats = ieee80211_get_mesh_stats,
 	.get_mesh_config = ieee80211_get_mesh_config,
 	.join_mesh = ieee80211_join_mesh,
 	.leave_mesh = ieee80211_leave_mesh,
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 34f3cda..c30be38 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -309,15 +309,6 @@ struct ieee80211_if_vlan {
 	struct sta_info __rcu *sta;
 };
 
-struct mesh_stats {
-	__u32 fwded_mcast;		/* Mesh forwarded multicast frames */
-	__u32 fwded_unicast;		/* Mesh forwarded unicast frames */
-	__u32 fwded_frames;		/* Mesh total forwarded frames */
-	__u32 dropped_frames_ttl;	/* Not transmitted since mesh_ttl == 0*/
-	__u32 dropped_frames_no_route;	/* Not transmitted, no route found */
-	__u32 dropped_frames_congestion;/* Not forwarded due to congestion */
-};
-
 #define PREQ_Q_F_START		0x1
 #define PREQ_Q_F_REFRESH	0x2
 struct mesh_preq_queue {
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f1047ae..279a106 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -275,6 +275,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
 					   .len = NL80211_MAX_SUPP_RATES },
 	[NL80211_ATTR_BSS_HT_OPMODE] = { .type = NLA_U16 },
 
+	[NL80211_ATTR_MESH_STATS] = { .type = NLA_NESTED },
 	[NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED },
 	[NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG },
 
@@ -3645,6 +3646,68 @@ static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info)
 	return r;
 }
 
+static int nl80211_get_mesh_stats(struct sk_buff *skb,
+				  struct genl_info *info)
+{
+	struct cfg80211_registered_device *rdev = info->user_ptr[0];
+	struct net_device *dev = info->user_ptr[1];
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+	struct mesh_stats cur_stats;
+	int err = 0;
+	void *hdr;
+	struct nlattr *pinfoattr;
+	struct sk_buff *msg;
+
+	if (wdev->iftype != NL80211_IFTYPE_MESH_POINT)
+		return -EOPNOTSUPP;
+
+	if (!rdev->ops->get_mesh_stats)
+		return -EOPNOTSUPP;
+
+	wdev_lock(wdev);
+
+	err = rdev->ops->get_mesh_stats(&rdev->wiphy, dev, &cur_stats);
+	wdev_unlock(wdev);
+
+	if (err)
+		return err;
+
+	/* Draw up a netlink message to send back */
+	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+	if (!msg)
+		return -ENOMEM;
+	hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
+			     NL80211_CMD_GET_MESH_STATS);
+	if (!hdr)
+		goto out;
+	pinfoattr = nla_nest_start(msg, NL80211_ATTR_MESH_STATS);
+	if (!pinfoattr)
+		goto nla_put_failure;
+	if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||
+	    nla_put_u32(msg, NL80211_MESH_STATS_FWDED_MCAST,
+			cur_stats.fwded_mcast) ||
+	    nla_put_u32(msg, NL80211_MESH_STATS_FWDED_UNICAST,
+			cur_stats.fwded_unicast) ||
+	    nla_put_u32(msg, NL80211_MESH_STATS_FWDED_FRAMES,
+			cur_stats.fwded_frames) ||
+	    nla_put_u32(msg, NL80211_MESH_STATS_DROPPED_FRAMES_TTL,
+			cur_stats.dropped_frames_ttl) ||
+	    nla_put_u32(msg, NL80211_MESH_STATS_DROPPED_FRAMES_NO_ROUTE,
+			cur_stats.dropped_frames_no_route) ||
+	    nla_put_u32(msg, NL80211_MESH_STATS_DROPPED_FRAMES_CONGESTION,
+			cur_stats.dropped_frames_congestion))
+		goto nla_put_failure;
+	nla_nest_end(msg, pinfoattr);
+	genlmsg_end(msg, hdr);
+	return genlmsg_reply(msg, info);
+
+ nla_put_failure:
+	genlmsg_cancel(msg, hdr);
+ out:
+	nlmsg_free(msg);
+	return -ENOBUFS;
+}
+
 static int nl80211_get_mesh_config(struct sk_buff *skb,
 				   struct genl_info *info)
 {
@@ -7202,6 +7265,14 @@ static struct genl_ops nl80211_ops[] = {
 		.flags = GENL_ADMIN_PERM,
 	},
 	{
+		.cmd = NL80211_CMD_GET_MESH_STATS,
+		.doit = nl80211_get_mesh_stats,
+		.policy = nl80211_policy,
+		/* can be retrieved by unprivileged users */
+		.internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
+				  NL80211_FLAG_NEED_RTNL,
+	},
+	{
 		.cmd = NL80211_CMD_GET_MESH_CONFIG,
 		.doit = nl80211_get_mesh_config,
 		.policy = nl80211_policy,
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] [nl, cfg, mac]80211: Add nl80211 command to get mesh network statistics
  2012-10-09 20:27 ` [PATCH 2/2] [nl,cfg,mac]80211: Add nl80211 command to get mesh network statistics Ashok Nagarajan
@ 2012-10-10  1:31   ` Yeoh Chun-Yeow
  2012-10-10  1:44     ` Ashok Nagarajan
  2012-10-10  1:49     ` Javier Cardona
  2012-10-10  9:05   ` [PATCH 2/2] [nl,cfg,mac]80211: " Johannes Berg
  2012-10-19 13:50   ` Johannes Berg
  2 siblings, 2 replies; 10+ messages in thread
From: Yeoh Chun-Yeow @ 2012-10-10  1:31 UTC (permalink / raw)
  To: devel; +Cc: linux-wireless, johannes, linville

Hi, Ashok

Mesh Total Forwarded Frames = Mesh Forwarded Unicast Frame + Mesh
Forwarded Multicast Frame

Am I right?

-----
Chun-Yeow

On Wed, Oct 10, 2012 at 4:27 AM, Ashok Nagarajan <ashok@cozybit.com> wrote:
> The command NL80211_CMD_GET_MESH_STATS gets the statistical information about
> the mesh network. Currently, the following statistics are provided:
>
> 1. Mesh forwarded multicast frames
> 2. Mesh forwarded unicast frames
> 3. Mesh total forwarded frames
> 4. Dropped frames due to mesh_ttl == 0
> 5. Dropped frames due to no route found
> 6. Dropped frames due to congestion
>
> The attibute NL80211_ATTR_MESH_PARAMS enumerates the various mesh statistical
> parameters. A new call back get_mesh_stats() is added. mesh_stats struct is
> moved from mac80211/ieee80211_i.h to net/cfg80211.h.
>
> Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
> ---
>  include/linux/nl80211.h    |   40 ++++++++++++++++++++++++
>  include/net/cfg80211.h     |   26 ++++++++++++++++
>  net/mac80211/cfg.c         |   12 +++++++
>  net/mac80211/ieee80211_i.h |    9 -----
>  net/wireless/nl80211.c     |   71 ++++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 149 insertions(+), 9 deletions(-)
>
> diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
> index 7df9b50..1a30195 100644
> --- a/include/linux/nl80211.h
> +++ b/include/linux/nl80211.h
> @@ -578,6 +578,9 @@
>   *     station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON
>   *     is used for this.
>   *
> + * @NL80211_CMD_GET_MESH_STATS: Get mesh networking statistics for the
> + *     interface identified by %NL80211_ATTR_IFINDEX
> + *
>   * @NL80211_CMD_MAX: highest used command number
>   * @__NL80211_CMD_AFTER_LAST: internal use
>   */
> @@ -726,6 +729,8 @@ enum nl80211_commands {
>
>         NL80211_CMD_CONN_FAILED,
>
> +       NL80211_CMD_GET_MESH_STATS,
> +
>         /* add new commands above here */
>
>         /* used to define NL80211_CMD_MAX below */
> @@ -1530,6 +1535,8 @@ enum nl80211_attrs {
>
>         NL80211_ATTR_CONN_FAILED_REASON,
>
> +       NL80211_ATTR_MESH_STATS,
> +
>         /* add attributes here, update the policy in nl80211.c */
>
>         __NL80211_ATTR_AFTER_LAST,
> @@ -2188,6 +2195,39 @@ enum nl80211_mntr_flags {
>  };
>
>  /**
> + * enum nl80211_mesh_stats - mesh statisitics
> + *
> + * Provide statistical information about mesh.
> + *
> + * @__NL80211_MESH_STATS_INVALID: internal use
> + * @NL80211_MESH_STATS_FWDED_MCAST: specifies the number of mesh forwarded
> + *     multicast frames
> + * @NL80211_MESH_STATS_FWDED_UNICAST: specifies the number of mesh forwarded
> + *     unicast frames
> + * @NL80211_MESH_STATS_FWDED_FRAMES: specifies the total number of mesh
> + *     forwarded frames
> + * @NL80211_MESH_STATS_DROPPED_FRAMES_TTL: specifies the number of mesh frames
> + *     dropped since mesh_ttl == 0
> + * @NL80211_MESH_STATS_DROPPED_FRAMES_NO_ROUTE: specifies the number of mesh
> + *     frames dropped due to no route found
> + * @NL80211_MESH_STATS_DROPPED_FRAMES_CONGESTION: specifies the number of mesh
> + *     frames dropped due to congestion
> + */
> +enum nl80211_mesh_stats {
> +       __NL80211_MESH_STATS_INVALID,
> +       NL80211_MESH_STATS_FWDED_MCAST,
> +       NL80211_MESH_STATS_FWDED_UNICAST,
> +       NL80211_MESH_STATS_FWDED_FRAMES,
> +       NL80211_MESH_STATS_DROPPED_FRAMES_TTL,
> +       NL80211_MESH_STATS_DROPPED_FRAMES_NO_ROUTE,
> +       NL80211_MESH_STATS_DROPPED_FRAMES_CONGESTION,
> +
> +       /* keep last */
> +       __NL80211_MESH_STATS_ATTR_AFTER_LAST,
> +       NL80211_MESH_STATS_ATTR_MAX = __NL80211_MESH_STATS_ATTR_AFTER_LAST - 1
> +};
> +
> +/**
>   * enum nl80211_meshconf_params - mesh configuration parameters
>   *
>   * Mesh configuration parameters. These can be changed while the mesh is
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index ab78b53..1926502 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -815,6 +815,27 @@ struct bss_parameters {
>  };
>
>  /**
> + * struct mesh_stats - 802.11s mesh statistics
> + *
> + * Used to provide statistical information about mesh
> + *
> + * @fwded_mcast: Mesh forwarded multicast frames
> + * @fwded_unicast: Mesh forwarded unicast frames
> + * @fwded_frames: Mesh total forwarded frames
> + * @dropped_frames_ttl: Not transmitted since mesh_ttl == 0
> + * @dropped_frames_no_route: Not transmitted, no route found
> + * @dropped_frames_congestion: Not forwarded due to congestion
> + */
> +struct mesh_stats {
> +       u32 fwded_mcast;
> +       u32 fwded_unicast;
> +       u32 fwded_frames;
> +       u32 dropped_frames_ttl;
> +       u32 dropped_frames_no_route;
> +       u32 dropped_frames_congestion;
> +};
> +
> +/**
>   * struct mesh_config - 802.11s mesh configuration
>   *
>   * These parameters can be changed while the mesh is active.
> @@ -1492,6 +1513,8 @@ struct cfg80211_gtk_rekey_data {
>   *
>   * @get_mesh_config: Get the current mesh configuration
>   *
> + * @get_mesh_stats: Get the current mesh statistics
> + *
>   * @update_mesh_config: Update mesh parameters on a running mesh.
>   *     The mask is a bitfield which tells us which parameters to
>   *     set, and which to leave alone.
> @@ -1688,6 +1711,9 @@ struct cfg80211_ops {
>         int     (*get_mesh_config)(struct wiphy *wiphy,
>                                 struct net_device *dev,
>                                 struct mesh_config *conf);
> +       int     (*get_mesh_stats)(struct wiphy *wiphy,
> +                                 struct net_device *dev,
> +                                 struct mesh_stats *stats);
>         int     (*update_mesh_config)(struct wiphy *wiphy,
>                                       struct net_device *dev, u32 mask,
>                                       const struct mesh_config *nconf);
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 05f3a31..5af9260 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -1496,6 +1496,17 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
>         return 0;
>  }
>
> +static int ieee80211_get_mesh_stats(struct wiphy *wiphy,
> +                                   struct net_device *dev,
> +                                   struct mesh_stats *stats)
> +{
> +       struct ieee80211_sub_if_data *sdata;
> +       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
> +
> +       memcpy(stats, &sdata->u.mesh.mshstats, sizeof(*stats));
> +       return 0;
> +}
> +
>  static int ieee80211_get_mesh_config(struct wiphy *wiphy,
>                                 struct net_device *dev,
>                                 struct mesh_config *conf)
> @@ -3082,6 +3093,7 @@ struct cfg80211_ops mac80211_config_ops = {
>         .get_mpath = ieee80211_get_mpath,
>         .dump_mpath = ieee80211_dump_mpath,
>         .update_mesh_config = ieee80211_update_mesh_config,
> +       .get_mesh_stats = ieee80211_get_mesh_stats,
>         .get_mesh_config = ieee80211_get_mesh_config,
>         .join_mesh = ieee80211_join_mesh,
>         .leave_mesh = ieee80211_leave_mesh,
> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
> index 34f3cda..c30be38 100644
> --- a/net/mac80211/ieee80211_i.h
> +++ b/net/mac80211/ieee80211_i.h
> @@ -309,15 +309,6 @@ struct ieee80211_if_vlan {
>         struct sta_info __rcu *sta;
>  };
>
> -struct mesh_stats {
> -       __u32 fwded_mcast;              /* Mesh forwarded multicast frames */
> -       __u32 fwded_unicast;            /* Mesh forwarded unicast frames */
> -       __u32 fwded_frames;             /* Mesh total forwarded frames */
> -       __u32 dropped_frames_ttl;       /* Not transmitted since mesh_ttl == 0*/
> -       __u32 dropped_frames_no_route;  /* Not transmitted, no route found */
> -       __u32 dropped_frames_congestion;/* Not forwarded due to congestion */
> -};
> -
>  #define PREQ_Q_F_START         0x1
>  #define PREQ_Q_F_REFRESH       0x2
>  struct mesh_preq_queue {
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index f1047ae..279a106 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -275,6 +275,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
>                                            .len = NL80211_MAX_SUPP_RATES },
>         [NL80211_ATTR_BSS_HT_OPMODE] = { .type = NLA_U16 },
>
> +       [NL80211_ATTR_MESH_STATS] = { .type = NLA_NESTED },
>         [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED },
>         [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG },
>
> @@ -3645,6 +3646,68 @@ static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info)
>         return r;
>  }
>
> +static int nl80211_get_mesh_stats(struct sk_buff *skb,
> +                                 struct genl_info *info)
> +{
> +       struct cfg80211_registered_device *rdev = info->user_ptr[0];
> +       struct net_device *dev = info->user_ptr[1];
> +       struct wireless_dev *wdev = dev->ieee80211_ptr;
> +       struct mesh_stats cur_stats;
> +       int err = 0;
> +       void *hdr;
> +       struct nlattr *pinfoattr;
> +       struct sk_buff *msg;
> +
> +       if (wdev->iftype != NL80211_IFTYPE_MESH_POINT)
> +               return -EOPNOTSUPP;
> +
> +       if (!rdev->ops->get_mesh_stats)
> +               return -EOPNOTSUPP;
> +
> +       wdev_lock(wdev);
> +
> +       err = rdev->ops->get_mesh_stats(&rdev->wiphy, dev, &cur_stats);
> +       wdev_unlock(wdev);
> +
> +       if (err)
> +               return err;
> +
> +       /* Draw up a netlink message to send back */
> +       msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
> +       if (!msg)
> +               return -ENOMEM;
> +       hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
> +                            NL80211_CMD_GET_MESH_STATS);
> +       if (!hdr)
> +               goto out;
> +       pinfoattr = nla_nest_start(msg, NL80211_ATTR_MESH_STATS);
> +       if (!pinfoattr)
> +               goto nla_put_failure;
> +       if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||
> +           nla_put_u32(msg, NL80211_MESH_STATS_FWDED_MCAST,
> +                       cur_stats.fwded_mcast) ||
> +           nla_put_u32(msg, NL80211_MESH_STATS_FWDED_UNICAST,
> +                       cur_stats.fwded_unicast) ||
> +           nla_put_u32(msg, NL80211_MESH_STATS_FWDED_FRAMES,
> +                       cur_stats.fwded_frames) ||
> +           nla_put_u32(msg, NL80211_MESH_STATS_DROPPED_FRAMES_TTL,
> +                       cur_stats.dropped_frames_ttl) ||
> +           nla_put_u32(msg, NL80211_MESH_STATS_DROPPED_FRAMES_NO_ROUTE,
> +                       cur_stats.dropped_frames_no_route) ||
> +           nla_put_u32(msg, NL80211_MESH_STATS_DROPPED_FRAMES_CONGESTION,
> +                       cur_stats.dropped_frames_congestion))
> +               goto nla_put_failure;
> +       nla_nest_end(msg, pinfoattr);
> +       genlmsg_end(msg, hdr);
> +       return genlmsg_reply(msg, info);
> +
> + nla_put_failure:
> +       genlmsg_cancel(msg, hdr);
> + out:
> +       nlmsg_free(msg);
> +       return -ENOBUFS;
> +}
> +
>  static int nl80211_get_mesh_config(struct sk_buff *skb,
>                                    struct genl_info *info)
>  {
> @@ -7202,6 +7265,14 @@ static struct genl_ops nl80211_ops[] = {
>                 .flags = GENL_ADMIN_PERM,
>         },
>         {
> +               .cmd = NL80211_CMD_GET_MESH_STATS,
> +               .doit = nl80211_get_mesh_stats,
> +               .policy = nl80211_policy,
> +               /* can be retrieved by unprivileged users */
> +               .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
> +                                 NL80211_FLAG_NEED_RTNL,
> +       },
> +       {
>                 .cmd = NL80211_CMD_GET_MESH_CONFIG,
>                 .doit = nl80211_get_mesh_config,
>                 .policy = nl80211_policy,
> --
> 1.7.5.4
>
> _______________________________________________
> Devel mailing list
> Devel@lists.open80211s.org
> http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] [nl, cfg, mac]80211: Add nl80211 command to get mesh network statistics
  2012-10-10  1:31   ` [PATCH 2/2] [nl, cfg, mac]80211: " Yeoh Chun-Yeow
@ 2012-10-10  1:44     ` Ashok Nagarajan
  2012-10-10  1:49     ` Javier Cardona
  1 sibling, 0 replies; 10+ messages in thread
From: Ashok Nagarajan @ 2012-10-10  1:44 UTC (permalink / raw)
  To: devel; +Cc: johannes, linux-wireless, linville

Hello Yeoh,


On Tue, Oct 9, 2012 at 6:31 PM, Yeoh Chun-Yeow <yeohchunyeow@gmail.com> wrote:
> Hi, Ashok
>
> Mesh Total Forwarded Frames = Mesh Forwarded Unicast Frame + Mesh
> Forwarded Multicast Frame
>
> Am I right?
>
Yes, you are correct.
> -----
> Chun-Yeow
>
> On Wed, Oct 10, 2012 at 4:27 AM, Ashok Nagarajan <ashok@cozybit.com> wrote:
>> The command NL80211_CMD_GET_MESH_STATS gets the statistical information about
>> the mesh network. Currently, the following statistics are provided:
>>
>> 1. Mesh forwarded multicast frames
>> 2. Mesh forwarded unicast frames
>> 3. Mesh total forwarded frames
>> 4. Dropped frames due to mesh_ttl == 0
>> 5. Dropped frames due to no route found
>> 6. Dropped frames due to congestion
>>
>> The attibute NL80211_ATTR_MESH_PARAMS enumerates the various mesh statistical
>> parameters. A new call back get_mesh_stats() is added. mesh_stats struct is
>> moved from mac80211/ieee80211_i.h to net/cfg80211.h.
>>
>> Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
>> ---
>>  include/linux/nl80211.h    |   40 ++++++++++++++++++++++++
>>  include/net/cfg80211.h     |   26 ++++++++++++++++
>>  net/mac80211/cfg.c         |   12 +++++++
>>  net/mac80211/ieee80211_i.h |    9 -----
>>  net/wireless/nl80211.c     |   71 ++++++++++++++++++++++++++++++++++++++++++++
>>  5 files changed, 149 insertions(+), 9 deletions(-)
>>
>> diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
>> index 7df9b50..1a30195 100644
>> --- a/include/linux/nl80211.h
>> +++ b/include/linux/nl80211.h
>> @@ -578,6 +578,9 @@
>>   *     station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON
>>   *     is used for this.
>>   *
>> + * @NL80211_CMD_GET_MESH_STATS: Get mesh networking statistics for the
>> + *     interface identified by %NL80211_ATTR_IFINDEX
>> + *
>>   * @NL80211_CMD_MAX: highest used command number
>>   * @__NL80211_CMD_AFTER_LAST: internal use
>>   */
>> @@ -726,6 +729,8 @@ enum nl80211_commands {
>>
>>         NL80211_CMD_CONN_FAILED,
>>
>> +       NL80211_CMD_GET_MESH_STATS,
>> +
>>         /* add new commands above here */
>>
>>         /* used to define NL80211_CMD_MAX below */
>> @@ -1530,6 +1535,8 @@ enum nl80211_attrs {
>>
>>         NL80211_ATTR_CONN_FAILED_REASON,
>>
>> +       NL80211_ATTR_MESH_STATS,
>> +
>>         /* add attributes here, update the policy in nl80211.c */
>>
>>         __NL80211_ATTR_AFTER_LAST,
>> @@ -2188,6 +2195,39 @@ enum nl80211_mntr_flags {
>>  };
>>
>>  /**
>> + * enum nl80211_mesh_stats - mesh statisitics
>> + *
>> + * Provide statistical information about mesh.
>> + *
>> + * @__NL80211_MESH_STATS_INVALID: internal use
>> + * @NL80211_MESH_STATS_FWDED_MCAST: specifies the number of mesh forwarded
>> + *     multicast frames
>> + * @NL80211_MESH_STATS_FWDED_UNICAST: specifies the number of mesh forwarded
>> + *     unicast frames
>> + * @NL80211_MESH_STATS_FWDED_FRAMES: specifies the total number of mesh
>> + *     forwarded frames
>> + * @NL80211_MESH_STATS_DROPPED_FRAMES_TTL: specifies the number of mesh frames
>> + *     dropped since mesh_ttl == 0
>> + * @NL80211_MESH_STATS_DROPPED_FRAMES_NO_ROUTE: specifies the number of mesh
>> + *     frames dropped due to no route found
>> + * @NL80211_MESH_STATS_DROPPED_FRAMES_CONGESTION: specifies the number of mesh
>> + *     frames dropped due to congestion
>> + */
>> +enum nl80211_mesh_stats {
>> +       __NL80211_MESH_STATS_INVALID,
>> +       NL80211_MESH_STATS_FWDED_MCAST,
>> +       NL80211_MESH_STATS_FWDED_UNICAST,
>> +       NL80211_MESH_STATS_FWDED_FRAMES,
>> +       NL80211_MESH_STATS_DROPPED_FRAMES_TTL,
>> +       NL80211_MESH_STATS_DROPPED_FRAMES_NO_ROUTE,
>> +       NL80211_MESH_STATS_DROPPED_FRAMES_CONGESTION,
>> +
>> +       /* keep last */
>> +       __NL80211_MESH_STATS_ATTR_AFTER_LAST,
>> +       NL80211_MESH_STATS_ATTR_MAX = __NL80211_MESH_STATS_ATTR_AFTER_LAST - 1
>> +};
>> +
>> +/**
>>   * enum nl80211_meshconf_params - mesh configuration parameters
>>   *
>>   * Mesh configuration parameters. These can be changed while the mesh is
>> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
>> index ab78b53..1926502 100644
>> --- a/include/net/cfg80211.h
>> +++ b/include/net/cfg80211.h
>> @@ -815,6 +815,27 @@ struct bss_parameters {
>>  };
>>
>>  /**
>> + * struct mesh_stats - 802.11s mesh statistics
>> + *
>> + * Used to provide statistical information about mesh
>> + *
>> + * @fwded_mcast: Mesh forwarded multicast frames
>> + * @fwded_unicast: Mesh forwarded unicast frames
>> + * @fwded_frames: Mesh total forwarded frames
>> + * @dropped_frames_ttl: Not transmitted since mesh_ttl == 0
>> + * @dropped_frames_no_route: Not transmitted, no route found
>> + * @dropped_frames_congestion: Not forwarded due to congestion
>> + */
>> +struct mesh_stats {
>> +       u32 fwded_mcast;
>> +       u32 fwded_unicast;
>> +       u32 fwded_frames;
>> +       u32 dropped_frames_ttl;
>> +       u32 dropped_frames_no_route;
>> +       u32 dropped_frames_congestion;
>> +};
>> +
>> +/**
>>   * struct mesh_config - 802.11s mesh configuration
>>   *
>>   * These parameters can be changed while the mesh is active.
>> @@ -1492,6 +1513,8 @@ struct cfg80211_gtk_rekey_data {
>>   *
>>   * @get_mesh_config: Get the current mesh configuration
>>   *
>> + * @get_mesh_stats: Get the current mesh statistics
>> + *
>>   * @update_mesh_config: Update mesh parameters on a running mesh.
>>   *     The mask is a bitfield which tells us which parameters to
>>   *     set, and which to leave alone.
>> @@ -1688,6 +1711,9 @@ struct cfg80211_ops {
>>         int     (*get_mesh_config)(struct wiphy *wiphy,
>>                                 struct net_device *dev,
>>                                 struct mesh_config *conf);
>> +       int     (*get_mesh_stats)(struct wiphy *wiphy,
>> +                                 struct net_device *dev,
>> +                                 struct mesh_stats *stats);
>>         int     (*update_mesh_config)(struct wiphy *wiphy,
>>                                       struct net_device *dev, u32 mask,
>>                                       const struct mesh_config *nconf);
>> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
>> index 05f3a31..5af9260 100644
>> --- a/net/mac80211/cfg.c
>> +++ b/net/mac80211/cfg.c
>> @@ -1496,6 +1496,17 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
>>         return 0;
>>  }
>>
>> +static int ieee80211_get_mesh_stats(struct wiphy *wiphy,
>> +                                   struct net_device *dev,
>> +                                   struct mesh_stats *stats)
>> +{
>> +       struct ieee80211_sub_if_data *sdata;
>> +       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
>> +
>> +       memcpy(stats, &sdata->u.mesh.mshstats, sizeof(*stats));
>> +       return 0;
>> +}
>> +
>>  static int ieee80211_get_mesh_config(struct wiphy *wiphy,
>>                                 struct net_device *dev,
>>                                 struct mesh_config *conf)
>> @@ -3082,6 +3093,7 @@ struct cfg80211_ops mac80211_config_ops = {
>>         .get_mpath = ieee80211_get_mpath,
>>         .dump_mpath = ieee80211_dump_mpath,
>>         .update_mesh_config = ieee80211_update_mesh_config,
>> +       .get_mesh_stats = ieee80211_get_mesh_stats,
>>         .get_mesh_config = ieee80211_get_mesh_config,
>>         .join_mesh = ieee80211_join_mesh,
>>         .leave_mesh = ieee80211_leave_mesh,
>> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
>> index 34f3cda..c30be38 100644
>> --- a/net/mac80211/ieee80211_i.h
>> +++ b/net/mac80211/ieee80211_i.h
>> @@ -309,15 +309,6 @@ struct ieee80211_if_vlan {
>>         struct sta_info __rcu *sta;
>>  };
>>
>> -struct mesh_stats {
>> -       __u32 fwded_mcast;              /* Mesh forwarded multicast frames */
>> -       __u32 fwded_unicast;            /* Mesh forwarded unicast frames */
>> -       __u32 fwded_frames;             /* Mesh total forwarded frames */
>> -       __u32 dropped_frames_ttl;       /* Not transmitted since mesh_ttl == 0*/
>> -       __u32 dropped_frames_no_route;  /* Not transmitted, no route found */
>> -       __u32 dropped_frames_congestion;/* Not forwarded due to congestion */
>> -};
>> -
>>  #define PREQ_Q_F_START         0x1
>>  #define PREQ_Q_F_REFRESH       0x2
>>  struct mesh_preq_queue {
>> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
>> index f1047ae..279a106 100644
>> --- a/net/wireless/nl80211.c
>> +++ b/net/wireless/nl80211.c
>> @@ -275,6 +275,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
>>                                            .len = NL80211_MAX_SUPP_RATES },
>>         [NL80211_ATTR_BSS_HT_OPMODE] = { .type = NLA_U16 },
>>
>> +       [NL80211_ATTR_MESH_STATS] = { .type = NLA_NESTED },
>>         [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED },
>>         [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG },
>>
>> @@ -3645,6 +3646,68 @@ static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info)
>>         return r;
>>  }
>>
>> +static int nl80211_get_mesh_stats(struct sk_buff *skb,
>> +                                 struct genl_info *info)
>> +{
>> +       struct cfg80211_registered_device *rdev = info->user_ptr[0];
>> +       struct net_device *dev = info->user_ptr[1];
>> +       struct wireless_dev *wdev = dev->ieee80211_ptr;
>> +       struct mesh_stats cur_stats;
>> +       int err = 0;
>> +       void *hdr;
>> +       struct nlattr *pinfoattr;
>> +       struct sk_buff *msg;
>> +
>> +       if (wdev->iftype != NL80211_IFTYPE_MESH_POINT)
>> +               return -EOPNOTSUPP;
>> +
>> +       if (!rdev->ops->get_mesh_stats)
>> +               return -EOPNOTSUPP;
>> +
>> +       wdev_lock(wdev);
>> +
>> +       err = rdev->ops->get_mesh_stats(&rdev->wiphy, dev, &cur_stats);
>> +       wdev_unlock(wdev);
>> +
>> +       if (err)
>> +               return err;
>> +
>> +       /* Draw up a netlink message to send back */
>> +       msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
>> +       if (!msg)
>> +               return -ENOMEM;
>> +       hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
>> +                            NL80211_CMD_GET_MESH_STATS);
>> +       if (!hdr)
>> +               goto out;
>> +       pinfoattr = nla_nest_start(msg, NL80211_ATTR_MESH_STATS);
>> +       if (!pinfoattr)
>> +               goto nla_put_failure;
>> +       if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||
>> +           nla_put_u32(msg, NL80211_MESH_STATS_FWDED_MCAST,
>> +                       cur_stats.fwded_mcast) ||
>> +           nla_put_u32(msg, NL80211_MESH_STATS_FWDED_UNICAST,
>> +                       cur_stats.fwded_unicast) ||
>> +           nla_put_u32(msg, NL80211_MESH_STATS_FWDED_FRAMES,
>> +                       cur_stats.fwded_frames) ||
>> +           nla_put_u32(msg, NL80211_MESH_STATS_DROPPED_FRAMES_TTL,
>> +                       cur_stats.dropped_frames_ttl) ||
>> +           nla_put_u32(msg, NL80211_MESH_STATS_DROPPED_FRAMES_NO_ROUTE,
>> +                       cur_stats.dropped_frames_no_route) ||
>> +           nla_put_u32(msg, NL80211_MESH_STATS_DROPPED_FRAMES_CONGESTION,
>> +                       cur_stats.dropped_frames_congestion))
>> +               goto nla_put_failure;
>> +       nla_nest_end(msg, pinfoattr);
>> +       genlmsg_end(msg, hdr);
>> +       return genlmsg_reply(msg, info);
>> +
>> + nla_put_failure:
>> +       genlmsg_cancel(msg, hdr);
>> + out:
>> +       nlmsg_free(msg);
>> +       return -ENOBUFS;
>> +}
>> +
>>  static int nl80211_get_mesh_config(struct sk_buff *skb,
>>                                    struct genl_info *info)
>>  {
>> @@ -7202,6 +7265,14 @@ static struct genl_ops nl80211_ops[] = {
>>                 .flags = GENL_ADMIN_PERM,
>>         },
>>         {
>> +               .cmd = NL80211_CMD_GET_MESH_STATS,
>> +               .doit = nl80211_get_mesh_stats,
>> +               .policy = nl80211_policy,
>> +               /* can be retrieved by unprivileged users */
>> +               .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
>> +                                 NL80211_FLAG_NEED_RTNL,
>> +       },
>> +       {
>>                 .cmd = NL80211_CMD_GET_MESH_CONFIG,
>>                 .doit = nl80211_get_mesh_config,
>>                 .policy = nl80211_policy,
>> --
>> 1.7.5.4
>>
>> _______________________________________________
>> Devel mailing list
>> Devel@lists.open80211s.org
>> http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel
> _______________________________________________
> Devel mailing list
> Devel@lists.open80211s.org
> http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] [nl, cfg, mac]80211: Add nl80211 command to get mesh network statistics
  2012-10-10  1:31   ` [PATCH 2/2] [nl, cfg, mac]80211: " Yeoh Chun-Yeow
  2012-10-10  1:44     ` Ashok Nagarajan
@ 2012-10-10  1:49     ` Javier Cardona
  1 sibling, 0 replies; 10+ messages in thread
From: Javier Cardona @ 2012-10-10  1:49 UTC (permalink / raw)
  To: devel; +Cc: johannes, linux-wireless, linville

Hi Chun-Yeow,

On Tue, Oct 9, 2012 at 6:31 PM, Yeoh Chun-Yeow <yeohchunyeow@gmail.com> wrote:
> Hi, Ashok
>
> Mesh Total Forwarded Frames = Mesh Forwarded Unicast Frame + Mesh
> Forwarded Multicast Frame
>
> Am I right?

Keep in mind that the patch does not modify those stats, just provides
a different way to access them from userspace.
These same stats are accessible today via debugfs:

grep -H . /sys/kernel/debug/ieee80211/phy1/netdev\:mesh1/mesh_stats/*
| grep fwded
/sys/kernel/debug/ieee80211/phy1/netdev:mesh1/mesh_stats/fwded_frames:2039
/sys/kernel/debug/ieee80211/phy1/netdev:mesh1/mesh_stats/fwded_mcast:13
/sys/kernel/debug/ieee80211/phy1/netdev:mesh1/mesh_stats/fwded_unicast:2026

Cheers,

Javier

> -----
> Chun-Yeow
>
> On Wed, Oct 10, 2012 at 4:27 AM, Ashok Nagarajan <ashok@cozybit.com> wrote:
>> The command NL80211_CMD_GET_MESH_STATS gets the statistical information about
>> the mesh network. Currently, the following statistics are provided:
>>
>> 1. Mesh forwarded multicast frames
>> 2. Mesh forwarded unicast frames
>> 3. Mesh total forwarded frames
>> 4. Dropped frames due to mesh_ttl == 0
>> 5. Dropped frames due to no route found
>> 6. Dropped frames due to congestion
>>
>> The attibute NL80211_ATTR_MESH_PARAMS enumerates the various mesh statistical
>> parameters. A new call back get_mesh_stats() is added. mesh_stats struct is
>> moved from mac80211/ieee80211_i.h to net/cfg80211.h.
>>
>> Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
>> ---
>>  include/linux/nl80211.h    |   40 ++++++++++++++++++++++++
>>  include/net/cfg80211.h     |   26 ++++++++++++++++
>>  net/mac80211/cfg.c         |   12 +++++++
>>  net/mac80211/ieee80211_i.h |    9 -----
>>  net/wireless/nl80211.c     |   71 ++++++++++++++++++++++++++++++++++++++++++++
>>  5 files changed, 149 insertions(+), 9 deletions(-)
>>
>> diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
>> index 7df9b50..1a30195 100644
>> --- a/include/linux/nl80211.h
>> +++ b/include/linux/nl80211.h
>> @@ -578,6 +578,9 @@
>>   *     station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON
>>   *     is used for this.
>>   *
>> + * @NL80211_CMD_GET_MESH_STATS: Get mesh networking statistics for the
>> + *     interface identified by %NL80211_ATTR_IFINDEX
>> + *
>>   * @NL80211_CMD_MAX: highest used command number
>>   * @__NL80211_CMD_AFTER_LAST: internal use
>>   */
>> @@ -726,6 +729,8 @@ enum nl80211_commands {
>>
>>         NL80211_CMD_CONN_FAILED,
>>
>> +       NL80211_CMD_GET_MESH_STATS,
>> +
>>         /* add new commands above here */
>>
>>         /* used to define NL80211_CMD_MAX below */
>> @@ -1530,6 +1535,8 @@ enum nl80211_attrs {
>>
>>         NL80211_ATTR_CONN_FAILED_REASON,
>>
>> +       NL80211_ATTR_MESH_STATS,
>> +
>>         /* add attributes here, update the policy in nl80211.c */
>>
>>         __NL80211_ATTR_AFTER_LAST,
>> @@ -2188,6 +2195,39 @@ enum nl80211_mntr_flags {
>>  };
>>
>>  /**
>> + * enum nl80211_mesh_stats - mesh statisitics
>> + *
>> + * Provide statistical information about mesh.
>> + *
>> + * @__NL80211_MESH_STATS_INVALID: internal use
>> + * @NL80211_MESH_STATS_FWDED_MCAST: specifies the number of mesh forwarded
>> + *     multicast frames
>> + * @NL80211_MESH_STATS_FWDED_UNICAST: specifies the number of mesh forwarded
>> + *     unicast frames
>> + * @NL80211_MESH_STATS_FWDED_FRAMES: specifies the total number of mesh
>> + *     forwarded frames
>> + * @NL80211_MESH_STATS_DROPPED_FRAMES_TTL: specifies the number of mesh frames
>> + *     dropped since mesh_ttl == 0
>> + * @NL80211_MESH_STATS_DROPPED_FRAMES_NO_ROUTE: specifies the number of mesh
>> + *     frames dropped due to no route found
>> + * @NL80211_MESH_STATS_DROPPED_FRAMES_CONGESTION: specifies the number of mesh
>> + *     frames dropped due to congestion
>> + */
>> +enum nl80211_mesh_stats {
>> +       __NL80211_MESH_STATS_INVALID,
>> +       NL80211_MESH_STATS_FWDED_MCAST,
>> +       NL80211_MESH_STATS_FWDED_UNICAST,
>> +       NL80211_MESH_STATS_FWDED_FRAMES,
>> +       NL80211_MESH_STATS_DROPPED_FRAMES_TTL,
>> +       NL80211_MESH_STATS_DROPPED_FRAMES_NO_ROUTE,
>> +       NL80211_MESH_STATS_DROPPED_FRAMES_CONGESTION,
>> +
>> +       /* keep last */
>> +       __NL80211_MESH_STATS_ATTR_AFTER_LAST,
>> +       NL80211_MESH_STATS_ATTR_MAX = __NL80211_MESH_STATS_ATTR_AFTER_LAST - 1
>> +};
>> +
>> +/**
>>   * enum nl80211_meshconf_params - mesh configuration parameters
>>   *
>>   * Mesh configuration parameters. These can be changed while the mesh is
>> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
>> index ab78b53..1926502 100644
>> --- a/include/net/cfg80211.h
>> +++ b/include/net/cfg80211.h
>> @@ -815,6 +815,27 @@ struct bss_parameters {
>>  };
>>
>>  /**
>> + * struct mesh_stats - 802.11s mesh statistics
>> + *
>> + * Used to provide statistical information about mesh
>> + *
>> + * @fwded_mcast: Mesh forwarded multicast frames
>> + * @fwded_unicast: Mesh forwarded unicast frames
>> + * @fwded_frames: Mesh total forwarded frames
>> + * @dropped_frames_ttl: Not transmitted since mesh_ttl == 0
>> + * @dropped_frames_no_route: Not transmitted, no route found
>> + * @dropped_frames_congestion: Not forwarded due to congestion
>> + */
>> +struct mesh_stats {
>> +       u32 fwded_mcast;
>> +       u32 fwded_unicast;
>> +       u32 fwded_frames;
>> +       u32 dropped_frames_ttl;
>> +       u32 dropped_frames_no_route;
>> +       u32 dropped_frames_congestion;
>> +};
>> +
>> +/**
>>   * struct mesh_config - 802.11s mesh configuration
>>   *
>>   * These parameters can be changed while the mesh is active.
>> @@ -1492,6 +1513,8 @@ struct cfg80211_gtk_rekey_data {
>>   *
>>   * @get_mesh_config: Get the current mesh configuration
>>   *
>> + * @get_mesh_stats: Get the current mesh statistics
>> + *
>>   * @update_mesh_config: Update mesh parameters on a running mesh.
>>   *     The mask is a bitfield which tells us which parameters to
>>   *     set, and which to leave alone.
>> @@ -1688,6 +1711,9 @@ struct cfg80211_ops {
>>         int     (*get_mesh_config)(struct wiphy *wiphy,
>>                                 struct net_device *dev,
>>                                 struct mesh_config *conf);
>> +       int     (*get_mesh_stats)(struct wiphy *wiphy,
>> +                                 struct net_device *dev,
>> +                                 struct mesh_stats *stats);
>>         int     (*update_mesh_config)(struct wiphy *wiphy,
>>                                       struct net_device *dev, u32 mask,
>>                                       const struct mesh_config *nconf);
>> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
>> index 05f3a31..5af9260 100644
>> --- a/net/mac80211/cfg.c
>> +++ b/net/mac80211/cfg.c
>> @@ -1496,6 +1496,17 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
>>         return 0;
>>  }
>>
>> +static int ieee80211_get_mesh_stats(struct wiphy *wiphy,
>> +                                   struct net_device *dev,
>> +                                   struct mesh_stats *stats)
>> +{
>> +       struct ieee80211_sub_if_data *sdata;
>> +       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
>> +
>> +       memcpy(stats, &sdata->u.mesh.mshstats, sizeof(*stats));
>> +       return 0;
>> +}
>> +
>>  static int ieee80211_get_mesh_config(struct wiphy *wiphy,
>>                                 struct net_device *dev,
>>                                 struct mesh_config *conf)
>> @@ -3082,6 +3093,7 @@ struct cfg80211_ops mac80211_config_ops = {
>>         .get_mpath = ieee80211_get_mpath,
>>         .dump_mpath = ieee80211_dump_mpath,
>>         .update_mesh_config = ieee80211_update_mesh_config,
>> +       .get_mesh_stats = ieee80211_get_mesh_stats,
>>         .get_mesh_config = ieee80211_get_mesh_config,
>>         .join_mesh = ieee80211_join_mesh,
>>         .leave_mesh = ieee80211_leave_mesh,
>> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
>> index 34f3cda..c30be38 100644
>> --- a/net/mac80211/ieee80211_i.h
>> +++ b/net/mac80211/ieee80211_i.h
>> @@ -309,15 +309,6 @@ struct ieee80211_if_vlan {
>>         struct sta_info __rcu *sta;
>>  };
>>
>> -struct mesh_stats {
>> -       __u32 fwded_mcast;              /* Mesh forwarded multicast frames */
>> -       __u32 fwded_unicast;            /* Mesh forwarded unicast frames */
>> -       __u32 fwded_frames;             /* Mesh total forwarded frames */
>> -       __u32 dropped_frames_ttl;       /* Not transmitted since mesh_ttl == 0*/
>> -       __u32 dropped_frames_no_route;  /* Not transmitted, no route found */
>> -       __u32 dropped_frames_congestion;/* Not forwarded due to congestion */
>> -};
>> -
>>  #define PREQ_Q_F_START         0x1
>>  #define PREQ_Q_F_REFRESH       0x2
>>  struct mesh_preq_queue {
>> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
>> index f1047ae..279a106 100644
>> --- a/net/wireless/nl80211.c
>> +++ b/net/wireless/nl80211.c
>> @@ -275,6 +275,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
>>                                            .len = NL80211_MAX_SUPP_RATES },
>>         [NL80211_ATTR_BSS_HT_OPMODE] = { .type = NLA_U16 },
>>
>> +       [NL80211_ATTR_MESH_STATS] = { .type = NLA_NESTED },
>>         [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED },
>>         [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG },
>>
>> @@ -3645,6 +3646,68 @@ static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info)
>>         return r;
>>  }
>>
>> +static int nl80211_get_mesh_stats(struct sk_buff *skb,
>> +                                 struct genl_info *info)
>> +{
>> +       struct cfg80211_registered_device *rdev = info->user_ptr[0];
>> +       struct net_device *dev = info->user_ptr[1];
>> +       struct wireless_dev *wdev = dev->ieee80211_ptr;
>> +       struct mesh_stats cur_stats;
>> +       int err = 0;
>> +       void *hdr;
>> +       struct nlattr *pinfoattr;
>> +       struct sk_buff *msg;
>> +
>> +       if (wdev->iftype != NL80211_IFTYPE_MESH_POINT)
>> +               return -EOPNOTSUPP;
>> +
>> +       if (!rdev->ops->get_mesh_stats)
>> +               return -EOPNOTSUPP;
>> +
>> +       wdev_lock(wdev);
>> +
>> +       err = rdev->ops->get_mesh_stats(&rdev->wiphy, dev, &cur_stats);
>> +       wdev_unlock(wdev);
>> +
>> +       if (err)
>> +               return err;
>> +
>> +       /* Draw up a netlink message to send back */
>> +       msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
>> +       if (!msg)
>> +               return -ENOMEM;
>> +       hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
>> +                            NL80211_CMD_GET_MESH_STATS);
>> +       if (!hdr)
>> +               goto out;
>> +       pinfoattr = nla_nest_start(msg, NL80211_ATTR_MESH_STATS);
>> +       if (!pinfoattr)
>> +               goto nla_put_failure;
>> +       if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||
>> +           nla_put_u32(msg, NL80211_MESH_STATS_FWDED_MCAST,
>> +                       cur_stats.fwded_mcast) ||
>> +           nla_put_u32(msg, NL80211_MESH_STATS_FWDED_UNICAST,
>> +                       cur_stats.fwded_unicast) ||
>> +           nla_put_u32(msg, NL80211_MESH_STATS_FWDED_FRAMES,
>> +                       cur_stats.fwded_frames) ||
>> +           nla_put_u32(msg, NL80211_MESH_STATS_DROPPED_FRAMES_TTL,
>> +                       cur_stats.dropped_frames_ttl) ||
>> +           nla_put_u32(msg, NL80211_MESH_STATS_DROPPED_FRAMES_NO_ROUTE,
>> +                       cur_stats.dropped_frames_no_route) ||
>> +           nla_put_u32(msg, NL80211_MESH_STATS_DROPPED_FRAMES_CONGESTION,
>> +                       cur_stats.dropped_frames_congestion))
>> +               goto nla_put_failure;
>> +       nla_nest_end(msg, pinfoattr);
>> +       genlmsg_end(msg, hdr);
>> +       return genlmsg_reply(msg, info);
>> +
>> + nla_put_failure:
>> +       genlmsg_cancel(msg, hdr);
>> + out:
>> +       nlmsg_free(msg);
>> +       return -ENOBUFS;
>> +}
>> +
>>  static int nl80211_get_mesh_config(struct sk_buff *skb,
>>                                    struct genl_info *info)
>>  {
>> @@ -7202,6 +7265,14 @@ static struct genl_ops nl80211_ops[] = {
>>                 .flags = GENL_ADMIN_PERM,
>>         },
>>         {
>> +               .cmd = NL80211_CMD_GET_MESH_STATS,
>> +               .doit = nl80211_get_mesh_stats,
>> +               .policy = nl80211_policy,
>> +               /* can be retrieved by unprivileged users */
>> +               .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
>> +                                 NL80211_FLAG_NEED_RTNL,
>> +       },
>> +       {
>>                 .cmd = NL80211_CMD_GET_MESH_CONFIG,
>>                 .doit = nl80211_get_mesh_config,
>>                 .policy = nl80211_policy,
>> --
>> 1.7.5.4
>>
>> _______________________________________________
>> Devel mailing list
>> Devel@lists.open80211s.org
>> http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel
> _______________________________________________
> Devel mailing list
> Devel@lists.open80211s.org
> http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel



-- 
Javier Cardona
cozybit Inc.
http://www.cozybit.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] mac80211: move out the non-statistics variable estab_plinks from mesh_stat
  2012-10-09 20:27 [PATCH 1/2] mac80211: move out the non-statistics variable estab_plinks from mesh_stat Ashok Nagarajan
  2012-10-09 20:27 ` [PATCH 2/2] [nl,cfg,mac]80211: Add nl80211 command to get mesh network statistics Ashok Nagarajan
@ 2012-10-10  9:02 ` Johannes Berg
  1 sibling, 0 replies; 10+ messages in thread
From: Johannes Berg @ 2012-10-10  9:02 UTC (permalink / raw)
  To: Ashok Nagarajan; +Cc: linux-wireless, linville, javier, devel

On Tue, 2012-10-09 at 13:27 -0700, Ashok Nagarajan wrote:
> estab_plinks is not a statistics member. Hence move estab_plinks from
> struct mesh_stat to struct ieee80211_if_mesh

Applied.

johannes


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] [nl,cfg,mac]80211: Add nl80211 command to get mesh network statistics
  2012-10-09 20:27 ` [PATCH 2/2] [nl,cfg,mac]80211: Add nl80211 command to get mesh network statistics Ashok Nagarajan
  2012-10-10  1:31   ` [PATCH 2/2] [nl, cfg, mac]80211: " Yeoh Chun-Yeow
@ 2012-10-10  9:05   ` Johannes Berg
  2012-10-10 19:37     ` Ashok Nagarajan
  2012-10-19 13:50   ` Johannes Berg
  2 siblings, 1 reply; 10+ messages in thread
From: Johannes Berg @ 2012-10-10  9:05 UTC (permalink / raw)
  To: Ashok Nagarajan; +Cc: linux-wireless, linville, javier, devel

On Tue, 2012-10-09 at 13:27 -0700, Ashok Nagarajan wrote:
> The command NL80211_CMD_GET_MESH_STATS gets the statistical information about
> the mesh network. Currently, the following statistics are provided:
> 
> 1. Mesh forwarded multicast frames
> 2. Mesh forwarded unicast frames
> 3. Mesh total forwarded frames
> 4. Dropped frames due to mesh_ttl == 0
> 5. Dropped frames due to no route found
> 6. Dropped frames due to congestion
> 
> The attibute NL80211_ATTR_MESH_PARAMS enumerates the various mesh statistical
> parameters. A new call back get_mesh_stats() is added. mesh_stats struct is
> moved from mac80211/ieee80211_i.h to net/cfg80211.h.

I'll need to think about this a bit. What I'm thinking:

 * is a new nl80211 command really the same API?
 * should ethtools stats be provided maybe (in addition?)

I think this is probably fine though.


Some additional comments on the patch itself:

> +struct mesh_stats {

That should probably get a cfg80211_ prefix?

> +	u32 fwded_mcast;

Should we change those to u64 while at it, since it's now part of the
userspace API in nl80211?

> +static int ieee80211_get_mesh_stats(struct wiphy *wiphy,
> +				    struct net_device *dev,
> +				    struct mesh_stats *stats)
> +{
> +	struct ieee80211_sub_if_data *sdata;
> +	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
> +
> +	memcpy(stats, &sdata->u.mesh.mshstats, sizeof(*stats));

should this provide a way to say "I only have these stats" in case other
people later implement it? OTOH, they can do that when they implement it
and don't have all the stats.

johannes


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] [nl,cfg,mac]80211: Add nl80211 command to get mesh network statistics
  2012-10-10  9:05   ` [PATCH 2/2] [nl,cfg,mac]80211: " Johannes Berg
@ 2012-10-10 19:37     ` Ashok Nagarajan
  0 siblings, 0 replies; 10+ messages in thread
From: Ashok Nagarajan @ 2012-10-10 19:37 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, linville, javier, devel

Hello Johannes,

Thanks for your comments.

On Wed, Oct 10, 2012 at 2:05 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2012-10-09 at 13:27 -0700, Ashok Nagarajan wrote:
>> The command NL80211_CMD_GET_MESH_STATS gets the statistical information about
>> the mesh network. Currently, the following statistics are provided:
>>
>> 1. Mesh forwarded multicast frames
>> 2. Mesh forwarded unicast frames
>> 3. Mesh total forwarded frames
>> 4. Dropped frames due to mesh_ttl == 0
>> 5. Dropped frames due to no route found
>> 6. Dropped frames due to congestion
>>
>> The attibute NL80211_ATTR_MESH_PARAMS enumerates the various mesh statistical
>> parameters. A new call back get_mesh_stats() is added. mesh_stats struct is
>> moved from mac80211/ieee80211_i.h to net/cfg80211.h.
>
> I'll need to think about this a bit. What I'm thinking:
>
>  * is a new nl80211 command really the same API?
>  * should ethtools stats be provided maybe (in addition?)
>
We didn't consider ethtools when implementing this. It seems to be a
good approach. I will send a patch to address the same.

Thanks,
Ashok

> I think this is probably fine though.
>
>
> Some additional comments on the patch itself:
>
>> +struct mesh_stats {
>
> That should probably get a cfg80211_ prefix?
>
>> +     u32 fwded_mcast;
>
> Should we change those to u64 while at it, since it's now part of the
> userspace API in nl80211?
>
>> +static int ieee80211_get_mesh_stats(struct wiphy *wiphy,
>> +                                 struct net_device *dev,
>> +                                 struct mesh_stats *stats)
>> +{
>> +     struct ieee80211_sub_if_data *sdata;
>> +     sdata = IEEE80211_DEV_TO_SUB_IF(dev);
>> +
>> +     memcpy(stats, &sdata->u.mesh.mshstats, sizeof(*stats));
>
> should this provide a way to say "I only have these stats" in case other
> people later implement it? OTOH, they can do that when they implement it
> and don't have all the stats.
>
> johannes
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] [nl,cfg,mac]80211: Add nl80211 command to get mesh network statistics
  2012-10-09 20:27 ` [PATCH 2/2] [nl,cfg,mac]80211: Add nl80211 command to get mesh network statistics Ashok Nagarajan
  2012-10-10  1:31   ` [PATCH 2/2] [nl, cfg, mac]80211: " Yeoh Chun-Yeow
  2012-10-10  9:05   ` [PATCH 2/2] [nl,cfg,mac]80211: " Johannes Berg
@ 2012-10-19 13:50   ` Johannes Berg
  2012-10-19 16:12     ` Javier Cardona
  2 siblings, 1 reply; 10+ messages in thread
From: Johannes Berg @ 2012-10-19 13:50 UTC (permalink / raw)
  To: Ashok Nagarajan; +Cc: linux-wireless, linville, javier, devel

On Tue, 2012-10-09 at 13:27 -0700, Ashok Nagarajan wrote:

>  /**
> + * struct mesh_stats - 802.11s mesh statistics
> + *
> + * Used to provide statistical information about mesh
> + *
> + * @fwded_mcast: Mesh forwarded multicast frames
> + * @fwded_unicast: Mesh forwarded unicast frames
> + * @fwded_frames: Mesh total forwarded frames
> + * @dropped_frames_ttl: Not transmitted since mesh_ttl == 0
> + * @dropped_frames_no_route: Not transmitted, no route found
> + * @dropped_frames_congestion: Not forwarded due to congestion
> + */
> +struct mesh_stats {
> +	u32 fwded_mcast;

Would it make sense to use u64 right away? A lot of netdev stats were at
some point extended from u32 to u64 and that caused problems, maybe
using u64 right away here would be good?

johannes


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] [nl,cfg,mac]80211: Add nl80211 command to get mesh network statistics
  2012-10-19 13:50   ` Johannes Berg
@ 2012-10-19 16:12     ` Javier Cardona
  0 siblings, 0 replies; 10+ messages in thread
From: Javier Cardona @ 2012-10-19 16:12 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Ashok Nagarajan, linux-wireless, linville, devel

On Fri, Oct 19, 2012 at 6:50 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2012-10-09 at 13:27 -0700, Ashok Nagarajan wrote:
>
>>  /**
>> + * struct mesh_stats - 802.11s mesh statistics
>> + *
>> + * Used to provide statistical information about mesh
>> + *
>> + * @fwded_mcast: Mesh forwarded multicast frames
>> + * @fwded_unicast: Mesh forwarded unicast frames
>> + * @fwded_frames: Mesh total forwarded frames
>> + * @dropped_frames_ttl: Not transmitted since mesh_ttl == 0
>> + * @dropped_frames_no_route: Not transmitted, no route found
>> + * @dropped_frames_congestion: Not forwarded due to congestion
>> + */
>> +struct mesh_stats {
>> +     u32 fwded_mcast;
>
> Would it make sense to use u64 right away? A lot of netdev stats were at
> some point extended from u32 to u64 and that caused problems, maybe
> using u64 right away here would be good?

Definitely.

Javier


-- 
Javier Cardona
cozybit Inc.
http://www.cozybit.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-10-19 16:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-09 20:27 [PATCH 1/2] mac80211: move out the non-statistics variable estab_plinks from mesh_stat Ashok Nagarajan
2012-10-09 20:27 ` [PATCH 2/2] [nl,cfg,mac]80211: Add nl80211 command to get mesh network statistics Ashok Nagarajan
2012-10-10  1:31   ` [PATCH 2/2] [nl, cfg, mac]80211: " Yeoh Chun-Yeow
2012-10-10  1:44     ` Ashok Nagarajan
2012-10-10  1:49     ` Javier Cardona
2012-10-10  9:05   ` [PATCH 2/2] [nl,cfg,mac]80211: " Johannes Berg
2012-10-10 19:37     ` Ashok Nagarajan
2012-10-19 13:50   ` Johannes Berg
2012-10-19 16:12     ` Javier Cardona
2012-10-10  9:02 ` [PATCH 1/2] mac80211: move out the non-statistics variable estab_plinks from mesh_stat Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.