Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Add get_ethtool_stats() support

Martin Hundebøll
2012-04-17T13:24:48Z

Hi Marek,

On 04/17/2012 10:19 AM, Marek Lindner wrote:
> On Tuesday, April 17, 2012 01:24:55 Martin Hundebøll wrote:
>> Added additional counters in a bat_stats structure, which are exported
>> through the ethtool api. The counters are specific to batman-adv and
>> includes:
>> forwarded packets
>> management packets (OGMs at this point)
>> translation table packets
>> distributed arp table packets
>
> Looks very good! A few questions though:
>
>
>> @@ -869,6 +875,9 @@ static int route_unicast_packet(struct sk_buff *skb,
>> struct hard_iface *recv_if) /* decrement ttl */
>> unicast_packet->header.ttl--;
>>
>> + /* Update stats counter */
>> + bat_priv->bat_stats.forward++;
>
> Here we only count the number of packets. Would it be possible to also count
> the number of bytes ? Similar to tx_packets and tx_bytes ?
> Same for management tx/bytes.

Sure, if we want it, I can make it :)

>> +struct bat_stats {
>> + uint64_t forward;
>> + uint64_t mgmt_tx;
>> + uint64_t mgmt_rx;
>> + uint64_t tt_request_tx;
>> + uint64_t tt_request_rx;
>> + uint64_t tt_response_tx;
>> + uint64_t tt_response_rx;
>> + uint64_t tt_roam_adv_tx;
>> + uint64_t tt_roam_adv_rx;
>> + uint64_t dat_request_tx;
>> + uint64_t dat_request_rx;
>> + uint64_t dat_reply_tx;
>> + uint64_t dat_reply_rx;
>> +};
>
> How do we handle code segments that are not compiled into the module ? We
> simply leave this counters hanging around at 0 ?

As I understand it, ethtool doesn't mind "unused" counters in general, so it comes down to the memory footprint of batman-adv. Do we want to clutter the code with ifdef's to save the memory?

--
Kind Regards
Martin Hundebøll
Frederiks Allé 99A, 1.th
8000 Aarhus C
Denmark
+45 61 65 54 61
martin@hundeboll.net