linux为什么不统计unicast呢?

ionlic 2006-01-18 02:25:21
非常抱歉提这样的标题。因为我不确定linux是否统计unicast。
主要是想引起大家的注意。

cat /proc/net/dev
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs
~~~~~~~a
drop fifo colls carrier compressed
……

a处的packets是指total的packets吧?包括unicast,multicast,broadcast?
linux统计unicast么?

望大侠们解惑。谢谢。




...全文
193 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
bekars 2006-02-05
  • 打赏
  • 举报
回复
下面是内核中net_device的统计数据结构,里面没有unicast,有multicast

unicast没有必要统计,除了multicast,就是unicast了


/*
* Network device statistics. Akin to the 2.0 ether stats but
* with byte counters.
*/

struct net_device_stats
{
unsigned long rx_packets; /* total packets received */
unsigned long tx_packets; /* total packets transmitted */
unsigned long rx_bytes; /* total bytes received */
unsigned long tx_bytes; /* total bytes transmitted */
unsigned long rx_errors; /* bad packets received */
unsigned long tx_errors; /* packet transmit problems */
unsigned long rx_dropped; /* no space in linux buffers */
unsigned long tx_dropped; /* no space available in linux */
unsigned long multicast; /* multicast packets received */
unsigned long collisions;

/* detailed rx_errors: */
unsigned long rx_length_errors;
unsigned long rx_over_errors; /* receiver ring buff overflow */
unsigned long rx_crc_errors; /* recved pkt with crc error */
unsigned long rx_frame_errors; /* recv'd frame alignment error */
unsigned long rx_fifo_errors; /* recv'r fifo overrun */
unsigned long rx_missed_errors; /* receiver missed packet */

/* detailed tx_errors */
unsigned long tx_aborted_errors;
unsigned long tx_carrier_errors;
unsigned long tx_fifo_errors;
unsigned long tx_heartbeat_errors;
unsigned long tx_window_errors;

/* for cslip etc */
unsigned long rx_compressed;
unsigned long tx_compressed;
};
fierygnu 2006-01-24
  • 打赏
  • 举报
回复
内核网络驱动开发模型规定packets包括了该接口上所有成功接收(或发送)的报文,但这个统计是每个设备驱动做的,内核只能根据自己的假设认为它满足其语义。
我说的“这里的信息是链路层的统计信息。链路层只有unicast和multicast”就是针对内核的驱动模型而言的,其实准确的说不应该称为链路层,而应该是网络接口。网络接口种类繁多,有支持广播的,有不支持的。其实广播只是多播的一个特化,就是所有设备都在一个多播组里。在Perlman的Interconnection 2/e里,就把二者统一为multicast来讲。
至于实际的统计如何区分,这就是不同接口类型和相应驱动的事情了。
ionlic 2006-01-22
  • 打赏
  • 举报
回复
但是不能说明
packets 就包含unicast和multicast

愿闻其详。
fierygnu 2006-01-20
  • 打赏
  • 举报
回复
man netstat proc

由procfs模块发起调用,在net模块里维护。
ionlic 2006-01-18
  • 打赏
  • 举报
回复
"这里的信息是链路层的统计信息。链路层只有unicast和multicast。"

有没有相应的材料证明呢?我想看看。

/proc/net/dev
这个文件是哪个程序在维护的呢?

谢谢

fierygnu 2006-01-18
  • 打赏
  • 举报
回复
//faint,这次才错了。
fierygnu 2006-01-18
  • 打赏
  • 举报
回复
写错了,是unicast和broadcast。
fierygnu 2006-01-18
  • 打赏
  • 举报
回复
这里的信息是链路层的统计信息。链路层只有unicast和multicast。

4,436

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧