2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * * Neither the name of the above-listed copyright holders nor the
17 * names of any contributors may be used to endorse or promote products
18 * derived from this software without specific prior written permission.
22 * ALTERNATIVELY, this software may be distributed under the terms of the
23 * GNU General Public License ("GPL") as published by the Free Software
24 * Foundation, either version 2 of that License or (at your option) any
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
47 /* Status field in FD is updated on Rx side by FMAN with following information.
48 * Refer to field description in FM BG.
51 unsigned int reserved0:3;
52 unsigned int dcl4c:1; /* Don't Check L4 Checksum */
53 unsigned int reserved1:1;
54 unsigned int ufd:1; /* Unsupported Format */
55 unsigned int lge:1; /* Length Error */
56 unsigned int dme:1; /* DMA Error */
58 unsigned int reserved2:4;
59 unsigned int fpe:1; /* Frame physical Error */
60 unsigned int fse:1; /* Frame Size Error */
61 unsigned int dis:1; /* Discard by Classification */
62 unsigned int reserved3:1;
64 unsigned int eof:1; /* Key Extraction goes out of frame */
65 unsigned int nss:1; /* No Scheme selected */
66 unsigned int kso:1; /* Key Size Overflow */
67 unsigned int reserved4:1;
68 unsigned int fcl:2; /* Frame Color */
69 unsigned int ipp:1; /* Illegal Policer Profile Selected */
70 unsigned int flm:1; /* Frame Length Mismatch */
71 unsigned int pte:1; /* Parser Timeout */
72 unsigned int isp:1; /* Invalid Soft Parser Instruction */
73 unsigned int phe:1; /* Header Error during parsing */
74 unsigned int frdr:1; /* Frame Dropped by disabled port */
75 unsigned int reserved5:4;
76 } __attribute__ ((__packed__));
78 /* Set MAC address for a particular interface */
79 int fman_if_add_mac_addr(struct fman_if *p, uint8_t *eth, uint8_t addr_num);
81 /* Remove a MAC address for a particular interface */
82 void fman_if_clear_mac_addr(struct fman_if *p, uint8_t addr_num);
84 /* Get the FMAN statistics */
85 void fman_if_stats_get(struct fman_if *p, struct rte_eth_stats *stats);
87 /* Reset the FMAN statistics */
88 void fman_if_stats_reset(struct fman_if *p);
90 /* Get all of the FMAN statistics */
91 void fman_if_stats_get_all(struct fman_if *p, uint64_t *value, int n);
93 /* Set ignore pause option for a specific interface */
94 void fman_if_set_rx_ignore_pause_frames(struct fman_if *p, bool enable);
96 /* Set max frame length */
97 void fman_if_conf_max_frame_len(struct fman_if *p, unsigned int max_frame_len);
99 /* Enable/disable Rx promiscuous mode on specified interface */
100 void fman_if_promiscuous_enable(struct fman_if *p);
101 void fman_if_promiscuous_disable(struct fman_if *p);
103 /* Enable/disable Rx on specific interfaces */
104 void fman_if_enable_rx(struct fman_if *p);
105 void fman_if_disable_rx(struct fman_if *p);
107 /* Enable/disable loopback on specific interfaces */
108 void fman_if_loopback_enable(struct fman_if *p);
109 void fman_if_loopback_disable(struct fman_if *p);
111 /* Set buffer pool on specific interface */
112 void fman_if_set_bp(struct fman_if *fm_if, unsigned int num, int bpid,
115 /* Get Flow Control pause quanta on specific interface */
116 int fman_if_get_fc_quanta(struct fman_if *fm_if);
118 /* Set Flow Control pause quanta on specific interface */
119 int fman_if_set_fc_quanta(struct fman_if *fm_if, u16 pause_quanta);
121 /* Set default error fqid on specific interface */
122 void fman_if_set_err_fqid(struct fman_if *fm_if, uint32_t err_fqid);
124 /* Get IC transfer params */
125 int fman_if_get_ic_params(struct fman_if *fm_if, struct fman_if_ic_params *icp);
127 /* Set IC transfer params */
128 int fman_if_set_ic_params(struct fman_if *fm_if,
129 const struct fman_if_ic_params *icp);
131 /* Get interface fd->offset value */
132 int fman_if_get_fdoff(struct fman_if *fm_if);
134 /* Set interface fd->offset value */
135 void fman_if_set_fdoff(struct fman_if *fm_if, uint32_t fd_offset);
137 /* Get interface Max Frame length (MTU) */
138 uint16_t fman_if_get_maxfrm(struct fman_if *fm_if);
140 /* Set interface Max Frame length (MTU) */
141 void fman_if_set_maxfrm(struct fman_if *fm_if, uint16_t max_frm);
143 /* Set interface next invoked action for dequeue operation */
144 void fman_if_set_dnia(struct fman_if *fm_if, uint32_t nia);
146 /* discard error packets on rx */
147 void fman_if_discard_rx_errors(struct fman_if *fm_if);
149 void fman_if_set_mcast_filter_table(struct fman_if *p);
151 void fman_if_reset_mcast_filter_table(struct fman_if *p);
153 int fman_if_add_hash_mac_addr(struct fman_if *p, uint8_t *eth);
155 int fman_if_get_primary_mac_addr(struct fman_if *p, uint8_t *eth);
158 /* Enable/disable Rx on all interfaces */
159 static inline void fman_if_enable_all_rx(void)
161 struct fman_if *__if;
163 list_for_each_entry(__if, fman_if_list, node)
164 fman_if_enable_rx(__if);
167 static inline void fman_if_disable_all_rx(void)
169 struct fman_if *__if;
171 list_for_each_entry(__if, fman_if_list, node)
172 fman_if_disable_rx(__if);
174 #endif /* __FSL_FMAN_H */