i40e/i40evf: Add Flow director stats to PF stats
authorAnjali Singhai Jain <anjali.singhai@intel.com>
Thu, 22 May 2014 06:32:17 +0000 (06:32 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 11 Jun 2014 15:48:33 +0000 (08:48 -0700)
Add members to stat struct to keep track of Flow director ATR and
SideBand filter packet matches.

Change-ID: Ibbb31a53c7adcc2bb96991dd80565442a2f2513c
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_txrx.c
drivers/net/ethernet/intel/i40e/i40e_type.h
drivers/net/ethernet/intel/i40evf/i40e_type.h

index 5a8bbaafe50099d2f8a0c82da03972235a03ed51..65985846345deea3cc16d6f3cfd26add64dbfa7f 100644 (file)
@@ -154,6 +154,17 @@ struct i40e_lump_tracking {
 #define I40E_FDIR_BUFFER_FULL_MARGIN   10
 #define I40E_FDIR_BUFFER_HEAD_ROOM     200
 
+enum i40e_fd_stat_idx {
+       I40E_FD_STAT_ATR,
+       I40E_FD_STAT_SB,
+       I40E_FD_STAT_PF_COUNT
+};
+#define I40E_FD_STAT_PF_IDX(pf_id) ((pf_id) * I40E_FD_STAT_PF_COUNT)
+#define I40E_FD_ATR_STAT_IDX(pf_id) \
+                       (I40E_FD_STAT_PF_IDX(pf_id) + I40E_FD_STAT_ATR)
+#define I40E_FD_SB_STAT_IDX(pf_id)  \
+                       (I40E_FD_STAT_PF_IDX(pf_id) + I40E_FD_STAT_SB)
+
 struct i40e_fdir_filter {
        struct hlist_node fdir_node;
        /* filter ipnut set */
@@ -223,6 +234,8 @@ struct i40e_pf {
 
        struct hlist_head fdir_filter_list;
        u16 fdir_pf_active_filters;
+       u16 fd_sb_cnt_idx;
+       u16 fd_atr_cnt_idx;
 
 #ifdef CONFIG_I40E_VXLAN
        __be16  vxlan_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS];
index c7718631ed02af87527d23331b0b0a3ee995ff4c..e33016620e285c3106637b98b7ed845734886432 100644 (file)
@@ -145,6 +145,9 @@ static struct i40e_stats i40e_gstrings_stats[] = {
        I40E_PF_STAT("rx_jabber", stats.rx_jabber),
        I40E_PF_STAT("VF_admin_queue_requests", vf_aq_requests),
        I40E_PF_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared),
+       I40E_PF_STAT("fdir_atr_match", stats.fd_atr_match),
+       I40E_PF_STAT("fdir_sb_match", stats.fd_sb_match),
+
        /* LPI stats */
        I40E_PF_STAT("tx_lpi_status", stats.tx_lpi_status),
        I40E_PF_STAT("rx_lpi_status", stats.rx_lpi_status),
@@ -1581,7 +1584,7 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
        input->pctype = 0;
        input->dest_vsi = vsi->id;
        input->fd_status = I40E_FILTER_PROGRAM_DESC_FD_STATUS_FD_ID;
-       input->cnt_index = 0;
+       input->cnt_index  = pf->fd_sb_cnt_idx;
        input->flow_type = fsp->flow_type;
        input->ip4_proto = fsp->h_u.usr_ip4_spec.proto;
 
index e3916d00d403a9e102186b016f27ca717504564e..06e0a5226ce1cda71d2f07a9f9ff7ec481b2ab32 100644 (file)
@@ -1013,6 +1013,14 @@ static void i40e_update_pf_stats(struct i40e_pf *pf)
                           pf->stat_offsets_loaded,
                           &osd->rx_jabber, &nsd->rx_jabber);
 
+       /* FDIR stats */
+       i40e_stat_update32(hw, I40E_GLQF_PCNT(pf->fd_atr_cnt_idx),
+                          pf->stat_offsets_loaded,
+                          &osd->fd_atr_match, &nsd->fd_atr_match);
+       i40e_stat_update32(hw, I40E_GLQF_PCNT(pf->fd_sb_cnt_idx),
+                          pf->stat_offsets_loaded,
+                          &osd->fd_sb_match, &nsd->fd_sb_match);
+
        val = rd32(hw, I40E_PRTPM_EEE_STAT);
        nsd->tx_lpi_status =
                       (val & I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_MASK) >>
@@ -6604,8 +6612,12 @@ static int i40e_sw_init(struct i40e_pf *pf)
            (pf->hw.func_caps.fd_filters_best_effort > 0)) {
                pf->flags |= I40E_FLAG_FD_ATR_ENABLED;
                pf->atr_sample_rate = I40E_DEFAULT_ATR_SAMPLE_RATE;
+               /* Setup a counter for fd_atr per pf */
+               pf->fd_atr_cnt_idx = I40E_FD_ATR_STAT_IDX(pf->hw.pf_id);
                if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) {
                        pf->flags |= I40E_FLAG_FD_SB_ENABLED;
+                       /* Setup a counter for fd_sb per pf */
+                       pf->fd_sb_cnt_idx = I40E_FD_SB_STAT_IDX(pf->hw.pf_id);
                } else {
                        dev_info(&pf->pdev->dev,
                                 "Flow Director Sideband mode Disabled in MFP mode\n");
index d84f4275f47021a291efd8216ba8e1f79f399f95..e49f31dbd5d87cfdd4268c8837053746ef27c3dc 100644 (file)
@@ -121,7 +121,7 @@ int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, u8 *raw_packet,
                dcc |= I40E_TXD_FLTR_QW1_CNT_ENA_MASK;
                dcc |= ((u32)fdir_data->cnt_index <<
                        I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) &
-                      I40E_TXD_FLTR_QW1_CNTINDEX_MASK;
+                       I40E_TXD_FLTR_QW1_CNTINDEX_MASK;
        }
 
        fdir_desc->dtype_cmd_cntindex = cpu_to_le32(dcc);
@@ -1695,6 +1695,11 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
        dtype_cmd |= I40E_FILTER_PROGRAM_DESC_FD_STATUS_FD_ID <<
                     I40E_TXD_FLTR_QW1_FD_STATUS_SHIFT;
 
+       dtype_cmd |= I40E_TXD_FLTR_QW1_CNT_ENA_MASK;
+       dtype_cmd |=
+               ((u32)pf->fd_atr_cnt_idx << I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) &
+               I40E_TXD_FLTR_QW1_CNTINDEX_MASK;
+
        fdir_desc->qindex_flex_ptype_vsi = cpu_to_le32(flex_ptype);
        fdir_desc->dtype_cmd_cntindex = cpu_to_le32(dtype_cmd);
 }
index bb5b05503e56341686c6c7369deafe52e75e3e0b..9d39ff23c5fbfbbed52ec0ba5437e585fc3a0c68 100644 (file)
@@ -1023,6 +1023,9 @@ struct i40e_hw_port_stats {
        u64 tx_size_big;                /* ptc9522 */
        u64 mac_short_packet_dropped;   /* mspdc */
        u64 checksum_error;             /* xec */
+       /* flow director stats */
+       u64 fd_atr_match;
+       u64 fd_sb_match;
        /* EEE LPI */
        u32 tx_lpi_status;
        u32 rx_lpi_status;
index 92fae73877084dacadb5446b8f34ee48a03bf1a3..d3cf5a69de54d6e7e7bc648dd478873b88510b5c 100644 (file)
@@ -1023,6 +1023,9 @@ struct i40e_hw_port_stats {
        u64 tx_size_big;                /* ptc9522 */
        u64 mac_short_packet_dropped;   /* mspdc */
        u64 checksum_error;             /* xec */
+       /* flow director stats */
+       u64 fd_atr_match;
+       u64 fd_sb_match;
        /* EEE LPI */
        u32 tx_lpi_status;
        u32 rx_lpi_status;