\hypertarget{mlx5__en__txrx_8c_source}{}\doxysection{mlx5\+\_\+en\+\_\+txrx.\+c}
\label{mlx5__en__txrx_8c_source}\index{dev/mlx5/mlx5\_en/mlx5\_en\_txrx.c@{dev/mlx5/mlx5\_en/mlx5\_en\_txrx.c}}
\mbox{\hyperlink{mlx5__en__txrx_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00002}00002 \textcolor{comment}{ * Copyright (c) 2015 Mellanox Technologies. All rights reserved.}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00004}00004 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00005}00005 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00006}00006 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00007}00007 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00008}00008 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00009}00009 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00010}00010 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00011}00011 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00012}00012 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00013}00013 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00014}00014 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00015}00015 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00016}00016 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00017}00017 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00018}00018 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00019}00019 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00020}00020 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00021}00021 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00022}00022 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00023}00023 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00024}00024 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00025}00025 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00026}00026 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00027}00027 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00028}00028 \textcolor{preprocessor}{\#include "{}opt\_rss.h"{}}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00029}00029 \textcolor{preprocessor}{\#include "{}opt\_ratelimit.h"{}}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00030}00030 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00031}00031 \textcolor{preprocessor}{\#include <linux/printk.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00032}00032 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{en_8h}{dev/mlx5/mlx5\_en/en.h}}>}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00034}00034 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00035}00035 \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__cqe64}{mlx5\_cqe64}} *}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00036}\mbox{\hyperlink{en_8h_a86f667d7fce082471e64ad721a51475b}{00036}} \mbox{\hyperlink{mlx5__en__txrx_8c_a86f667d7fce082471e64ad721a51475b}{mlx5e\_get\_cqe}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5e__cq}{mlx5e\_cq}} *\mbox{\hyperlink{en_8h_a124cdf1cec8a4103ace100a401cd893c}{cq}})}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00037}00037 \{}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00038}00038         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__cqe64}{mlx5\_cqe64}} *cqe;}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00039}00039 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00040}00040         cqe = \mbox{\hyperlink{wq_8h_acb024510e442f16bb20f9943b05eab7e}{mlx5\_cqwq\_get\_wqe}}(\&\mbox{\hyperlink{en_8h_a124cdf1cec8a4103ace100a401cd893c}{cq}}-\/>\mbox{\hyperlink{structmlx5e__cq_ad4b619ee0ca108ddb421d7922b5e097c}{wq}}, \mbox{\hyperlink{wq_8h_a42915eddc2714758c34c5a545f4fa526}{mlx5\_cqwq\_get\_ci}}(\&\mbox{\hyperlink{en_8h_a124cdf1cec8a4103ace100a401cd893c}{cq}}-\/>\mbox{\hyperlink{structmlx5e__cq_ad4b619ee0ca108ddb421d7922b5e097c}{wq}}));}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00041}00041 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00042}00042         \textcolor{keywordflow}{if} ((cqe-\/>\mbox{\hyperlink{structmlx5__cqe64_a3dbb1dc2c9f2ee64863edf7f750f5885}{op\_own}} \string^ \mbox{\hyperlink{wq_8h_a76609abed5afd3899c3ca1d8c14f7740}{mlx5\_cqwq\_get\_wrap\_cnt}}(\&\mbox{\hyperlink{en_8h_a124cdf1cec8a4103ace100a401cd893c}{cq}}-\/>\mbox{\hyperlink{structmlx5e__cq_ad4b619ee0ca108ddb421d7922b5e097c}{wq}})) \& \mbox{\hyperlink{cq_8h_adf764cbdea00d65edcd07bb9953ad2b7a62a86c5fb0a5057f1703dbe3d840e4e7}{MLX5\_CQE\_OWNER\_MASK}})}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00043}00043                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00044}00044 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00045}00045         \textcolor{comment}{/* ensure cqe content is read after cqe ownership bit */}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00046}00046         atomic\_thread\_fence\_acq();}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00047}00047 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00048}00048         \textcolor{keywordflow}{return} (cqe);}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00049}00049 \}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00050}00050 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00051}00051 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00052}\mbox{\hyperlink{en_8h_ac03b0b9463b1d6397f97d2ed63fc5a01}{00052}} \mbox{\hyperlink{mlx5__en__txrx_8c_ac03b0b9463b1d6397f97d2ed63fc5a01}{mlx5e\_cq\_error\_event}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__cq}{mlx5\_core\_cq}} *\mbox{\hyperlink{en_8h_af69a66154472918b7d1481f1b1d974c8}{mcq}}, \textcolor{keywordtype}{int} event)}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00053}00053 \{}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00054}00054         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5e__cq}{mlx5e\_cq}} *\mbox{\hyperlink{en_8h_a124cdf1cec8a4103ace100a401cd893c}{cq}} = container\_of(\mbox{\hyperlink{en_8h_af69a66154472918b7d1481f1b1d974c8}{mcq}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5e__cq}{mlx5e\_cq}}, \mbox{\hyperlink{en_8h_af69a66154472918b7d1481f1b1d974c8}{mcq}});}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00056}00056         \mbox{\hyperlink{en_8h_afb13f4447213bd251a32247e0b08ddfb}{mlx5\_en\_err}}(\mbox{\hyperlink{en_8h_a124cdf1cec8a4103ace100a401cd893c}{cq}}-\/>\mbox{\hyperlink{structmlx5e__cq_a85ef1e5daf51a239abc92fa86b8617bb}{priv}}-\/>\mbox{\hyperlink{structmlx5e__priv_afe944afbe198db0e1a84a20df94af781}{ifp}}, \textcolor{stringliteral}{"{}cqn=0x\%.6x event=0x\%.2x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00057}00057             \mbox{\hyperlink{en_8h_af69a66154472918b7d1481f1b1d974c8}{mcq}}-\/>\mbox{\hyperlink{structmlx5__core__cq_aa4a997291e120b040c7a95d59639e62a}{cqn}}, event);}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00058}00058 \}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00059}00059 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00060}00060 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00061}\mbox{\hyperlink{en_8h_a2f9a12822727cbe472b2f20291dc78d2}{00061}} \mbox{\hyperlink{mlx5__en__txrx_8c_a787b0c05691dc0f564e8b675957f04ab}{mlx5e\_dump\_err\_cqe}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5e__cq}{mlx5e\_cq}} *\mbox{\hyperlink{en_8h_a124cdf1cec8a4103ace100a401cd893c}{cq}}, u32 qn, \textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__err__cqe}{mlx5\_err\_cqe}} *err\_cqe)}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00062}00062 \{}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00063}00063         u32 ci;}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00064}00064 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00065}00065         \textcolor{comment}{/* Don't print flushed in error syndromes. */}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00066}00066         \textcolor{keywordflow}{if} (err\_cqe-\/>\mbox{\hyperlink{structmlx5__err__cqe_ae7316e407593439aef977b4c4b385d2a}{vendor\_err\_synd}} == 0xf9 \&\& err\_cqe-\/>\mbox{\hyperlink{structmlx5__err__cqe_a4ba3edd29f0fe4545eb5b82661f62ce2}{syndrome}} == 0x05)}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00067}00067                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00068}00068         \textcolor{comment}{/* Don't print when the queue is set to error state by software. */}}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00069}00069         \textcolor{keywordflow}{if} (err\_cqe-\/>\mbox{\hyperlink{structmlx5__err__cqe_ae7316e407593439aef977b4c4b385d2a}{vendor\_err\_synd}} == 0xf5 \&\& err\_cqe-\/>\mbox{\hyperlink{structmlx5__err__cqe_a4ba3edd29f0fe4545eb5b82661f62ce2}{syndrome}} == 0x05)}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00070}00070                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00071}00071 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00072}00072         ci = (\mbox{\hyperlink{en_8h_a124cdf1cec8a4103ace100a401cd893c}{cq}}-\/>\mbox{\hyperlink{structmlx5e__cq_ad4b619ee0ca108ddb421d7922b5e097c}{wq}}.\mbox{\hyperlink{structmlx5__cqwq_aa1f690c321868ccff5ec32e0c3540a8c}{cc}} -\/ 1) \& \mbox{\hyperlink{en_8h_a124cdf1cec8a4103ace100a401cd893c}{cq}}-\/>\mbox{\hyperlink{structmlx5e__cq_ad4b619ee0ca108ddb421d7922b5e097c}{wq}}.\mbox{\hyperlink{structmlx5__cqwq_a88acd1298a4533563bbecbcb4a1f69e6}{sz\_m1}};}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00073}00073 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00074}00074         \mbox{\hyperlink{en_8h_afb13f4447213bd251a32247e0b08ddfb}{mlx5\_en\_err}}(\mbox{\hyperlink{en_8h_a124cdf1cec8a4103ace100a401cd893c}{cq}}-\/>\mbox{\hyperlink{structmlx5e__cq_a85ef1e5daf51a239abc92fa86b8617bb}{priv}}-\/>\mbox{\hyperlink{structmlx5e__priv_afe944afbe198db0e1a84a20df94af781}{ifp}},}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00075}00075             \textcolor{stringliteral}{"{}Error CQE on CQN 0x\%x, CI 0x\%x, QN 0x\%x, OPCODE 0x\%x, SYNDROME 0x\%x, VENDOR SYNDROME 0x\%x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00076}00076             \mbox{\hyperlink{en_8h_a124cdf1cec8a4103ace100a401cd893c}{cq}}-\/>\mbox{\hyperlink{structmlx5e__cq_ad9262877d1d03c6f244bdd35128e89ba}{mcq}}.\mbox{\hyperlink{structmlx5__core__cq_aa4a997291e120b040c7a95d59639e62a}{cqn}}, ci, qn, err\_cqe-\/>\mbox{\hyperlink{structmlx5__err__cqe_a4d277f479d4c85dcd8c464ef9d6d06db}{op\_own}} >> 4,}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00077}00077             err\_cqe-\/>\mbox{\hyperlink{structmlx5__err__cqe_a4ba3edd29f0fe4545eb5b82661f62ce2}{syndrome}}, err\_cqe-\/>\mbox{\hyperlink{structmlx5__err__cqe_ae7316e407593439aef977b4c4b385d2a}{vendor\_err\_synd}});}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00078}00078 }
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00079}00079         print\_hex\_dump(NULL, NULL, DUMP\_PREFIX\_OFFSET,}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00080}00080             16, 1, err\_cqe, \textcolor{keyword}{sizeof}(*err\_cqe), \textcolor{keyword}{false});}
\DoxyCodeLine{\Hypertarget{mlx5__en__txrx_8c_source_l00081}00081 \}}

\end{DoxyCode}
