lkml.org 
[lkml]   [2009]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/4] macvlan: cleanup rx statistics
    Arnd Bergmann wrote:
    > diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
    > index ae2b5c7..a0dea23 100644
    > --- a/drivers/net/macvlan.c
    > +++ b/drivers/net/macvlan.c
    > @@ -116,42 +116,53 @@ static int macvlan_addr_busy(const struct macvlan_port *port,
    > return 0;
    > }
    >
    > +static inline void macvlan_count_rx(const struct macvlan_dev *vlan, int length,

    Please use unsigned int for length values.

    Regarding Eric's comments, I also think it would be more readable to use
    if (success) {
    ...
    } else {
    ...
    }

    > + int success, int multicast)
    > +{
    > + struct macvlan_rx_stats *rx_stats;
    > +
    > + rx_stats = per_cpu_ptr(vlan->rx_stats, smp_processor_id());
    > + rx_stats->rx_packets += success != 0;
    > + rx_stats->rx_bytes += success ? length : 0;
    > + rx_stats->multicast += success && multicast;
    > + rx_stats->rx_errors += !success;
    > +}
    > +
    > +static int macvlan_broadcast_one(struct sk_buff *skb, struct net_device *dev,
    > + const struct ethhdr *eth)
    > +{
    > + if (!skb)
    > + return NET_RX_DROP;
    > +
    > + skb->dev = dev;
    > + if (!compare_ether_addr_64bits(eth->h_dest,
    > + dev->broadcast))

    This would fit on one line without reducing readability.

    > + skb->pkt_type = PACKET_BROADCAST;
    > + else
    > + skb->pkt_type = PACKET_MULTICAST;
    > +
    > + return netif_rx(skb);
    > +}


    \
     
     \ /
      Last update: 2009-11-24 11:45    [W:0.021 / U:0.112 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site