net/pfe: add MTU and MAC address set
[dpdk.git] / drivers / net / sfc / base / siena_nic.c
index a9793a1..7ba595b 100644 (file)
@@ -1,31 +1,7 @@
-/*
- * Copyright (c) 2009-2016 Solarflare Communications Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
  *
- * The views and conclusions contained in the software and documentation are
- * those of the authors and should not be interpreted as representing official
- * policies, either expressed or implied, of the FreeBSD Project.
+ * Copyright (c) 2009-2018 Solarflare Communications Inc.
+ * All rights reserved.
  */
 
 #include "efx.h"
@@ -42,11 +18,10 @@ siena_nic_get_partn_mask(
        __out                   unsigned int *maskp)
 {
        efx_mcdi_req_t req;
-       uint8_t payload[MAX(MC_CMD_NVRAM_TYPES_IN_LEN,
-                           MC_CMD_NVRAM_TYPES_OUT_LEN)];
+       EFX_MCDI_DECLARE_BUF(payload, MC_CMD_NVRAM_TYPES_IN_LEN,
+               MC_CMD_NVRAM_TYPES_OUT_LEN);
        efx_rc_t rc;
 
-       (void) memset(payload, 0, sizeof (payload));
        req.emr_cmd = MC_CMD_NVRAM_TYPES;
        req.emr_in_buf = payload;
        req.emr_in_length = MC_CMD_NVRAM_TYPES_IN_LEN;
@@ -90,6 +65,10 @@ siena_board_cfg(
        uint32_t nevq, nrxq, ntxq;
        efx_rc_t rc;
 
+       /* Siena has a fixed 8Kbyte VI window size */
+       EFX_STATIC_ASSERT(1U << EFX_VI_WINDOW_SHIFT_8K  == 8192);
+       encp->enc_vi_window_shift = EFX_VI_WINDOW_SHIFT_8K;
+
        /* External port identifier using one-based port numbering */
        encp->enc_external_port = (uint8_t)enp->en_mcdi.em_emip.emi_port;
 
@@ -125,6 +104,10 @@ siena_board_cfg(
        encp->enc_evq_timer_max_us = (encp->enc_evq_timer_quantum_ns <<
                FRF_CZ_TC_TIMER_VAL_WIDTH) / 1000;
 
+       encp->enc_ev_desc_size = SIENA_EVQ_DESC_SIZE;
+       encp->enc_rx_desc_size = SIENA_RXQ_DESC_SIZE;
+       encp->enc_tx_desc_size = SIENA_TXQ_DESC_SIZE;
+
        /* When hash header insertion is enabled, Siena inserts 16 bytes */
        encp->enc_rx_prefix_size = 16;
 
@@ -135,9 +118,23 @@ siena_board_cfg(
        /* Alignment for WPTR updates */
        encp->enc_rx_push_align = 1;
 
+#if EFSYS_OPT_RX_SCALE
        /* There is one RSS context per function */
        encp->enc_rx_scale_max_exclusive_contexts = 1;
 
+       encp->enc_rx_scale_hash_alg_mask |= (1U << EFX_RX_HASHALG_LFSR);
+       encp->enc_rx_scale_hash_alg_mask |= (1U << EFX_RX_HASHALG_TOEPLITZ);
+
+       /*
+        * It is always possible to use port numbers
+        * as the input data for hash computation.
+        */
+       encp->enc_rx_scale_l4_hash_supported = B_TRUE;
+
+       /* There is no support for additional RSS modes */
+       encp->enc_rx_scale_additional_modes_supported = B_FALSE;
+#endif /* EFSYS_OPT_RX_SCALE */
+
        encp->enc_tx_dma_desc_size_max = EFX_MASK32(FSF_AZ_TX_KER_BYTE_COUNT);
        /* Fragments must not span 4k boundaries. */
        encp->enc_tx_dma_desc_boundary = 4096;
@@ -156,7 +153,14 @@ siena_board_cfg(
        encp->enc_rxq_limit = MIN(EFX_RXQ_LIMIT_TARGET, nrxq);
        encp->enc_txq_limit = MIN(EFX_TXQ_LIMIT_TARGET, ntxq);
 
-       encp->enc_txq_max_ndescs = 4096;
+       encp->enc_evq_max_nevs = SIENA_EVQ_MAXNEVS;
+       encp->enc_evq_min_nevs = SIENA_EVQ_MINNEVS;
+
+       encp->enc_rxq_max_ndescs = EF10_RXQ_MAXNDESCS;
+       encp->enc_rxq_min_ndescs = EF10_RXQ_MINNDESCS;
+
+       encp->enc_txq_max_ndescs = SIENA_TXQ_MAXNDESCS;
+       encp->enc_txq_min_ndescs = SIENA_TXQ_MINNDESCS;
 
        encp->enc_buftbl_limit = SIENA_SRAM_ROWS -
            (encp->enc_txq_limit * EFX_TXQ_DC_NDESCS(EFX_TXQ_DC_SIZE)) -
@@ -169,6 +173,8 @@ siena_board_cfg(
        encp->enc_allow_set_mac_with_installed_filters = B_TRUE;
        encp->enc_rx_packed_stream_supported = B_FALSE;
        encp->enc_rx_var_packed_stream_supported = B_FALSE;
+       encp->enc_rx_es_super_buffer_supported = B_FALSE;
+       encp->enc_fw_subvariant_no_tx_csum_supported = B_FALSE;
 
        /* Siena supports two 10G ports, and 8 lanes of PCIe Gen2 */
        encp->enc_required_pcie_bandwidth_mbps = 2 * 10000;
@@ -176,6 +182,12 @@ siena_board_cfg(
 
        encp->enc_nvram_update_verify_result_supported = B_FALSE;
 
+       encp->enc_mac_stats_nstats = MC_CMD_MAC_NSTATS;
+
+       encp->enc_filter_action_flag_supported = B_FALSE;
+       encp->enc_filter_action_mark_supported = B_FALSE;
+       encp->enc_filter_action_mark_max = 0;
+
        return (0);
 
 fail2: