The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/iavf/iavf_lib.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* SPDX-License-Identifier: BSD-3-Clause */
    2 /*  Copyright (c) 2021, Intel Corporation
    3  *  All rights reserved.
    4  *
    5  *  Redistribution and use in source and binary forms, with or without
    6  *  modification, are permitted provided that the following conditions are met:
    7  *
    8  *   1. Redistributions of source code must retain the above copyright notice,
    9  *      this list of conditions and the following disclaimer.
   10  *
   11  *   2. Redistributions in binary form must reproduce the above copyright
   12  *      notice, this list of conditions and the following disclaimer in the
   13  *      documentation and/or other materials provided with the distribution.
   14  *
   15  *   3. Neither the name of the Intel Corporation nor the names of its
   16  *      contributors may be used to endorse or promote products derived from
   17  *      this software without specific prior written permission.
   18  *
   19  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   20  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   21  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   22  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
   23  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   24  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   25  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   26  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   27  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   28  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   29  *  POSSIBILITY OF SUCH DAMAGE.
   30  */
   31 /*$FreeBSD$*/
   32 
   33 /**
   34  * @file iavf_lib.h
   35  * @brief header for structures and functions common to legacy and iflib
   36  *
   37  * Contains definitions and function declarations which are shared between the
   38  * legacy and iflib driver implementation.
   39  */
   40 #ifndef _IAVF_LIB_H_
   41 #define _IAVF_LIB_H_
   42 
   43 #include <sys/malloc.h>
   44 #include <machine/stdarg.h>
   45 #include <sys/sysctl.h>
   46 #ifdef RSS
   47 #include <net/rss_config.h>
   48 #endif
   49 
   50 #include "iavf_debug.h"
   51 #include "iavf_osdep.h"
   52 #include "iavf_type.h"
   53 #include "iavf_prototype.h"
   54 
   55 MALLOC_DECLARE(M_IAVF);
   56 
   57 /*
   58  * Ring Descriptors Valid Range: 32-4096 Default Value: 1024 This value is the
   59  * number of tx/rx descriptors allocated by the driver. Increasing this
   60  * value allows the driver to queue more operations.
   61  *
   62  * Tx descriptors are always 16 bytes, but Rx descriptors can be 32 bytes.
   63  * The driver currently always uses 32 byte Rx descriptors.
   64  */
   65 #define IAVF_DEFAULT_RING       1024
   66 #define IAVF_MAX_RING           4096
   67 #define IAVF_MIN_RING           64
   68 #define IAVF_RING_INCREMENT     32
   69 
   70 #define IAVF_AQ_LEN             256
   71 #define IAVF_AQ_LEN_MAX         1024
   72 
   73 /*
   74 ** Default number of entries in Tx queue buf_ring.
   75 */
   76 #define DEFAULT_TXBRSZ          4096
   77 
   78 /* Alignment for rings */
   79 #define DBA_ALIGN               128
   80 
   81 /*
   82  * Max number of multicast MAC addrs added to the driver's
   83  * internal lists before converting to promiscuous mode
   84  */
   85 #define MAX_MULTICAST_ADDR      128
   86 
   87 /* Byte alignment for Tx/Rx descriptor rings */
   88 #define DBA_ALIGN               128
   89 
   90 #define IAVF_MSIX_BAR           3
   91 #define IAVF_ADM_LIMIT          2
   92 #define IAVF_TSO_SIZE           ((255*1024)-1)
   93 #define IAVF_AQ_BUF_SZ          ((u32) 4096)
   94 #define IAVF_RX_HDR             128
   95 #define IAVF_RX_LIMIT           512
   96 #define IAVF_RX_ITR             0
   97 #define IAVF_TX_ITR             1
   98 /**
   99  * The maximum packet length allowed to be sent or received by the adapter.
  100  */
  101 #define IAVF_MAX_FRAME          9728
  102 /**
  103  * The minimum packet length allowed to be sent by the adapter.
  104  */
  105 #define IAVF_MIN_FRAME          17
  106 #define IAVF_MAX_TX_SEGS        8
  107 #define IAVF_MAX_RX_SEGS        5
  108 #define IAVF_MAX_TSO_SEGS       128
  109 #define IAVF_SPARSE_CHAIN       7
  110 #define IAVF_MIN_TSO_MSS        64
  111 #define IAVF_MAX_TSO_MSS        9668
  112 #define IAVF_MAX_DMA_SEG_SIZE   ((16 * 1024) - 1)
  113 #define IAVF_AQ_MAX_ERR         30
  114 #define IAVF_MAX_INIT_WAIT      120
  115 #define IAVF_AQ_TIMEOUT         (1 * hz)
  116 #define IAVF_ADV_LINK_SPEED_SCALE       ((u64)1000000)
  117 #define IAVF_MAX_DIS_Q_RETRY    10
  118 
  119 #define IAVF_RSS_KEY_SIZE_REG           13
  120 #define IAVF_RSS_KEY_SIZE               (IAVF_RSS_KEY_SIZE_REG * 4)
  121 #define IAVF_RSS_VSI_LUT_SIZE           64      /* X722 -> VSI, X710 -> VF */
  122 #define IAVF_RSS_VSI_LUT_ENTRY_MASK     0x3F
  123 #define IAVF_RSS_VF_LUT_ENTRY_MASK      0xF
  124 
  125 /* Maximum MTU size */
  126 #define IAVF_MAX_MTU (IAVF_MAX_FRAME - \
  127                      ETHER_HDR_LEN - ETHER_CRC_LEN - ETHER_VLAN_ENCAP_LEN)
  128 
  129 /*
  130  * Hardware requires that TSO packets have an segment size of at least 64
  131  * bytes. To avoid sending bad frames to the hardware, the driver forces the
  132  * MSS for all TSO packets to have a segment size of at least 64 bytes.
  133  *
  134  * However, if the MTU is reduced below a certain size, then the resulting
  135  * larger MSS can result in transmitting segmented frames with a packet size
  136  * larger than the MTU.
  137  *
  138  * Avoid this by preventing the MTU from being lowered below this limit.
  139  * Alternative solutions require changing the TCP stack to disable offloading
  140  * the segmentation when the requested segment size goes below 64 bytes.
  141  */
  142 #define IAVF_MIN_MTU 112
  143 
  144 /*
  145  * Interrupt Moderation parameters
  146  * Multiply ITR values by 2 for real ITR value
  147  */
  148 #define IAVF_MAX_ITR            0x0FF0
  149 #define IAVF_ITR_100K           0x0005
  150 #define IAVF_ITR_20K            0x0019
  151 #define IAVF_ITR_8K             0x003E
  152 #define IAVF_ITR_4K             0x007A
  153 #define IAVF_ITR_1K             0x01F4
  154 #define IAVF_ITR_DYNAMIC        0x8000
  155 #define IAVF_LOW_LATENCY        0
  156 #define IAVF_AVE_LATENCY        1
  157 #define IAVF_BULK_LATENCY       2
  158 
  159 /* MacVlan Flags */
  160 #define IAVF_FILTER_USED        (u16)(1 << 0)
  161 #define IAVF_FILTER_VLAN        (u16)(1 << 1)
  162 #define IAVF_FILTER_ADD         (u16)(1 << 2)
  163 #define IAVF_FILTER_DEL         (u16)(1 << 3)
  164 #define IAVF_FILTER_MC          (u16)(1 << 4)
  165 /* used in the vlan field of the filter when not a vlan */
  166 #define IAVF_VLAN_ANY           -1
  167 
  168 #define CSUM_OFFLOAD_IPV4       (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP)
  169 #define CSUM_OFFLOAD_IPV6       (CSUM_TCP_IPV6|CSUM_UDP_IPV6|CSUM_SCTP_IPV6)
  170 #define CSUM_OFFLOAD            (CSUM_OFFLOAD_IPV4|CSUM_OFFLOAD_IPV6|CSUM_TSO)
  171 
  172 /* Misc flags for iavf_vsi.flags */
  173 #define IAVF_FLAGS_KEEP_TSO4    (1 << 0)
  174 #define IAVF_FLAGS_KEEP_TSO6    (1 << 1)
  175 
  176 #define IAVF_DEFAULT_RSS_HENA_BASE (\
  177         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV4_UDP) |     \
  178         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV4_TCP) |     \
  179         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV4_SCTP) |    \
  180         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV4_OTHER) |   \
  181         BIT_ULL(IAVF_FILTER_PCTYPE_FRAG_IPV4) |         \
  182         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV6_UDP) |     \
  183         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV6_TCP) |     \
  184         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV6_SCTP) |    \
  185         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV6_OTHER) |   \
  186         BIT_ULL(IAVF_FILTER_PCTYPE_FRAG_IPV6))
  187 
  188 #define IAVF_DEFAULT_ADV_RSS_HENA (\
  189         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) | \
  190         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP) | \
  191         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) | \
  192         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP) | \
  193         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK) | \
  194         BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK))
  195 
  196 #define IAVF_DEFAULT_RSS_HENA_XL710 (\
  197         IAVF_DEFAULT_RSS_HENA_BASE |                    \
  198         BIT_ULL(IAVF_FILTER_PCTYPE_L2_PAYLOAD))
  199 
  200 #define IAVF_DEFAULT_RSS_HENA_X722 (\
  201         IAVF_DEFAULT_RSS_HENA_XL710 |                   \
  202         IAVF_DEFAULT_ADV_RSS_HENA)
  203 
  204 #define IAVF_DEFAULT_RSS_HENA_AVF (\
  205         IAVF_DEFAULT_RSS_HENA_BASE |                    \
  206         IAVF_DEFAULT_ADV_RSS_HENA)
  207 
  208 /* Pre-11 counter(9) compatibility */
  209 #if __FreeBSD_version >= 1100036
  210 #define IAVF_SET_IPACKETS(vsi, count)   (vsi)->ipackets = (count)
  211 #define IAVF_SET_IERRORS(vsi, count)    (vsi)->ierrors = (count)
  212 #define IAVF_SET_OPACKETS(vsi, count)   (vsi)->opackets = (count)
  213 #define IAVF_SET_OERRORS(vsi, count)    (vsi)->oerrors = (count)
  214 #define IAVF_SET_COLLISIONS(vsi, count) /* Do nothing; collisions is always 0. */
  215 #define IAVF_SET_IBYTES(vsi, count)     (vsi)->ibytes = (count)
  216 #define IAVF_SET_OBYTES(vsi, count)     (vsi)->obytes = (count)
  217 #define IAVF_SET_IMCASTS(vsi, count)    (vsi)->imcasts = (count)
  218 #define IAVF_SET_OMCASTS(vsi, count)    (vsi)->omcasts = (count)
  219 #define IAVF_SET_IQDROPS(vsi, count)    (vsi)->iqdrops = (count)
  220 #define IAVF_SET_OQDROPS(vsi, count)    (vsi)->oqdrops = (count)
  221 #define IAVF_SET_NOPROTO(vsi, count)    (vsi)->noproto = (count)
  222 #else
  223 #define IAVF_SET_IPACKETS(vsi, count)   (vsi)->ifp->if_ipackets = (count)
  224 #define IAVF_SET_IERRORS(vsi, count)    (vsi)->ifp->if_ierrors = (count)
  225 #define IAVF_SET_OPACKETS(vsi, count)   (vsi)->ifp->if_opackets = (count)
  226 #define IAVF_SET_OERRORS(vsi, count)    (vsi)->ifp->if_oerrors = (count)
  227 #define IAVF_SET_COLLISIONS(vsi, count) (vsi)->ifp->if_collisions = (count)
  228 #define IAVF_SET_IBYTES(vsi, count)     (vsi)->ifp->if_ibytes = (count)
  229 #define IAVF_SET_OBYTES(vsi, count)     (vsi)->ifp->if_obytes = (count)
  230 #define IAVF_SET_IMCASTS(vsi, count)    (vsi)->ifp->if_imcasts = (count)
  231 #define IAVF_SET_OMCASTS(vsi, count)    (vsi)->ifp->if_omcasts = (count)
  232 #define IAVF_SET_IQDROPS(vsi, count)    (vsi)->ifp->if_iqdrops = (count)
  233 #define IAVF_SET_OQDROPS(vsi, odrops)   (vsi)->ifp->if_snd.ifq_drops = (odrops)
  234 #define IAVF_SET_NOPROTO(vsi, count)    (vsi)->noproto = (count)
  235 #endif
  236 
  237 /* For stats sysctl naming */
  238 #define IAVF_QUEUE_NAME_LEN 32
  239 
  240 #define IAVF_FLAG_AQ_ENABLE_QUEUES            (u32)(1 << 0)
  241 #define IAVF_FLAG_AQ_DISABLE_QUEUES           (u32)(1 << 1)
  242 #define IAVF_FLAG_AQ_ADD_MAC_FILTER           (u32)(1 << 2)
  243 #define IAVF_FLAG_AQ_ADD_VLAN_FILTER          (u32)(1 << 3)
  244 #define IAVF_FLAG_AQ_DEL_MAC_FILTER           (u32)(1 << 4)
  245 #define IAVF_FLAG_AQ_DEL_VLAN_FILTER          (u32)(1 << 5)
  246 #define IAVF_FLAG_AQ_CONFIGURE_QUEUES         (u32)(1 << 6)
  247 #define IAVF_FLAG_AQ_MAP_VECTORS              (u32)(1 << 7)
  248 #define IAVF_FLAG_AQ_HANDLE_RESET             (u32)(1 << 8)
  249 #define IAVF_FLAG_AQ_CONFIGURE_PROMISC        (u32)(1 << 9)
  250 #define IAVF_FLAG_AQ_GET_STATS                (u32)(1 << 10)
  251 #define IAVF_FLAG_AQ_CONFIG_RSS_KEY           (u32)(1 << 11)
  252 #define IAVF_FLAG_AQ_SET_RSS_HENA             (u32)(1 << 12)
  253 #define IAVF_FLAG_AQ_GET_RSS_HENA_CAPS        (u32)(1 << 13)
  254 #define IAVF_FLAG_AQ_CONFIG_RSS_LUT           (u32)(1 << 14)
  255 
  256 #define IAVF_CAP_ADV_LINK_SPEED(_sc) \
  257     ((_sc)->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_ADV_LINK_SPEED)
  258 
  259 #define IAVF_NRXQS(_vsi) ((_vsi)->num_rx_queues)
  260 #define IAVF_NTXQS(_vsi) ((_vsi)->num_tx_queues)
  261 
  262 /**
  263  * printf %b flag args
  264  */
  265 #define IAVF_FLAGS \
  266     "\2\1ENABLE_QUEUES\2DISABLE_QUEUES\3ADD_MAC_FILTER" \
  267     "\4ADD_VLAN_FILTER\5DEL_MAC_FILTER\6DEL_VLAN_FILTER" \
  268     "\7CONFIGURE_QUEUES\10MAP_VECTORS\11HANDLE_RESET" \
  269     "\12CONFIGURE_PROMISC\13GET_STATS\14CONFIG_RSS_KEY" \
  270     "\15SET_RSS_HENA\16GET_RSS_HENA_CAPS\17CONFIG_RSS_LUT"
  271 /**
  272  * printf %b flag args for offloads from virtchnl.h
  273  */
  274 #define IAVF_PRINTF_VF_OFFLOAD_FLAGS \
  275     "\2\1L2" \
  276     "\2IWARP" \
  277     "\3FCOE" \
  278     "\4RSS_AQ" \
  279     "\5RSS_REG" \
  280     "\6WB_ON_ITR" \
  281     "\7REQ_QUEUES" \
  282     "\10ADV_LINK_SPEED" \
  283     "\21VLAN" \
  284     "\22RX_POLLING" \
  285     "\23RSS_PCTYPE_V2" \
  286     "\24RSS_PF" \
  287     "\25ENCAP" \
  288     "\26ENCAP_CSUM" \
  289     "\27RX_ENCAP_CSUM" \
  290     "\30ADQ"
  291 
  292 /**
  293  * @enum iavf_ext_link_speed
  294  * @brief Extended link speed enumeration
  295  *
  296  * Enumeration of possible link speeds that the device could be operating in.
  297  * Contains an extended list compared to the virtchnl_link_speed, including
  298  * additional higher speeds such as 50GB, and 100GB.
  299  *
  300  * The enumeration is used to convert between the old virtchnl_link_speed, the
  301  * newer advanced speed reporting value specified in Mb/s, and the ifmedia
  302  * link speeds reported to the operating system.
  303  */
  304 enum iavf_ext_link_speed {
  305         IAVF_EXT_LINK_SPEED_UNKNOWN,
  306         IAVF_EXT_LINK_SPEED_10MB,
  307         IAVF_EXT_LINK_SPEED_100MB,
  308         IAVF_EXT_LINK_SPEED_1000MB,
  309         IAVF_EXT_LINK_SPEED_2500MB,
  310         IAVF_EXT_LINK_SPEED_5GB,
  311         IAVF_EXT_LINK_SPEED_10GB,
  312         IAVF_EXT_LINK_SPEED_20GB,
  313         IAVF_EXT_LINK_SPEED_25GB,
  314         IAVF_EXT_LINK_SPEED_40GB,
  315         IAVF_EXT_LINK_SPEED_50GB,
  316         IAVF_EXT_LINK_SPEED_100GB,
  317 };
  318 
  319 /**
  320  * @struct iavf_sysctl_info
  321  * @brief sysctl statistic info
  322  *
  323  * Structure describing a single statistics sysctl, used for reporting
  324  * specific hardware and software statistics via the sysctl interface.
  325  */
  326 struct iavf_sysctl_info {
  327         u64     *stat;
  328         char    *name;
  329         char    *description;
  330 };
  331 
  332 /* Forward struct declarations */
  333 struct iavf_sc;
  334 struct iavf_vsi;
  335 
  336 /**
  337  * @enum iavf_state
  338  * @brief Driver state flags
  339  *
  340  * Used to indicate the status of various driver events. Intended to be
  341  * modified only using atomic operations, so that we can use it even in places
  342  * which aren't locked.
  343  */
  344 enum iavf_state {
  345         IAVF_STATE_INITIALIZED,
  346         IAVF_STATE_RESET_REQUIRED,
  347         IAVF_STATE_RESET_PENDING,
  348         IAVF_STATE_RUNNING,
  349         /* This entry must be last */
  350         IAVF_STATE_LAST,
  351 };
  352 
  353 /* Functions for setting and checking driver state. Note the functions take
  354  * bit positions, not bitmasks. The atomic_testandset_32 and
  355  * atomic_testandclear_32 operations require bit positions, while the
  356  * atomic_set_32 and atomic_clear_32 require bitmasks. This can easily lead to
  357  * programming error, so we provide wrapper functions to avoid this.
  358  */
  359 
  360 /**
  361  * iavf_set_state - Set the specified state
  362  * @s: the state bitmap
  363  * @bit: the state to set
  364  *
  365  * Atomically update the state bitmap with the specified bit set.
  366  */
  367 static inline void
  368 iavf_set_state(volatile u32 *s, enum iavf_state bit)
  369 {
  370         /* atomic_set_32 expects a bitmask */
  371         atomic_set_32(s, BIT(bit));
  372 }
  373 
  374 /**
  375  * iavf_clear_state - Clear the specified state
  376  * @s: the state bitmap
  377  * @bit: the state to clear
  378  *
  379  * Atomically update the state bitmap with the specified bit cleared.
  380  */
  381 static inline void
  382 iavf_clear_state(volatile u32 *s, enum iavf_state bit)
  383 {
  384         /* atomic_clear_32 expects a bitmask */
  385         atomic_clear_32(s, BIT(bit));
  386 }
  387 
  388 /**
  389  * iavf_testandset_state - Test and set the specified state
  390  * @s: the state bitmap
  391  * @bit: the bit to test
  392  *
  393  * Atomically update the state bitmap, setting the specified bit.
  394  *
  395  * @returns the previous value of the bit.
  396  */
  397 static inline u32
  398 iavf_testandset_state(volatile u32 *s, enum iavf_state bit)
  399 {
  400         /* atomic_testandset_32 expects a bit position */
  401         return atomic_testandset_32(s, bit);
  402 }
  403 
  404 /**
  405  * iavf_testandclear_state - Test and clear the specified state
  406  * @s: the state bitmap
  407  * @bit: the bit to test
  408  *
  409  * Atomically update the state bitmap, clearing the specified bit.
  410  *
  411  * @returns the previous value of the bit.
  412  */
  413 static inline u32
  414 iavf_testandclear_state(volatile u32 *s, enum iavf_state bit)
  415 {
  416         /* atomic_testandclear_32 expects a bit position */
  417         return atomic_testandclear_32(s, bit);
  418 }
  419 
  420 /**
  421  * iavf_test_state - Test the specified state
  422  * @s: the state bitmap
  423  * @bit: the bit to test
  424  *
  425  * @returns true if the state is set, false otherwise.
  426  *
  427  * @remark Use this only if the flow does not need to update the state. If you
  428  * must update the state as well, prefer iavf_testandset_state or
  429  * iavf_testandclear_state.
  430  */
  431 static inline u32
  432 iavf_test_state(volatile u32 *s, enum iavf_state bit)
  433 {
  434         return (*s & BIT(bit)) ? true : false;
  435 }
  436 
  437 /**
  438  * cmp_etheraddr - Compare two ethernet addresses
  439  * @ea1: first ethernet address
  440  * @ea2: second ethernet address
  441  *
  442  * Compares two ethernet addresses.
  443  *
  444  * @returns true if the addresses are equal, false otherwise.
  445  */
  446 static inline bool
  447 cmp_etheraddr(const u8 *ea1, const u8 *ea2)
  448 {
  449         bool cmp = FALSE;
  450 
  451         if ((ea1[0] == ea2[0]) && (ea1[1] == ea2[1]) &&
  452             (ea1[2] == ea2[2]) && (ea1[3] == ea2[3]) &&
  453             (ea1[4] == ea2[4]) && (ea1[5] == ea2[5]))
  454                 cmp = TRUE;
  455 
  456         return (cmp);
  457 }
  458 
  459 int iavf_send_vc_msg(struct iavf_sc *sc, u32 op);
  460 int iavf_send_vc_msg_sleep(struct iavf_sc *sc, u32 op);
  461 void iavf_update_link_status(struct iavf_sc *);
  462 bool iavf_driver_is_detaching(struct iavf_sc *sc);
  463 void iavf_msec_pause(int msecs);
  464 void iavf_get_default_rss_key(u32 *key);
  465 int iavf_allocate_pci_resources_common(struct iavf_sc *sc);
  466 int iavf_reset_complete(struct iavf_hw *hw);
  467 int iavf_setup_vc(struct iavf_sc *sc);
  468 int iavf_reset(struct iavf_sc *sc);
  469 void iavf_enable_adminq_irq(struct iavf_hw *hw);
  470 void iavf_disable_adminq_irq(struct iavf_hw *hw);
  471 int iavf_vf_config(struct iavf_sc *sc);
  472 void iavf_print_device_info(struct iavf_sc *sc);
  473 int iavf_get_vsi_res_from_vf_res(struct iavf_sc *sc);
  474 void iavf_set_mac_addresses(struct iavf_sc *sc);
  475 void iavf_init_filters(struct iavf_sc *sc);
  476 void iavf_free_filters(struct iavf_sc *sc);
  477 void iavf_add_device_sysctls_common(struct iavf_sc *sc);
  478 void iavf_configure_tx_itr(struct iavf_sc *sc);
  479 void iavf_configure_rx_itr(struct iavf_sc *sc);
  480 struct sysctl_oid_list *
  481     iavf_create_debug_sysctl_tree(struct iavf_sc *sc);
  482 void iavf_add_debug_sysctls_common(struct iavf_sc *sc,
  483     struct sysctl_oid_list *debug_list);
  484 void iavf_add_vsi_sysctls(device_t dev, struct iavf_vsi *vsi,
  485     struct sysctl_ctx_list *ctx, const char *sysctl_name);
  486 void iavf_add_sysctls_eth_stats(struct sysctl_ctx_list *ctx,
  487     struct sysctl_oid_list *child, struct iavf_eth_stats *eth_stats);
  488 void iavf_media_status_common(struct iavf_sc *sc,
  489     struct ifmediareq *ifmr);
  490 int iavf_media_change_common(if_t ifp);
  491 void iavf_set_initial_baudrate(if_t ifp);
  492 u64 iavf_max_vc_speed_to_value(u8 link_speeds);
  493 void iavf_config_rss_reg(struct iavf_sc *sc);
  494 void iavf_config_rss_pf(struct iavf_sc *sc);
  495 void iavf_config_rss(struct iavf_sc *sc);
  496 int iavf_config_promisc(struct iavf_sc *sc, int flags);
  497 void iavf_init_multi(struct iavf_sc *sc);
  498 void iavf_multi_set(struct iavf_sc *sc);
  499 int iavf_add_mac_filter(struct iavf_sc *sc, u8 *macaddr, u16 flags);
  500 struct iavf_mac_filter *
  501     iavf_find_mac_filter(struct iavf_sc *sc, u8 *macaddr);
  502 struct iavf_mac_filter *
  503     iavf_get_mac_filter(struct iavf_sc *sc);
  504 u64 iavf_baudrate_from_link_speed(struct iavf_sc *sc);
  505 void iavf_add_vlan_filter(struct iavf_sc *sc, u16 vtag);
  506 int iavf_mark_del_vlan_filter(struct iavf_sc *sc, u16 vtag);
  507 void iavf_update_msix_devinfo(device_t dev);
  508 void iavf_disable_queues_with_retries(struct iavf_sc *);
  509 
  510 int iavf_sysctl_current_speed(SYSCTL_HANDLER_ARGS);
  511 int iavf_sysctl_tx_itr(SYSCTL_HANDLER_ARGS);
  512 int iavf_sysctl_rx_itr(SYSCTL_HANDLER_ARGS);
  513 int iavf_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS);
  514 
  515 #endif /* _IAVF_LIB_H_ */

Cache object: 2b07cdad9860f8945049a3bf9728442b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.