From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Tafelmeier Subject: [PATCH v7 01/10] ss: rooted out ss type declarations for output formatters Date: Thu, 10 Sep 2015 21:34:59 +0200 Message-ID: <1441913708-15532-2-git-send-email-matthias.tafelmeier@gmx.net> References: <1441913708-15532-1-git-send-email-matthias.tafelmeier@gmx.net> Cc: hagen@jauu.net, shemminger@osdl.org, fw@strlen.de, edumazet@google.com, daniel@iogearbox.net To: netdev@vger.kernel.org Return-path: Received: from mout.gmx.net ([212.227.17.21]:49377 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753228AbbIJTfp (ORCPT ); Thu, 10 Sep 2015 15:35:45 -0400 In-Reply-To: <1441913708-15532-1-git-send-email-matthias.tafelmeier@gmx.net> Sender: netdev-owner@vger.kernel.org List-ID: The prospected output formatters and ss do share type declarations like slabstat or tcpstat so that the decision has been made to centralize those declarations in ss_types.h. Potential future declarations shall be placed there. The latter should help amend the extent of ss.c as well. Signed-off-by: Matthias Tafelmeier Suggested-by: Hagen Paul Pfeifer --- misc/ss.c | 186 +------------------------------------------------------- misc/ss_types.h | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+), 185 deletions(-) create mode 100644 misc/ss_types.h diff --git a/misc/ss.c b/misc/ss.c index 2f34962..83775d1 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -27,6 +27,7 @@ #include #include +#include "ss_types.h" #include "utils.h" #include "rt_names.h" #include "ll_map.h" @@ -113,55 +114,17 @@ static const char *UDP_PROTO = "udp"; static const char *RAW_PROTO = "raw"; static const char *dg_proto = NULL; -enum -{ - TCP_DB, - DCCP_DB, - UDP_DB, - RAW_DB, - UNIX_DG_DB, - UNIX_ST_DB, - UNIX_SQ_DB, - PACKET_DG_DB, - PACKET_R_DB, - NETLINK_DB, - MAX_DB -}; #define PACKET_DBM ((1< +#include +#include "utils.h" + +enum { + TCP_DB, + DCCP_DB, + UDP_DB, + RAW_DB, + UNIX_DG_DB, + UNIX_ST_DB, + UNIX_SQ_DB, + PACKET_DG_DB, + PACKET_R_DB, + NETLINK_DB, + MAX_DB +}; + +enum { + SS_UNKNOWN, + SS_ESTABLISHED, + SS_SYN_SENT, + SS_SYN_RECV, + SS_FIN_WAIT1, + SS_FIN_WAIT2, + SS_TIME_WAIT, + SS_CLOSE, + SS_CLOSE_WAIT, + SS_LAST_ACK, + SS_LISTEN, + SS_CLOSING, + SS_MAX +}; + +struct filter { + int dbs; + int states; + int families; + struct ssfilter *f; +}; + +struct user_ent { + struct user_ent *next; + unsigned int ino; + int pid; + int fd; + char *process; + char *process_ctx; + char *socket_ctx; +}; + +/* Get stats from slab */ + +struct slabstat { + int socks; + int tcp_ports; + int tcp_tws; + int tcp_syns; + int skbs; +}; + +struct sockstat { + struct sockstat *next; + unsigned int type; + uint16_t prot; + inet_prefix local; + inet_prefix remote; + int lport; + int rport; + int state; + int rq, wq; + unsigned ino; + unsigned uid; + int refcnt; + unsigned int iface; + unsigned long long sk; + char *name; + char *peer_name; +}; + +struct dctcpstat { + unsigned int ce_state; + unsigned int alpha; + unsigned int ab_ecn; + unsigned int ab_tot; + bool enabled; +}; + +#pragma pack(push, 1) + +struct tcpstat { + struct sockstat ss; + int timer; + int timeout; + int probes; + char cong_alg[16]; + double rto, ato, rtt, rttvar; + int qack, cwnd, ssthresh, backoff; + double send_bps; + int snd_wscale; + int rcv_wscale; + int mss; + unsigned int lastsnd; + unsigned int lastrcv; + unsigned int lastack; + double pacing_rate; + double pacing_rate_max; + unsigned long long bytes_acked; + unsigned long long bytes_received; + unsigned int segs_out; + unsigned int segs_in; + unsigned int unacked; + unsigned int retrans; + unsigned int retrans_total; + unsigned int lost; + unsigned int sacked; + unsigned int fackets; + unsigned int reordering; + bool has_ts_opt; + bool has_sack_opt; + bool has_ecn_opt; + bool has_ecnseen_opt; + bool has_fastopen_opt; + bool has_wscale_opt; + struct dctcpstat *dctcp; + double rcv_rtt; + int rcv_space; +}; + +#pragma pack(pop) + +struct scache { + struct scache *next; + int port; + char *name; + const char *proto; +}; + +struct aafilter { + inet_prefix addr; + int port; + struct aafilter *next; +}; + +struct snmpstat { + int tcp_estab; +}; + +struct sock_diag_msg { + __u8 sdiag_family; +}; + +struct inet_diag_arg { + struct filter *f; + int protocol; +}; + +/* Get stats from sockstat */ + +struct ssummary { + int socks; + int tcp_mem; + int tcp_total; + int tcp_orphans; + int tcp_tws; + int tcp4_hashed; + int udp4; + int raw4; + int frag4; + int frag4_mem; + int tcp6_hashed; + int udp6; + int raw6; + int frag6; + int frag6_mem; +}; + +enum entry_types { + USERS, + PROC_CTX, + PROC_SOCK_CTX +}; +#endif /* SS_STRUCTS_H */ -- 1.9.1