net/ixgbe: store flow director filter
[dpdk.git] / drivers / net / ixgbe / ixgbe_ethdev.h
index f75c6dd..3865150 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
 #include "base/ixgbe_dcb_82599.h"
 #include "base/ixgbe_dcb_82598.h"
 #include "ixgbe_bypass.h"
+#include <rte_time.h>
+#include <rte_hash.h>
 
 /* need update link, bit flag */
 #define IXGBE_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
 #define IXGBE_FLAG_MAILBOX          (uint32_t)(1 << 1)
+#define IXGBE_FLAG_PHY_INTERRUPT    (uint32_t)(1 << 2)
+#define IXGBE_FLAG_MACSEC           (uint32_t)(1 << 3)
 
 /*
  * Defines that were not part of ixgbe_type.h as they are not used by the
 #define IXGBE_VFTA_SIZE 128
 #define IXGBE_VLAN_TAG_SIZE 4
 #define IXGBE_MAX_RX_QUEUE_NUM 128
+#define IXGBE_MAX_INTR_QUEUE_NUM       15
+#define IXGBE_VMDQ_DCB_NB_QUEUES     IXGBE_MAX_RX_QUEUE_NUM
+#define IXGBE_DCB_NB_QUEUES          IXGBE_MAX_RX_QUEUE_NUM
+#define IXGBE_NONE_MODE_TX_NB_QUEUES 64
+
 #ifndef NBBY
 #define NBBY   8       /* number of bits in a byte */
 #endif
 #define IXGBE_VF_IRQ_ENABLE_MASK        3          /* vf irq enable mask */
 #define IXGBE_VF_MAXMSIVECTOR           1
 
+#define IXGBE_MISC_VEC_ID               RTE_INTR_VEC_ZERO_OFFSET
+#define IXGBE_RX_VEC_START              RTE_INTR_VEC_RXTX_OFFSET
+
+#define IXGBE_SECTX_MINSECIFG_MASK      0x0000000F
+
+#define IXGBE_MACSEC_PNTHRSH            0xFFFFFE00
+
+#define IXGBE_MAX_FDIR_FILTER_NUM       (1024 * 32)
+
 /*
  * Information about the fdir mode.
  */
-
 struct ixgbe_hw_fdir_mask {
        uint16_t vlan_tci_mask;
        uint32_t src_ipv4_mask;
@@ -138,6 +155,17 @@ struct ixgbe_hw_fdir_mask {
        uint8_t  tunnel_type_mask;
 };
 
+struct ixgbe_fdir_filter {
+       TAILQ_ENTRY(ixgbe_fdir_filter) entries;
+       union ixgbe_atr_input ixgbe_fdir; /* key of fdir filter*/
+       uint32_t fdirflags; /* drop or forward */
+       uint32_t fdirhash; /* hash value for fdir */
+       uint8_t queue; /* assigned rx queue */
+};
+
+/* list of fdir filters */
+TAILQ_HEAD(ixgbe_fdir_filter_list, ixgbe_fdir_filter);
+
 struct ixgbe_hw_fdir_info {
        struct ixgbe_hw_fdir_mask mask;
        uint8_t     flex_bytes_offset;
@@ -149,6 +177,10 @@ struct ixgbe_hw_fdir_info {
        uint64_t    remove;
        uint64_t    f_add;
        uint64_t    f_remove;
+       struct ixgbe_fdir_filter_list fdir_list; /* filter list*/
+       /* store the pointers of the filters, index is the hash value. */
+       struct ixgbe_fdir_filter **hash_map;
+       struct rte_hash *hash_handle; /* cuckoo hash handler */
 };
 
 /* structure for interrupt relative data */
@@ -252,6 +284,40 @@ struct ixgbe_filter_info {
        /* Bit mask for every used 5tuple filter */
        uint32_t fivetuple_mask[IXGBE_5TUPLE_ARRAY_SIZE];
        struct ixgbe_5tuple_filter_list fivetuple_list;
+       /* store the SYN filter info */
+       uint32_t syn_info;
+};
+
+/*
+ * Statistics counters collected by the MACsec
+ */
+struct ixgbe_macsec_stats {
+       /* TX port statistics */
+       uint64_t out_pkts_untagged;
+       uint64_t out_pkts_encrypted;
+       uint64_t out_pkts_protected;
+       uint64_t out_octets_encrypted;
+       uint64_t out_octets_protected;
+
+       /* RX port statistics */
+       uint64_t in_pkts_untagged;
+       uint64_t in_pkts_badtag;
+       uint64_t in_pkts_nosci;
+       uint64_t in_pkts_unknownsci;
+       uint64_t in_octets_decrypted;
+       uint64_t in_octets_validated;
+
+       /* RX SC statistics */
+       uint64_t in_pkts_unchecked;
+       uint64_t in_pkts_delayed;
+       uint64_t in_pkts_late;
+
+       /* RX SA statistics */
+       uint64_t in_pkts_ok;
+       uint64_t in_pkts_invalid;
+       uint64_t in_pkts_notvalid;
+       uint64_t in_pkts_unusedsa;
+       uint64_t in_pkts_notusingsa;
 };
 
 /*
@@ -260,6 +326,7 @@ struct ixgbe_filter_info {
 struct ixgbe_adapter {
        struct ixgbe_hw             hw;
        struct ixgbe_hw_stats       stats;
+       struct ixgbe_macsec_stats   macsec_stats;
        struct ixgbe_hw_fdir_info   fdir;
        struct ixgbe_interrupt      intr;
        struct ixgbe_stat_mapping_registers stat_mappings;
@@ -276,14 +343,23 @@ struct ixgbe_adapter {
 
        bool rx_bulk_alloc_allowed;
        bool rx_vec_allowed;
+       struct rte_timecounter      systime_tc;
+       struct rte_timecounter      rx_tstamp_tc;
+       struct rte_timecounter      tx_tstamp_tc;
 };
 
+#define IXGBE_DEV_TO_PCI(eth_dev) \
+       RTE_DEV_TO_PCI((eth_dev)->device)
+
 #define IXGBE_DEV_PRIVATE_TO_HW(adapter)\
        (&((struct ixgbe_adapter *)adapter)->hw)
 
 #define IXGBE_DEV_PRIVATE_TO_STATS(adapter) \
        (&((struct ixgbe_adapter *)adapter)->stats)
 
+#define IXGBE_DEV_PRIVATE_TO_MACSEC_STATS(adapter) \
+       (&((struct ixgbe_adapter *)adapter)->macsec_stats)
+
 #define IXGBE_DEV_PRIVATE_TO_INTR(adapter) \
        (&((struct ixgbe_adapter *)adapter)->intr)
 
@@ -354,6 +430,12 @@ int ixgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
 int ixgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+void ixgbe_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+       struct rte_eth_rxq_info *qinfo);
+
+void ixgbe_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+       struct rte_eth_txq_info *qinfo);
+
 int ixgbevf_dev_rx_init(struct rte_eth_dev *dev);
 
 void ixgbevf_dev_tx_init(struct rte_eth_dev *dev);
@@ -363,6 +445,9 @@ void ixgbevf_dev_rxtx_start(struct rte_eth_dev *dev);
 uint16_t ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                uint16_t nb_pkts);
 
+uint16_t ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts,
+                                   uint16_t nb_pkts);
+
 uint16_t ixgbe_recv_pkts_lro_single_alloc(void *rx_queue,
                struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
 uint16_t ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue,
@@ -374,6 +459,9 @@ uint16_t ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 uint16_t ixgbe_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
                uint16_t nb_pkts);
 
+uint16_t ixgbe_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+               uint16_t nb_pkts);
+
 int ixgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
                              struct rte_eth_rss_conf *rss_conf);
 
@@ -420,4 +508,8 @@ uint32_t ixgbe_convert_vm_rx_mask_to_val(uint16_t rx_mask, uint32_t orig_val);
 
 int ixgbe_fdir_ctrl_func(struct rte_eth_dev *dev,
                        enum rte_filter_op filter_op, void *arg);
+
+int ixgbe_disable_sec_tx_path_generic(struct ixgbe_hw *hw);
+
+int ixgbe_enable_sec_tx_path_generic(struct ixgbe_hw *hw);
 #endif /* _IXGBE_ETHDEV_H_ */