aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-11-28 00:36:29 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-29 03:01:21 -0500
commitc1ac403bfa240617da2bce861ea5c3a907a65612 (patch)
tree340772ce3f0ca211ad93973cabd70bb08ca38932 /drivers/net/sfc
parent0228f5cdb03f6656247cf2876f9f4f8fc213ffd6 (diff)
sfc: Clean up RX event handling
Add 'likely' hint to test of rx_checksum_enabled. Don't count IP fragments; the IP stack can do that. Do count non-matching multicast packets. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r--drivers/net/sfc/ethtool.c1
-rw-r--r--drivers/net/sfc/falcon.c11
-rw-r--r--drivers/net/sfc/net_driver.h4
3 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index 5d2e186e6710..d3da360f09bc 100644
--- a/drivers/net/sfc/ethtool.c
+++ b/drivers/net/sfc/ethtool.c
@@ -153,6 +153,7 @@ static struct efx_ethtool_stat efx_ethtool_stats[] = {
153 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_tobe_disc), 153 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_tobe_disc),
154 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_ip_hdr_chksum_err), 154 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_ip_hdr_chksum_err),
155 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_tcp_udp_chksum_err), 155 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_tcp_udp_chksum_err),
156 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_mcast_mismatch),
156 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_frm_trunc), 157 EFX_ETHTOOL_UINT_CHANNEL_STAT(rx_frm_trunc),
157}; 158};
158 159
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 539d0223b434..2f219ce61392 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -734,7 +734,7 @@ static void falcon_handle_rx_not_ok(struct efx_rx_queue *rx_queue,
734 bool rx_ev_tcp_udp_chksum_err, rx_ev_eth_crc_err; 734 bool rx_ev_tcp_udp_chksum_err, rx_ev_eth_crc_err;
735 bool rx_ev_frm_trunc, rx_ev_drib_nib, rx_ev_tobe_disc; 735 bool rx_ev_frm_trunc, rx_ev_drib_nib, rx_ev_tobe_disc;
736 bool rx_ev_other_err, rx_ev_pause_frm; 736 bool rx_ev_other_err, rx_ev_pause_frm;
737 bool rx_ev_ip_frag_err, rx_ev_hdr_type, rx_ev_mcast_pkt; 737 bool rx_ev_hdr_type, rx_ev_mcast_pkt;
738 unsigned rx_ev_pkt_type; 738 unsigned rx_ev_pkt_type;
739 739
740 rx_ev_hdr_type = EFX_QWORD_FIELD(*event, FSF_AZ_RX_EV_HDR_TYPE); 740 rx_ev_hdr_type = EFX_QWORD_FIELD(*event, FSF_AZ_RX_EV_HDR_TYPE);
@@ -743,7 +743,6 @@ static void falcon_handle_rx_not_ok(struct efx_rx_queue *rx_queue,
743 rx_ev_pkt_type = EFX_QWORD_FIELD(*event, FSF_AZ_RX_EV_PKT_TYPE); 743 rx_ev_pkt_type = EFX_QWORD_FIELD(*event, FSF_AZ_RX_EV_PKT_TYPE);
744 rx_ev_buf_owner_id_err = EFX_QWORD_FIELD(*event, 744 rx_ev_buf_owner_id_err = EFX_QWORD_FIELD(*event,
745 FSF_AZ_RX_EV_BUF_OWNER_ID_ERR); 745 FSF_AZ_RX_EV_BUF_OWNER_ID_ERR);
746 rx_ev_ip_frag_err = EFX_QWORD_FIELD(*event, FSF_AZ_RX_EV_IP_FRAG_ERR);
747 rx_ev_ip_hdr_chksum_err = EFX_QWORD_FIELD(*event, 746 rx_ev_ip_hdr_chksum_err = EFX_QWORD_FIELD(*event,
748 FSF_AZ_RX_EV_IP_HDR_CHKSUM_ERR); 747 FSF_AZ_RX_EV_IP_HDR_CHKSUM_ERR);
749 rx_ev_tcp_udp_chksum_err = EFX_QWORD_FIELD(*event, 748 rx_ev_tcp_udp_chksum_err = EFX_QWORD_FIELD(*event,
@@ -771,8 +770,6 @@ static void falcon_handle_rx_not_ok(struct efx_rx_queue *rx_queue,
771 else if (rx_ev_tcp_udp_chksum_err) 770 else if (rx_ev_tcp_udp_chksum_err)
772 ++rx_queue->channel->n_rx_tcp_udp_chksum_err; 771 ++rx_queue->channel->n_rx_tcp_udp_chksum_err;
773 } 772 }
774 if (rx_ev_ip_frag_err)
775 ++rx_queue->channel->n_rx_ip_frag_err;
776 773
777 /* The frame must be discarded if any of these are true. */ 774 /* The frame must be discarded if any of these are true. */
778 *discard = (rx_ev_eth_crc_err | rx_ev_frm_trunc | rx_ev_drib_nib | 775 *discard = (rx_ev_eth_crc_err | rx_ev_frm_trunc | rx_ev_drib_nib |
@@ -855,7 +852,7 @@ static void falcon_handle_rx_event(struct efx_channel *channel,
855 * UDP/IPv4, then we can rely on the hardware checksum. 852 * UDP/IPv4, then we can rely on the hardware checksum.
856 */ 853 */
857 checksummed = 854 checksummed =
858 efx->rx_checksum_enabled && 855 likely(efx->rx_checksum_enabled) &&
859 (rx_ev_hdr_type == FSE_AB_RX_EV_HDR_TYPE_IPV4_TCP || 856 (rx_ev_hdr_type == FSE_AB_RX_EV_HDR_TYPE_IPV4_TCP ||
860 rx_ev_hdr_type == FSE_AB_RX_EV_HDR_TYPE_IPV4_UDP); 857 rx_ev_hdr_type == FSE_AB_RX_EV_HDR_TYPE_IPV4_UDP);
861 } else { 858 } else {
@@ -870,8 +867,10 @@ static void falcon_handle_rx_event(struct efx_channel *channel,
870 unsigned int rx_ev_mcast_hash_match = 867 unsigned int rx_ev_mcast_hash_match =
871 EFX_QWORD_FIELD(*event, FSF_AZ_RX_EV_MCAST_HASH_MATCH); 868 EFX_QWORD_FIELD(*event, FSF_AZ_RX_EV_MCAST_HASH_MATCH);
872 869
873 if (unlikely(!rx_ev_mcast_hash_match)) 870 if (unlikely(!rx_ev_mcast_hash_match)) {
871 ++channel->n_rx_mcast_mismatch;
874 discard = true; 872 discard = true;
873 }
875 } 874 }
876 875
877 channel->irq_mod_score += 2; 876 channel->irq_mod_score += 2;
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 30fb21e60511..fddf8f5870ce 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -350,9 +350,9 @@ enum efx_rx_alloc_method {
350 * @rx_alloc_push_pages: RX allocation method currently in use for pushing 350 * @rx_alloc_push_pages: RX allocation method currently in use for pushing
351 * descriptors 351 * descriptors
352 * @n_rx_tobe_disc: Count of RX_TOBE_DISC errors 352 * @n_rx_tobe_disc: Count of RX_TOBE_DISC errors
353 * @n_rx_ip_frag_err: Count of RX IP fragment errors
354 * @n_rx_ip_hdr_chksum_err: Count of RX IP header checksum errors 353 * @n_rx_ip_hdr_chksum_err: Count of RX IP header checksum errors
355 * @n_rx_tcp_udp_chksum_err: Count of RX TCP and UDP checksum errors 354 * @n_rx_tcp_udp_chksum_err: Count of RX TCP and UDP checksum errors
355 * @n_rx_mcast_mismatch: Count of unmatched multicast frames
356 * @n_rx_frm_trunc: Count of RX_FRM_TRUNC errors 356 * @n_rx_frm_trunc: Count of RX_FRM_TRUNC errors
357 * @n_rx_overlength: Count of RX_OVERLENGTH errors 357 * @n_rx_overlength: Count of RX_OVERLENGTH errors
358 * @n_skbuff_leaks: Count of skbuffs leaked due to RX overrun 358 * @n_skbuff_leaks: Count of skbuffs leaked due to RX overrun
@@ -380,9 +380,9 @@ struct efx_channel {
380 int rx_alloc_push_pages; 380 int rx_alloc_push_pages;
381 381
382 unsigned n_rx_tobe_disc; 382 unsigned n_rx_tobe_disc;
383 unsigned n_rx_ip_frag_err;
384 unsigned n_rx_ip_hdr_chksum_err; 383 unsigned n_rx_ip_hdr_chksum_err;
385 unsigned n_rx_tcp_udp_chksum_err; 384 unsigned n_rx_tcp_udp_chksum_err;
385 unsigned n_rx_mcast_mismatch;
386 unsigned n_rx_frm_trunc; 386 unsigned n_rx_frm_trunc;
387 unsigned n_rx_overlength; 387 unsigned n_rx_overlength;
388 unsigned n_skbuff_leaks; 388 unsigned n_skbuff_leaks;