AW: statistical information about sent and received packets byhostap

zze-RIVOALEN Mathieu FTRD/DAC/LAN mathieu.rivoalen
Thu Jun 10 06:13:09 PDT 2004


Le Thu, 10 Jun 2004 14:39:46 +0200, Robel Daher 
<daher at informatik.uni-rostock.de> a ?crit:

> Hallo Mathieu,

salut,

> Excuse me for the delay. Thank you very much for the information. In
> fact, I need to know the number of sent and received packets for every
> bit rate and also the entire transmitted data size for every bit rate.

struct sta_info {
	...
	u32 tx_count[WLAN_RATE_COUNT]; /* number of frames sent (per rate) */
	u32 rx_count[WLAN_RATE_COUNT]; /* number of frames received (per rate)
	...
}
You could add two arrays in this structure to count the data size for each 
rate.

> I looked at the file "hostap_proc.c", but I couldn't find anything about
> the parameters I mentioned above;

Yes, it's because i've already modified this file to print this kind of 
informations
Sorry.

> however I looked for the structure
> sta_info as you said and I additionally found the function
> prism2_sta_proc_read(...), which exists in the file hostap_ap.c and has
> the same structure of a function of file hostap_proc.c. This function
> can give me all the Information that I need, I suppose.

This function only prints the informations. but it's a good beginning.

> But I'm not sure, whether this function is only used in Master Mode???.

I haven't test in managed mode yet. So I don't know.

> Do you think that the copy of this function in the file hostap_proc.c
> can generate this information or similarly I should write a new function
> in hostap_proc.c? How was your experience?

Yes you can copy and rename this function in hostap_proc.c, like this

static int prism2_mesinfo_proc_read(char *page, char **start, off_t off,
				    int count, int *eof, void *data)
{
   char *p = page;
   local_info_t *local = (local_info_t *) data;

   if (off > PROC_LIMIT) {
     *eof = 1;
     return 0;	}

   p += sprintf(p, "\ntest d'affichage");
   struct list_head *ptr;
   struct ap_data *ap = local->ap;
   int i=0;

   // To print the informations
   // for all the sta
   spin_lock_bh(&ap->sta_table_lock);
   for (ptr = ap->sta_list.next; ptr != &ap->sta_list; ptr = ptr->next) {
     struct sta_info *sta = (struct sta_info *) ptr;

     p += sprintf(p, "\n%s_%d  : "MACSTR,
		 sta->ap ? "AP" : "STA",
		 sta->aid,
		 MAC2STR(sta->addr)					
		 );

     p += sprintf(p, "\n  rx_packets : %8lu  rx_bytes : 
%8lu",sta->rx_packets,sta->rx_bytes);
     p += sprintf(p, "\n  tx_packets : %8lu  tx_bytes : 
%8lu",sta->tx_packets,sta->tx_bytes);
     p += sprintf(p, "\ntx[1M]=%4d  tx[2M]=%4d  tx[5.5M]=%4d  tx[11M]=%4d"
		 "\nrx[1M]=%4d  rx[2M]=%4d  rx[5.5M]=%4d  rx[11M]=%4d",
		 sta->tx_count[0], sta->tx_count[1],sta->tx_count[2], sta->tx_count[3],
		 sta->rx_count[0], sta->rx_count[1], sta->rx_count[2], sta->rx_count[3]);

   }
   spin_unlock_bh(&ap->sta_table_lock);
   p += sprintf(p, "\n\n");
   if ((p - page) <= off) {
     *eof = 1;
     return 0;	}
   *start = page + off;

   return (p - page - off);
}

This entry will print in /proc/net/hostap/wlan0/mesinfo the number of sent 
and received packets for every bit rate
I think it's easy to add some counters for the data size for every bit 
rate.

Don't forget to also add the entry in the function
void hostap_init_proc(local_info_t *local)
{
...
create_proc_read_entry("mesinfo", 0, local->proc,
			       prism2_mesinfo_proc_read, local);
...
}
and here too
void hostap_remove_proc(local_info_t *local)
{
...
remove_proc_entry("mesinfo", local->proc);
...
}



Mathieu Rivoalen




More information about the Hostap mailing list