macsec: double accounting of dropped rx/tx packets

The macsec implementation shouldn't account for rx/tx packets that are
dropped in the netdev framework. The netdev framework itself accounts
for such packets by atomically updating struct net_device`rx_dropped and
struct net_device`tx_dropped fields. Later on when the stats for macsec
link is retrieved, the packets dropped in netdev framework will be
included in dev_get_stats() after calling macsec.c`macsec_get_stats64()

Signed-off-by: Girish Moodalbail <girish.moodalbail@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Girish Moodalbail 2017-05-19 15:25:44 -07:00 коммит произвёл David S. Miller
Родитель f5a64d64b5
Коммит 863483c970
1 изменённых файлов: 3 добавлений и 12 удалений

Просмотреть файл

@ -588,8 +588,6 @@ static void count_tx(struct net_device *dev, int ret, int len)
stats->tx_packets++; stats->tx_packets++;
stats->tx_bytes += len; stats->tx_bytes += len;
u64_stats_update_end(&stats->syncp); u64_stats_update_end(&stats->syncp);
} else {
dev->stats.tx_dropped++;
} }
} }
@ -883,7 +881,7 @@ static void macsec_decrypt_done(struct crypto_async_request *base, int err)
struct macsec_dev *macsec = macsec_priv(dev); struct macsec_dev *macsec = macsec_priv(dev);
struct macsec_rx_sa *rx_sa = macsec_skb_cb(skb)->rx_sa; struct macsec_rx_sa *rx_sa = macsec_skb_cb(skb)->rx_sa;
struct macsec_rx_sc *rx_sc = rx_sa->sc; struct macsec_rx_sc *rx_sc = rx_sa->sc;
int len, ret; int len;
u32 pn; u32 pn;
aead_request_free(macsec_skb_cb(skb)->req); aead_request_free(macsec_skb_cb(skb)->req);
@ -904,11 +902,8 @@ static void macsec_decrypt_done(struct crypto_async_request *base, int err)
macsec_reset_skb(skb, macsec->secy.netdev); macsec_reset_skb(skb, macsec->secy.netdev);
len = skb->len; len = skb->len;
ret = gro_cells_receive(&macsec->gro_cells, skb); if (gro_cells_receive(&macsec->gro_cells, skb) == NET_RX_SUCCESS)
if (ret == NET_RX_SUCCESS)
count_rx(dev, len); count_rx(dev, len);
else
macsec->secy.netdev->stats.rx_dropped++;
rcu_read_unlock_bh(); rcu_read_unlock_bh();
@ -1037,7 +1032,6 @@ static void handle_not_macsec(struct sk_buff *skb)
*/ */
list_for_each_entry_rcu(macsec, &rxd->secys, secys) { list_for_each_entry_rcu(macsec, &rxd->secys, secys) {
struct sk_buff *nskb; struct sk_buff *nskb;
int ret;
struct pcpu_secy_stats *secy_stats = this_cpu_ptr(macsec->stats); struct pcpu_secy_stats *secy_stats = this_cpu_ptr(macsec->stats);
if (macsec->secy.validate_frames == MACSEC_VALIDATE_STRICT) { if (macsec->secy.validate_frames == MACSEC_VALIDATE_STRICT) {
@ -1054,13 +1048,10 @@ static void handle_not_macsec(struct sk_buff *skb)
nskb->dev = macsec->secy.netdev; nskb->dev = macsec->secy.netdev;
ret = netif_rx(nskb); if (netif_rx(nskb) == NET_RX_SUCCESS) {
if (ret == NET_RX_SUCCESS) {
u64_stats_update_begin(&secy_stats->syncp); u64_stats_update_begin(&secy_stats->syncp);
secy_stats->stats.InPktsUntagged++; secy_stats->stats.InPktsUntagged++;
u64_stats_update_end(&secy_stats->syncp); u64_stats_update_end(&secy_stats->syncp);
} else {
macsec->secy.netdev->stats.rx_dropped++;
} }
} }