Commit 473256b0 authored by Lino Sanfilippo's avatar Lino Sanfilippo Committed by Greg Kroah-Hartman

staging: slicoss: simplify struct for statistics

Merge several structures for statistics to one structure and remove
unnecessary union nesting.
Signed-off-by: default avatarLino Sanfilippo <LinoSanfilippo@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fdb77775
...@@ -351,6 +351,24 @@ struct base_driver { ...@@ -351,6 +351,24 @@ struct base_driver {
uint cardnuminuse[SLIC_MAX_CARDS]; uint cardnuminuse[SLIC_MAX_CARDS];
}; };
struct slic_stats {
/* xmit stats */
u64 xmit_tcp_bytes;
u64 xmit_tcp_segs;
u64 xmit_bytes;
u64 xmit_collisions;
u64 xmit_unicasts;
u64 xmit_other_error;
u64 xmit_excess_collisions;
/* rcv stats */
u64 rcv_tcp_bytes;
u64 rcv_tcp_segs;
u64 rcv_bytes;
u64 rcv_unicasts;
u64 rcv_other_error;
u64 rcv_drops;
};
struct slic_shmem_data { struct slic_shmem_data {
u32 isr; u32 isr;
u32 lnkstatus; u32 lnkstatus;
......
...@@ -459,85 +459,6 @@ struct slic_pnp_capabilities { ...@@ -459,85 +459,6 @@ struct slic_pnp_capabilities {
struct slicpm_wakeup_capabilities wakeup_capabilities; struct slicpm_wakeup_capabilities wakeup_capabilities;
}; };
struct xmt_stats {
u32 xmit_tcp_bytes;
u32 xmit_tcp_segs;
u32 xmit_bytes;
u32 xmit_collisions;
u32 xmit_unicasts;
u32 xmit_other_error;
u32 xmit_excess_collisions;
};
struct rcv_stats {
u32 rcv_tcp_bytes;
u32 rcv_tcp_segs;
u32 rcv_bytes;
u32 rcv_unicasts;
u32 rcv_other_error;
u32 rcv_drops;
};
struct xmt_statsgb {
u64 xmit_tcp_bytes;
u64 xmit_tcp_segs;
u64 xmit_bytes;
u64 xmit_collisions;
u64 xmit_unicasts;
u64 xmit_other_error;
u64 xmit_excess_collisions;
};
struct rcv_statsgb {
u64 rcv_tcp_bytes;
u64 rcv_tcp_segs;
u64 rcv_bytes;
u64 rcv_unicasts;
u64 rcv_other_error;
u64 rcv_drops;
};
struct slic_stats {
union {
struct {
struct xmt_stats xmt100;
struct rcv_stats rcv100;
} stats_100;
struct {
struct xmt_statsgb xmtGB;
struct rcv_statsgb rcvGB;
} stats_GB;
} u;
};
#define xmit_tcp_segs100 u.stats_100.xmt100.xmit_tcp_segs
#define xmit_tcp_bytes100 u.stats_100.xmt100.xmit_tcp_bytes
#define xmit_bytes100 u.stats_100.xmt100.xmit_bytes
#define xmit_collisions100 u.stats_100.xmt100.xmit_collisions
#define xmit_unicasts100 u.stats_100.xmt100.xmit_unicasts
#define xmit_other_error100 u.stats_100.xmt100.xmit_other_error
#define xmit_excess_collisions100 u.stats_100.xmt100.xmit_excess_collisions
#define rcv_tcp_segs100 u.stats_100.rcv100.rcv_tcp_segs
#define rcv_tcp_bytes100 u.stats_100.rcv100.rcv_tcp_bytes
#define rcv_bytes100 u.stats_100.rcv100.rcv_bytes
#define rcv_unicasts100 u.stats_100.rcv100.rcv_unicasts
#define rcv_other_error100 u.stats_100.rcv100.rcv_other_error
#define rcv_drops100 u.stats_100.rcv100.rcv_drops
#define xmit_tcp_segs_gb u.stats_GB.xmtGB.xmit_tcp_segs
#define xmit_tcp_bytes_gb u.stats_GB.xmtGB.xmit_tcp_bytes
#define xmit_bytes_gb u.stats_GB.xmtGB.xmit_bytes
#define xmit_collisions_gb u.stats_GB.xmtGB.xmit_collisions
#define xmit_unicasts_gb u.stats_GB.xmtGB.xmit_unicasts
#define xmit_other_error_gb u.stats_GB.xmtGB.xmit_other_error
#define xmit_excess_collisions_gb u.stats_GB.xmtGB.xmit_excess_collisions
#define rcv_tcp_segs_gb u.stats_GB.rcvGB.rcv_tcp_segs
#define rcv_tcp_bytes_gb u.stats_GB.rcvGB.rcv_tcp_bytes
#define rcv_bytes_gb u.stats_GB.rcvGB.rcv_bytes
#define rcv_unicasts_gb u.stats_GB.rcvGB.rcv_unicasts
#define rcv_other_error_gb u.stats_GB.rcvGB.rcv_other_error
#define rcv_drops_gb u.stats_GB.rcvGB.rcv_drops
struct slic_config_mac { struct slic_config_mac {
u8 macaddrA[6]; u8 macaddrA[6];
}; };
......
...@@ -1015,61 +1015,49 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) ...@@ -1015,61 +1015,49 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr)
break; break;
} }
UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs,
stats->xmit_tcp_segs_gb, old->xmit_tcp_segs);
old->xmit_tcp_segs_gb);
UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes,
stats->xmit_tcp_bytes_gb, old->xmit_tcp_bytes);
old->xmit_tcp_bytes_gb);
UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs,
stats->rcv_tcp_segs_gb, old->rcv_tcp_segs);
old->rcv_tcp_segs_gb);
UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes,
stats->rcv_tcp_bytes_gb, old->rcv_tcp_bytes);
old->rcv_tcp_bytes_gb);
UPDATE_STATS_GB(stst->iface.xmt_bytes, UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes,
stats->xmit_bytes_gb, old->xmit_bytes);
old->xmit_bytes_gb);
UPDATE_STATS_GB(stst->iface.xmt_ucast, UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts,
stats->xmit_unicasts_gb, old->xmit_unicasts);
old->xmit_unicasts_gb);
UPDATE_STATS_GB(stst->iface.rcv_bytes, UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes,
stats->rcv_bytes_gb, old->rcv_bytes);
old->rcv_bytes_gb);
UPDATE_STATS_GB(stst->iface.rcv_ucast, UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts,
stats->rcv_unicasts_gb, old->rcv_unicasts);
old->rcv_unicasts_gb);
UPDATE_STATS_GB(stst->iface.xmt_errors, UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_collisions,
stats->xmit_collisions_gb, old->xmit_collisions);
old->xmit_collisions_gb);
UPDATE_STATS_GB(stst->iface.xmt_errors, UPDATE_STATS_GB(stst->iface.xmt_errors,
stats->xmit_excess_collisions_gb, stats->xmit_excess_collisions,
old->xmit_excess_collisions_gb); old->xmit_excess_collisions);
UPDATE_STATS_GB(stst->iface.xmt_errors, UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_other_error,
stats->xmit_other_error_gb, old->xmit_other_error);
old->xmit_other_error_gb);
UPDATE_STATS_GB(stst->iface.rcv_errors, UPDATE_STATS_GB(stst->iface.rcv_errors, stats->rcv_other_error,
stats->rcv_other_error_gb, old->rcv_other_error);
old->rcv_other_error_gb);
UPDATE_STATS_GB(stst->iface.rcv_discards, UPDATE_STATS_GB(stst->iface.rcv_discards, stats->rcv_drops,
stats->rcv_drops_gb, old->rcv_drops);
old->rcv_drops_gb);
if (stats->rcv_drops_gb > old->rcv_drops_gb) if (stats->rcv_drops > old->rcv_drops)
adapter->rcv_drops += (stats->rcv_drops_gb - adapter->rcv_drops += (stats->rcv_drops -
old->rcv_drops_gb); old->rcv_drops);
memcpy_fromio(old, stats, sizeof(*stats)); memcpy_fromio(old, stats, sizeof(*stats));
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment