\hypertarget{mlx5__diagnostics_8c_source}{}\doxysection{mlx5\+\_\+diagnostics.\+c}
\label{mlx5__diagnostics_8c_source}\index{dev/mlx5/mlx5\_core/mlx5\_diagnostics.c@{dev/mlx5/mlx5\_core/mlx5\_diagnostics.c}}
\mbox{\hyperlink{mlx5__diagnostics_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00002}00002 \textcolor{comment}{ * Copyright (c) 2013-\/2017, Mellanox Technologies, Ltd.  All rights reserved.}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00004}00004 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00005}00005 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00006}00006 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00007}00007 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00008}00008 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00009}00009 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00010}00010 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00011}00011 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00012}00012 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00013}00013 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00014}00014 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00015}00015 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00016}00016 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00017}00017 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00018}00018 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00019}00019 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00020}00020 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00021}00021 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00022}00022 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00023}00023 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00024}00024 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00025}00025 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00026}00026 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00027}00027 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00028}00028 \textcolor{preprocessor}{\#include "{}opt\_rss.h"{}}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00029}00029 \textcolor{preprocessor}{\#include "{}opt\_ratelimit.h"{}}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00030}00030 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00031}00031 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{driver_8h}{dev/mlx5/driver.h}}>}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{port_8h}{dev/mlx5/port.h}}>}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{diagnostics_8h}{dev/mlx5/diagnostics.h}}>}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{mlx5__core_8h}{dev/mlx5/mlx5\_core/mlx5\_core.h}}>}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <net/sff8472.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00036}00036 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00037}00037 \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__core__diagnostics__entry}{mlx5\_core\_diagnostics\_entry}}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00038}\mbox{\hyperlink{diagnostics_8h_abc401592678e18f1f00922140bacfb75}{00038}}         \mbox{\hyperlink{mlx5__diagnostics_8c_a87e1fa09dbf03ff0413b9a4246e89ffc}{mlx5\_core\_pci\_diagnostics\_table}}[}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00039}00039                 \mbox{\hyperlink{diagnostics_8h_a78075f2194bf8c27dfe1630c064866cd}{MLX5\_CORE\_PCI\_DIAGNOSTICS\_NUM}}] = \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00040}00040         \mbox{\hyperlink{diagnostics_8h_a8a4d564bca272b990b9454d4e5a750fb}{MLX5\_CORE\_PCI\_DIAGNOSTICS}}(\mbox{\hyperlink{diagnostics_8h_a3185f3c4f19a9977d92c2115ef2fa408}{MLX5\_CORE\_DIAGNOSTICS\_ENTRY}})}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00041}00041 \};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00042}00042 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00043}00043 \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__core__diagnostics__entry}{mlx5\_core\_diagnostics\_entry}}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00044}\mbox{\hyperlink{diagnostics_8h_ac02a3acc52b0b521aff23f44dcbc81e3}{00044}}         \mbox{\hyperlink{mlx5__diagnostics_8c_a4283ebb782ae02032d8b904321b0b2cf}{mlx5\_core\_general\_diagnostics\_table}}[}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00045}00045                 \mbox{\hyperlink{diagnostics_8h_a51625de9157770f21f56084a50008198}{MLX5\_CORE\_GENERAL\_DIAGNOSTICS\_NUM}}] = \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00046}00046         \mbox{\hyperlink{diagnostics_8h_aeae5b4945ab86c8bdd5e12285f55c062}{MLX5\_CORE\_GENERAL\_DIAGNOSTICS}}(\mbox{\hyperlink{diagnostics_8h_a3185f3c4f19a9977d92c2115ef2fa408}{MLX5\_CORE\_DIAGNOSTICS\_ENTRY}})}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00047}00047 \};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00048}00048 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00049}\mbox{\hyperlink{mlx5__diagnostics_8c_a942bb95d6139c49298e7634d796a59d1}{00049}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__diagnostics_8c_a942bb95d6139c49298e7634d796a59d1}{mlx5\_core\_get\_index\_of\_diag\_counter}}(}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00050}00050         \textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__diagnostics__entry}{mlx5\_core\_diagnostics\_entry}} *entry,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00051}00051         \textcolor{keywordtype}{int} size, u16 \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}})}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00052}00052 \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00053}00053         \textcolor{keywordtype}{int} x;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00054}00054 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00055}00055         \textcolor{comment}{/* check for invalid counter ID */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00056}00056         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}} == 0)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00057}00057                 \textcolor{keywordflow}{return} -\/1;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00059}00059         \textcolor{comment}{/* lookup counter ID in table */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00060}00060         \textcolor{keywordflow}{for} (x = 0; x != size; x++) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00061}00061                 \textcolor{keywordflow}{if} (entry[x].\mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}} == \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}})}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00062}00062                         \textcolor{keywordflow}{return} x;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00063}00063         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00064}00064         \textcolor{keywordflow}{return} -\/1;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00065}00065 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00066}00066 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00067}\mbox{\hyperlink{mlx5__diagnostics_8c_aa7ec9a657ee8d665863fd486f7483441}{00067}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__diagnostics_8c_aa7ec9a657ee8d665863fd486f7483441}{mlx5\_core\_put\_diag\_counter}}(}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00068}00068         \textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__diagnostics__entry}{mlx5\_core\_diagnostics\_entry}} *entry,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00069}00069         u64 *array, \textcolor{keywordtype}{int} size, u16 \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}}, u64 value)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00070}00070 \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00071}00071         \textcolor{keywordtype}{int} x;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00072}00072 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00073}00073         \textcolor{comment}{/* check for invalid counter ID */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00074}00074         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}} == 0)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00075}00075                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00076}00076 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00077}00077         \textcolor{comment}{/* lookup counter ID in table */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00078}00078         \textcolor{keywordflow}{for} (x = 0; x != size; x++) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00079}00079                 \textcolor{keywordflow}{if} (entry[x].\mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}} == \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00080}00080                         array[x] = value;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00081}00081                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00082}00082                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00083}00083         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00084}00084 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00086}\mbox{\hyperlink{diagnostics_8h_a8119f9ce2267687f5ad06db5d26f4488}{00086}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__diagnostics_8c_a96465c3fa1bd8df3ad42de0dc68c52ec}{mlx5\_core\_set\_diagnostics\_full}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *dev,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00087}00087                                    u8 enable\_pci, u8 enable\_general)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00088}00088 \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00089}00089         \textcolor{keywordtype}{void} *diag\_params\_ctx;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00090}00090         \textcolor{keywordtype}{void} *in;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00091}00091         \textcolor{keywordtype}{int} numcounters;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00092}00092         \textcolor{keywordtype}{int} inlen;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00093}00093         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00094}00094         \textcolor{keywordtype}{int} x;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00095}00095         \textcolor{keywordtype}{int} y;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00096}00096 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00097}00097         \textcolor{keywordflow}{if} (\mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(dev, debug) == 0)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00098}00098                 \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00099}00099 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00100}00100         numcounters = \mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(dev, num\_of\_diagnostic\_counters);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00101}00101         \textcolor{keywordflow}{if} (numcounters == 0)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00102}00102                 \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00103}00103 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00104}00104         inlen = \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(set\_diagnostic\_params\_in) +}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00105}00105             \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(diagnostic\_counter) * numcounters;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00106}00106         in = \mbox{\hyperlink{driver_8h_af928b1985830513c1c81b095b31ad8a7}{mlx5\_vzalloc}}(inlen);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00107}00107         \textcolor{keywordflow}{if} (in == NULL)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00108}00108                 \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00109}00109 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00110}00110         diag\_params\_ctx = \mbox{\hyperlink{device_8h_ad5cad9c2e464873013bfb7b9761d25a1}{MLX5\_ADDR\_OF}}(set\_diagnostic\_params\_in, in,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00111}00111                                        diagnostic\_params\_ctx);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00112}00112 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00113}00113         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(diagnostic\_params\_context, diag\_params\_ctx,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00114}00114                  enable, enable\_pci || enable\_general);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00115}00115         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(diagnostic\_params\_context, diag\_params\_ctx,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00116}00116                  single, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00117}00117         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(diagnostic\_params\_context, diag\_params\_ctx,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00118}00118                  on\_demand, 1);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00119}00119 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00120}00120         \textcolor{comment}{/* collect the counters we want to enable */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00121}00121         \textcolor{keywordflow}{for} (x = y = 0; x != numcounters; x++) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00122}00122                 u16 \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}} =}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00123}00123                         \mbox{\hyperlink{device_8h_abb3a60f881889fe61a749759d05357eca65362f1dddc45a3df2fec90db134253e}{MLX5\_CAP\_DEBUG}}(dev, diagnostic\_counter[x].\mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}});}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00124}00124                 \textcolor{keywordtype}{int} index = -\/1;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00125}00125 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00126}00126                 \textcolor{keywordflow}{if} (index < 0 \&\& enable\_pci != 0) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00127}00127                         \textcolor{comment}{/* check if counter ID exists in local table */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00128}00128                         index = \mbox{\hyperlink{mlx5__diagnostics_8c_a942bb95d6139c49298e7634d796a59d1}{mlx5\_core\_get\_index\_of\_diag\_counter}}(}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00129}00129                             \mbox{\hyperlink{mlx5__diagnostics_8c_a87e1fa09dbf03ff0413b9a4246e89ffc}{mlx5\_core\_pci\_diagnostics\_table}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00130}00130                             \mbox{\hyperlink{diagnostics_8h_a78075f2194bf8c27dfe1630c064866cd}{MLX5\_CORE\_PCI\_DIAGNOSTICS\_NUM}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00131}00131                             \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}});}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00132}00132                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00133}00133                 \textcolor{keywordflow}{if} (index < 0 \&\& enable\_general != 0) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00134}00134                         \textcolor{comment}{/* check if counter ID exists in local table */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00135}00135                         index = \mbox{\hyperlink{mlx5__diagnostics_8c_a942bb95d6139c49298e7634d796a59d1}{mlx5\_core\_get\_index\_of\_diag\_counter}}(}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00136}00136                             \mbox{\hyperlink{mlx5__diagnostics_8c_a4283ebb782ae02032d8b904321b0b2cf}{mlx5\_core\_general\_diagnostics\_table}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00137}00137                             \mbox{\hyperlink{diagnostics_8h_a51625de9157770f21f56084a50008198}{MLX5\_CORE\_GENERAL\_DIAGNOSTICS\_NUM}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00138}00138                             \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}});}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00139}00139                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00140}00140                 \textcolor{keywordflow}{if} (index < 0)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00141}00141                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00142}00142 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00143}00143                 \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(diagnostic\_params\_context,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00144}00144                          diag\_params\_ctx,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00145}00145                          \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}}[y].\mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00146}00146                          \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}});}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00147}00147                 y++;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00148}00148         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00149}00149 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00150}00150         \textcolor{comment}{/* recompute input length */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00151}00151         inlen = \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(set\_diagnostic\_params\_in) +}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00152}00152             \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(diagnostic\_counter) * y;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00153}00153 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00154}00154         \textcolor{comment}{/* set number of counters */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00155}00155         \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(diagnostic\_params\_context, diag\_params\_ctx,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00156}00156                  num\_of\_counters, y);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00157}00157 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00158}00158         \textcolor{comment}{/* execute firmware command */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00159}00159         err = \mbox{\hyperlink{driver_8h_a9c524c6d3bce42c90eb4ff2d4297455b}{mlx5\_set\_diagnostic\_params}}(dev, in, inlen);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00160}00160 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00161}00161         kvfree(in);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00162}00162 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00163}00163         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00164}00164 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00165}00165 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00166}\mbox{\hyperlink{diagnostics_8h_a86f48a41965c67d9e0304122ed8327c4}{00166}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__diagnostics_8c_a61f345b48d6edcf492c4f51e9fc7d196}{mlx5\_core\_get\_diagnostics\_full}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *dev,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00167}00167                                    \textcolor{keyword}{union} \mbox{\hyperlink{unionmlx5__core__pci__diagnostics}{mlx5\_core\_pci\_diagnostics}} *pdiag,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00168}00168                                    \textcolor{keyword}{union} \mbox{\hyperlink{unionmlx5__core__general__diagnostics}{mlx5\_core\_general\_diagnostics}} *pgen)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00169}00169 \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00170}00170         \textcolor{keywordtype}{void} *out;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00171}00171         \textcolor{keywordtype}{void} *in;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00172}00172         \textcolor{keywordtype}{int} numcounters;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00173}00173         \textcolor{keywordtype}{int} outlen;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00174}00174         \textcolor{keywordtype}{int} inlen;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00175}00175         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00176}00176         \textcolor{keywordtype}{int} x;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00177}00177 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00178}00178         \textcolor{keywordflow}{if} (\mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(dev, debug) == 0)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00179}00179                 \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00180}00180 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00181}00181         numcounters = \mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(dev, num\_of\_diagnostic\_counters);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00182}00182         \textcolor{keywordflow}{if} (numcounters == 0)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00183}00183                 \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00184}00184 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00185}00185         outlen = \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(query\_diagnostic\_counters\_out) +}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00186}00186             \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(diagnostic\_counter) * numcounters;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00187}00187 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00188}00188         out = \mbox{\hyperlink{driver_8h_af928b1985830513c1c81b095b31ad8a7}{mlx5\_vzalloc}}(outlen);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00189}00189         \textcolor{keywordflow}{if} (out == NULL)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00190}00190                 \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00191}00191 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00192}00192         err = \mbox{\hyperlink{driver_8h_a0e73dc5444d1ef37219430959be09460}{mlx5\_query\_diagnostic\_counters}}(dev, 1, 0, out, outlen);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00193}00193         \textcolor{keywordflow}{if} (err == 0) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00194}00194                 \textcolor{keywordflow}{for} (x = 0; x != numcounters; x++) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00195}00195                         u16 \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}} = \mbox{\hyperlink{device_8h_a12a03f8a456490fce8c791c7f2922f97}{MLX5\_GET}}(}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00196}00196                             query\_diagnostic\_counters\_out,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00197}00197                             out, diag\_counter[x].\mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}});}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00198}00198                         u64 counter\_value = \mbox{\hyperlink{device_8h_ac7ded81380b3a6c3a63a7c9f4581368b}{MLX5\_GET64}}(}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00199}00199                             query\_diagnostic\_counters\_out,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00200}00200                             out, diag\_counter[x].counter\_value\_h);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00201}00201 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00202}00202                         \textcolor{keywordflow}{if} (pdiag != NULL) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00203}00203                                 \mbox{\hyperlink{mlx5__diagnostics_8c_aa7ec9a657ee8d665863fd486f7483441}{mlx5\_core\_put\_diag\_counter}}(}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00204}00204                                     \mbox{\hyperlink{mlx5__diagnostics_8c_a87e1fa09dbf03ff0413b9a4246e89ffc}{mlx5\_core\_pci\_diagnostics\_table}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00205}00205                                     pdiag-\/>\mbox{\hyperlink{unionmlx5__core__pci__diagnostics_a253059b17b683329f7e61c72bfa1d86f}{array}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00206}00206                                     \mbox{\hyperlink{diagnostics_8h_a78075f2194bf8c27dfe1630c064866cd}{MLX5\_CORE\_PCI\_DIAGNOSTICS\_NUM}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00207}00207                                     \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}}, counter\_value);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00208}00208                         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00209}00209                         \textcolor{keywordflow}{if} (pgen != NULL) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00210}00210                                 \mbox{\hyperlink{mlx5__diagnostics_8c_aa7ec9a657ee8d665863fd486f7483441}{mlx5\_core\_put\_diag\_counter}}(}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00211}00211                                     \mbox{\hyperlink{mlx5__diagnostics_8c_a4283ebb782ae02032d8b904321b0b2cf}{mlx5\_core\_general\_diagnostics\_table}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00212}00212                                     pgen-\/>\mbox{\hyperlink{unionmlx5__core__general__diagnostics_a795959b86dca310d59fdb8d5ee94a970}{array}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00213}00213                                     \mbox{\hyperlink{diagnostics_8h_a51625de9157770f21f56084a50008198}{MLX5\_CORE\_GENERAL\_DIAGNOSTICS\_NUM}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00214}00214                                     \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}}, counter\_value);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00215}00215                         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00216}00216                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00217}00217         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00218}00218         kvfree(out);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00219}00219 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00220}00220         \textcolor{keywordflow}{if} (pdiag != NULL) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00221}00221                 inlen = \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(mpcnt\_reg);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00222}00222                 outlen = \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(mpcnt\_reg);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00223}00223 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00224}00224                 in = \mbox{\hyperlink{driver_8h_af928b1985830513c1c81b095b31ad8a7}{mlx5\_vzalloc}}(inlen);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00225}00225                 \textcolor{keywordflow}{if} (in == NULL)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00226}00226                         \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00227}00227 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00228}00228                 out = \mbox{\hyperlink{driver_8h_af928b1985830513c1c81b095b31ad8a7}{mlx5\_vzalloc}}(outlen);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00229}00229                 \textcolor{keywordflow}{if} (out == NULL) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00230}00230                         kvfree(in);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00231}00231                         \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00232}00232                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00233}00233                 \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mpcnt\_reg, in, grp,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00234}00234                          \mbox{\hyperlink{device_8h_a2f80701c36e79c0640d91c788feee0b3a9f55690d83f9a3f413fd68f9048529f5}{MLX5\_PCIE\_PERFORMANCE\_COUNTERS\_GROUP}});}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00235}00235 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00236}00236                 err = \mbox{\hyperlink{driver_8h_a588ab969bb7070e2dc60df62da38c8fa}{mlx5\_core\_access\_reg}}(dev, in, inlen, out, outlen,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00237}00237                                            \mbox{\hyperlink{driver_8h_a3babbf89cae9b856a12864a41506efbdaff8dfbd893873b77f99d213d6e7e3ba6}{MLX5\_REG\_MPCNT}}, 0, 0);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00238}00238                 \textcolor{keywordflow}{if} (err == 0) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00239}00239                         \textcolor{keywordtype}{void} *pcounters = \mbox{\hyperlink{device_8h_ad5cad9c2e464873013bfb7b9761d25a1}{MLX5\_ADDR\_OF}}(mpcnt\_reg, out,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00240}00240                             counter\_set.pcie\_perf\_counters);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00241}00241 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00242}00242                         pdiag-\/>\mbox{\hyperlink{unionmlx5__core__pci__diagnostics_aae72754dfc3c558c01afe6f7bfc93141}{counter}}.rx\_pci\_errors =}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00243}00243                             \mbox{\hyperlink{device_8h_a12a03f8a456490fce8c791c7f2922f97}{MLX5\_GET}}(pcie\_perf\_counters,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00244}00244                                      pcounters, rx\_errors);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00245}00245                         pdiag-\/>\mbox{\hyperlink{unionmlx5__core__pci__diagnostics_aae72754dfc3c558c01afe6f7bfc93141}{counter}}.tx\_pci\_errors =}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00246}00246                             \mbox{\hyperlink{device_8h_a12a03f8a456490fce8c791c7f2922f97}{MLX5\_GET}}(pcie\_perf\_counters,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00247}00247                                      pcounters, tx\_errors);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00248}00248                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00249}00249                 \mbox{\hyperlink{device_8h_a78623a3e69c7911bd715d06c32daa626}{MLX5\_SET}}(mpcnt\_reg, in, grp,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00250}00250                          \mbox{\hyperlink{device_8h_a2f80701c36e79c0640d91c788feee0b3a5c52a4c432400bb15b9b0f69dd0e1c0a}{MLX5\_PCIE\_TIMERS\_AND\_STATES\_COUNTERS\_GROUP}});}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00251}00251 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00252}00252                 err = \mbox{\hyperlink{driver_8h_a588ab969bb7070e2dc60df62da38c8fa}{mlx5\_core\_access\_reg}}(dev, in, inlen, out, outlen,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00253}00253                     \mbox{\hyperlink{driver_8h_a3babbf89cae9b856a12864a41506efbdaff8dfbd893873b77f99d213d6e7e3ba6}{MLX5\_REG\_MPCNT}}, 0, 0);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00254}00254                 \textcolor{keywordflow}{if} (err == 0) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00255}00255                         \textcolor{keywordtype}{void} *pcounters = \mbox{\hyperlink{device_8h_ad5cad9c2e464873013bfb7b9761d25a1}{MLX5\_ADDR\_OF}}(mpcnt\_reg, out,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00256}00256                             counter\_set.pcie\_timers\_states);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00257}00257 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00258}00258                         pdiag-\/>\mbox{\hyperlink{unionmlx5__core__pci__diagnostics_aae72754dfc3c558c01afe6f7bfc93141}{counter}}.tx\_pci\_non\_fatal\_errors =}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00259}00259                             \mbox{\hyperlink{device_8h_a12a03f8a456490fce8c791c7f2922f97}{MLX5\_GET}}(pcie\_timers\_states,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00260}00260                                      pcounters, non\_fatal\_err\_msg\_sent);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00261}00261                         pdiag-\/>\mbox{\hyperlink{unionmlx5__core__pci__diagnostics_aae72754dfc3c558c01afe6f7bfc93141}{counter}}.tx\_pci\_fatal\_errors =}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00262}00262                             \mbox{\hyperlink{device_8h_a12a03f8a456490fce8c791c7f2922f97}{MLX5\_GET}}(pcie\_timers\_states,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00263}00263                                      pcounters, fatal\_err\_msg\_sent);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00264}00264                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00265}00265                 kvfree(in);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00266}00266                 kvfree(out);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00267}00267         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00268}00268         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00269}00269 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00270}00270 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00271}\mbox{\hyperlink{diagnostics_8h_ae08773a28ebd8a8ad883d39acb1d32a6}{00271}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__diagnostics_8c_a4a16de0d75ec174f21577c1e57bca51b}{mlx5\_core\_supports\_diagnostics}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *dev, u16 \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}})}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00272}00272 \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00273}00273         \textcolor{keywordtype}{int} numcounters;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00274}00274         \textcolor{keywordtype}{int} x;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00275}00275 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00276}00276         \textcolor{keywordflow}{if} (\mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(dev, debug) == 0)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00277}00277                 \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00278}00278 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00279}00279         \textcolor{comment}{/* check for any counter */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00280}00280         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}} == 0)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00281}00281                 \textcolor{keywordflow}{return} 1;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00282}00282 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00283}00283         numcounters = \mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(dev, num\_of\_diagnostic\_counters);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00284}00284 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00285}00285         \textcolor{comment}{/* check if counter ID exists in debug capability */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00286}00286         \textcolor{keywordflow}{for} (x = 0; x != numcounters; x++) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00287}00287                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{device_8h_abb3a60f881889fe61a749759d05357eca65362f1dddc45a3df2fec90db134253e}{MLX5\_CAP\_DEBUG}}(dev, diagnostic\_counter[x].\mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}}) ==}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00288}00288                     \mbox{\hyperlink{structmlx5__core__diagnostics__entry_a90e81a3fc16bb67bf7d87f2013f0cdfc}{counter\_id}})}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00289}00289                         \textcolor{keywordflow}{return} 1;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00290}00290         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00291}00291         \textcolor{keywordflow}{return} 0;                       \textcolor{comment}{/* not supported counter */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00292}00292 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00293}00293 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00294}00294 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00295}00295 \textcolor{comment}{ * Read the first three bytes of the eeprom in order to get the needed info}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00296}00296 \textcolor{comment}{ * for the whole reading.}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00297}00297 \textcolor{comment}{ * Byte 0 -\/ Identifier byte}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00298}00298 \textcolor{comment}{ * Byte 1 -\/ Revision byte}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00299}00299 \textcolor{comment}{ * Byte 2 -\/ Status byte}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00300}00300 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00301}00301 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00302}\mbox{\hyperlink{diagnostics_8h_a081609d563276d52d14f519efca758b0}{00302}} \mbox{\hyperlink{mlx5__diagnostics_8c_a081609d563276d52d14f519efca758b0}{mlx5\_get\_eeprom\_info}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *dev, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__eeprom}{mlx5\_eeprom}} *eeprom)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00303}00303 \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00304}00304         u32 \mbox{\hyperlink{mlx5__en__tx_8c_af943c26117683b64b9cd6943e2c496e5}{data}} = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00305}00305         \textcolor{keywordtype}{int} size\_read = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00306}00306         \textcolor{keywordtype}{int} ret;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00307}00307 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00308}00308         ret = \mbox{\hyperlink{mlx5__port_8c_a79915817bf848b70fa91e71a4890a669}{mlx5\_query\_module\_num}}(dev, \&eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_af7c0617ed733ca2aa36f87a2baf3f0f1}{module\_num}});}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00309}00309         \textcolor{keywordflow}{if} (ret) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00310}00310                 \mbox{\hyperlink{mlx5__core_8h_aeead4611cdbd6dbc272371c77201a6a5}{mlx5\_core\_err}}(dev, \textcolor{stringliteral}{"{}Failed query module error=\%d\(\backslash\)n"{}}, ret);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00311}00311                 \textcolor{keywordflow}{return} (-\/ret);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00312}00312         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00313}00313 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00314}00314         \textcolor{comment}{/* Read the first three bytes to get Identifier, Revision and Status */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00315}00315         ret = \mbox{\hyperlink{mlx5__port_8c_a68b553361f112504e6c7e0b875e2feff}{mlx5\_query\_eeprom}}(dev, eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_ac2ef50b162ef4dfb5863b387152b8dba}{i2c\_addr}}, eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_ac53d68b3cf00b8cfa85b50095cbea899}{page\_num}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00316}00316             eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}}, \mbox{\hyperlink{port_8h_abae63956620268fcd191ce6c772fa49e}{MLX5\_EEPROM\_INFO\_BYTES}}, eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_af7c0617ed733ca2aa36f87a2baf3f0f1}{module\_num}}, \&\mbox{\hyperlink{mlx5__en__tx_8c_af943c26117683b64b9cd6943e2c496e5}{data}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00317}00317             \&size\_read);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00318}00318         \textcolor{keywordflow}{if} (ret) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00319}00319                 \mbox{\hyperlink{mlx5__core_8h_aeead4611cdbd6dbc272371c77201a6a5}{mlx5\_core\_err}}(dev,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00320}00320                     \textcolor{stringliteral}{"{}Failed query EEPROM module error=0x\%x\(\backslash\)n"{}}, ret);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00321}00321                 \textcolor{keywordflow}{return} (-\/ret);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00322}00322         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00323}00323 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00324}00324         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{mlx5__en__tx_8c_af943c26117683b64b9cd6943e2c496e5}{data}} \& \mbox{\hyperlink{port_8h_a3edc193814e752262519230aad591114}{MLX5\_EEPROM\_IDENTIFIER\_BYTE\_MASK}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00325}00325         \textcolor{keywordflow}{case} SFF\_8024\_ID\_QSFP:}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00326}00326                 eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_a869d5225ef5964d04d4d835f44ae9855}{type}} = \mbox{\hyperlink{port_8h_ad7d4d5d5299b0699fd28b0bd93e30e43}{MLX5\_ETH\_MODULE\_SFF\_8436}};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00327}00327                 eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_abf6ca9a363668fce6edc11b25c071db4}{len}} = \mbox{\hyperlink{port_8h_a5933fd5ced93ea0459948b88877d8d1a}{MLX5\_ETH\_MODULE\_SFF\_8436\_LEN}};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00328}00328                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00329}00329         \textcolor{keywordflow}{case} SFF\_8024\_ID\_QSFPPLUS:}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00330}00330         \textcolor{keywordflow}{case} SFF\_8024\_ID\_QSFP28:}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00331}00331                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{mlx5__en__tx_8c_af943c26117683b64b9cd6943e2c496e5}{data}} \& \mbox{\hyperlink{port_8h_a3edc193814e752262519230aad591114}{MLX5\_EEPROM\_IDENTIFIER\_BYTE\_MASK}}) == SFF\_8024\_ID\_QSFP28 ||}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00332}00332                     ((\mbox{\hyperlink{mlx5__en__tx_8c_af943c26117683b64b9cd6943e2c496e5}{data}} \& \mbox{\hyperlink{port_8h_a6f26062bef44fd9bd91f04f6f4e6787a}{MLX5\_EEPROM\_REVISION\_ID\_BYTE\_MASK}}) >> 8) >= 0x3) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00333}00333                         eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_a869d5225ef5964d04d4d835f44ae9855}{type}} = \mbox{\hyperlink{port_8h_a3abde693d21d0ab3d8fce5adcabdb742}{MLX5\_ETH\_MODULE\_SFF\_8636}};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00334}00334                         eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_abf6ca9a363668fce6edc11b25c071db4}{len}} = \mbox{\hyperlink{port_8h_aa9d4a37b396f78e86d90244982d7faa5}{MLX5\_ETH\_MODULE\_SFF\_8636\_LEN}};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00335}00335                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00336}00336                         eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_a869d5225ef5964d04d4d835f44ae9855}{type}} = \mbox{\hyperlink{port_8h_ad7d4d5d5299b0699fd28b0bd93e30e43}{MLX5\_ETH\_MODULE\_SFF\_8436}};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00337}00337                         eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_abf6ca9a363668fce6edc11b25c071db4}{len}} = \mbox{\hyperlink{port_8h_a5933fd5ced93ea0459948b88877d8d1a}{MLX5\_ETH\_MODULE\_SFF\_8436\_LEN}};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00338}00338                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00339}00339                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{mlx5__en__tx_8c_af943c26117683b64b9cd6943e2c496e5}{data}} \& \mbox{\hyperlink{port_8h_ade7e2c5c8121fb2beeeab413adec88ce}{MLX5\_EEPROM\_PAGE\_3\_VALID\_BIT\_MASK}}) == 0)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00340}00340                         eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_a7f1b41e312e78a9956c0faa32ff09d3e}{page\_valid}} = 1;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00341}00341                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00342}00342         \textcolor{keywordflow}{case} SFF\_8024\_ID\_SFP:}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00343}00343                 eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_a869d5225ef5964d04d4d835f44ae9855}{type}} = \mbox{\hyperlink{port_8h_a2ff07809f81ea97cc8b85554e17efc17}{MLX5\_ETH\_MODULE\_SFF\_8472}};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00344}00344                 eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_abf6ca9a363668fce6edc11b25c071db4}{len}} = \mbox{\hyperlink{port_8h_afd52d81cfc8cbae36c89d1179d1408c2}{MLX5\_ETH\_MODULE\_SFF\_8472\_LEN}};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00345}00345                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00346}00346         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00347}00347                 \mbox{\hyperlink{mlx5__core_8h_aeead4611cdbd6dbc272371c77201a6a5}{mlx5\_core\_err}}(dev, \textcolor{stringliteral}{"{}Not recognized cable type = 0x\%x(\%s)\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00348}00348                     \mbox{\hyperlink{mlx5__en__tx_8c_af943c26117683b64b9cd6943e2c496e5}{data}} \& \mbox{\hyperlink{port_8h_a3edc193814e752262519230aad591114}{MLX5\_EEPROM\_IDENTIFIER\_BYTE\_MASK}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00349}00349                     sff\_8024\_id[\mbox{\hyperlink{mlx5__en__tx_8c_af943c26117683b64b9cd6943e2c496e5}{data}} \& \mbox{\hyperlink{port_8h_a3edc193814e752262519230aad591114}{MLX5\_EEPROM\_IDENTIFIER\_BYTE\_MASK}}]);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00350}00350                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00351}00351         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00352}00352         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00353}00353 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00354}00354 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00355}00355 \textcolor{comment}{/* Read both low and high pages of the eeprom */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00356}00356 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00357}\mbox{\hyperlink{diagnostics_8h_a1107f6b61f43b5591965b89dc200a093}{00357}} \mbox{\hyperlink{mlx5__diagnostics_8c_a1107f6b61f43b5591965b89dc200a093}{mlx5\_get\_eeprom}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *dev, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__eeprom}{mlx5\_eeprom}} *ee)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00358}00358 \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00359}00359         \textcolor{keywordtype}{int} size\_read = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00360}00360         \textcolor{keywordtype}{int} ret;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00361}00361 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00362}00362         \textcolor{keywordflow}{if} (ee-\/>\mbox{\hyperlink{structmlx5__eeprom_abf6ca9a363668fce6edc11b25c071db4}{len}} == 0)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00363}00363                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00364}00364 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00365}00365         \textcolor{comment}{/* Read low page of the eeprom */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00366}00366         \textcolor{keywordflow}{while} (ee-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}} < ee-\/>\mbox{\hyperlink{structmlx5__eeprom_abf6ca9a363668fce6edc11b25c071db4}{len}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00367}00367                 ret = \mbox{\hyperlink{mlx5__port_8c_a68b553361f112504e6c7e0b875e2feff}{mlx5\_query\_eeprom}}(dev, ee-\/>\mbox{\hyperlink{structmlx5__eeprom_ac2ef50b162ef4dfb5863b387152b8dba}{i2c\_addr}}, ee-\/>\mbox{\hyperlink{structmlx5__eeprom_ac53d68b3cf00b8cfa85b50095cbea899}{page\_num}}, ee-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00368}00368                     ee-\/>\mbox{\hyperlink{structmlx5__eeprom_abf6ca9a363668fce6edc11b25c071db4}{len}} -\/ ee-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}}, ee-\/>\mbox{\hyperlink{structmlx5__eeprom_af7c0617ed733ca2aa36f87a2baf3f0f1}{module\_num}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00369}00369                     ee-\/>\mbox{\hyperlink{structmlx5__eeprom_ade7ff0de51349d4e3c07842a3030312c}{data}} + (ee-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}} / 4), \&size\_read);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00370}00370                 \textcolor{keywordflow}{if} (ret) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00371}00371                         \mbox{\hyperlink{mlx5__core_8h_aeead4611cdbd6dbc272371c77201a6a5}{mlx5\_core\_err}}(dev,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00372}00372                             \textcolor{stringliteral}{"{}Failed reading EEPROM, error = 0x\%02x\(\backslash\)n"{}}, ret);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00373}00373                         \textcolor{keywordflow}{return} (-\/ret);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00374}00374                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00375}00375                 ee-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}} += size\_read;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00376}00376         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00377}00377 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00378}00378         \textcolor{comment}{/* Read high page of the eeprom */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00379}00379         \textcolor{keywordflow}{if} (ee-\/>\mbox{\hyperlink{structmlx5__eeprom_a7f1b41e312e78a9956c0faa32ff09d3e}{page\_valid}} == 1) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00380}00380                 ee-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}} = \mbox{\hyperlink{port_8h_a4366db5eb1d7f16926aae9adf4a37249}{MLX5\_EEPROM\_HIGH\_PAGE\_OFFSET}};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00381}00381                 ee-\/>\mbox{\hyperlink{structmlx5__eeprom_ac53d68b3cf00b8cfa85b50095cbea899}{page\_num}} = \mbox{\hyperlink{port_8h_a2beb9b511603d0e6bf770a1c34783b27}{MLX5\_EEPROM\_HIGH\_PAGE}};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00382}00382                 size\_read = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00383}00383                 \textcolor{keywordflow}{while} (ee-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}} < \mbox{\hyperlink{port_8h_a73d06cbb4572124a1079a15daa58293d}{MLX5\_EEPROM\_PAGE\_LENGTH}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00384}00384                         ret = \mbox{\hyperlink{mlx5__port_8c_a68b553361f112504e6c7e0b875e2feff}{mlx5\_query\_eeprom}}(dev, ee-\/>\mbox{\hyperlink{structmlx5__eeprom_ac2ef50b162ef4dfb5863b387152b8dba}{i2c\_addr}}, ee-\/>\mbox{\hyperlink{structmlx5__eeprom_ac53d68b3cf00b8cfa85b50095cbea899}{page\_num}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00385}00385                             ee-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}}, \mbox{\hyperlink{port_8h_a73d06cbb4572124a1079a15daa58293d}{MLX5\_EEPROM\_PAGE\_LENGTH}} -\/ ee-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00386}00386                             ee-\/>\mbox{\hyperlink{structmlx5__eeprom_af7c0617ed733ca2aa36f87a2baf3f0f1}{module\_num}}, ee-\/>\mbox{\hyperlink{structmlx5__eeprom_ade7ff0de51349d4e3c07842a3030312c}{data}} + (ee-\/>\mbox{\hyperlink{structmlx5__eeprom_abf6ca9a363668fce6edc11b25c071db4}{len}} / 4) +}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00387}00387                             ((ee-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}} -\/ \mbox{\hyperlink{port_8h_a4366db5eb1d7f16926aae9adf4a37249}{MLX5\_EEPROM\_HIGH\_PAGE\_OFFSET}}) / 4),}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00388}00388                             \&size\_read);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00389}00389                         \textcolor{keywordflow}{if} (ret) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00390}00390                                 \mbox{\hyperlink{mlx5__core_8h_aeead4611cdbd6dbc272371c77201a6a5}{mlx5\_core\_err}}(dev,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00391}00391                                     \textcolor{stringliteral}{"{}Failed reading EEPROM, error = 0x\%02x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00392}00392                                     ret);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00393}00393                                 \textcolor{keywordflow}{return} (-\/ret);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00394}00394                         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00395}00395                         ee-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}} += size\_read;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00396}00396                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00397}00397         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00398}00398         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00399}00399 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00400}00400 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00401}00401 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00402}00402 \textcolor{comment}{ * Read cable EEPROM module information by first inspecting the first}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00403}00403 \textcolor{comment}{ * three bytes to get the initial information for a whole reading.}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00404}00404 \textcolor{comment}{ * Information will be printed to dmesg.}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00405}00405 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00406}00406 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00407}\mbox{\hyperlink{diagnostics_8h_a1d00fa84f8aab5462c8926622d729ee9}{00407}} \mbox{\hyperlink{mlx5__diagnostics_8c_a1d00fa84f8aab5462c8926622d729ee9}{mlx5\_read\_eeprom}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *dev, \textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__eeprom}{mlx5\_eeprom}} *eeprom)}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00408}00408 \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00409}00409         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00410}00410 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00411}00411         eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_ac2ef50b162ef4dfb5863b387152b8dba}{i2c\_addr}} = \mbox{\hyperlink{port_8h_abdaf26fa2f7e0f2c629753b3468f1a28}{MLX5\_I2C\_ADDR\_LOW}};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00412}00412         eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_aa6501ac737a8d0841d5d00941e130d39}{device\_addr}} = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00413}00413         eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_ac53d68b3cf00b8cfa85b50095cbea899}{page\_num}} = \mbox{\hyperlink{port_8h_a84c968cbb690311a0a6d431829dc6d98}{MLX5\_EEPROM\_LOW\_PAGE}};}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00414}00414         eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_a7f1b41e312e78a9956c0faa32ff09d3e}{page\_valid}} = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00415}00415 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00416}00416         \textcolor{comment}{/* Read three first bytes to get important info */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00417}00417         error = \mbox{\hyperlink{mlx5__diagnostics_8c_a081609d563276d52d14f519efca758b0}{mlx5\_get\_eeprom\_info}}(dev, eeprom);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00418}00418         \textcolor{keywordflow}{if} (error) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00419}00419                 \mbox{\hyperlink{mlx5__core_8h_aeead4611cdbd6dbc272371c77201a6a5}{mlx5\_core\_err}}(dev,}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00420}00420                     \textcolor{stringliteral}{"{}Failed reading EEPROM initial information\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00421}00421                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00422}00422         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00423}00423         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00424}00424 \textcolor{comment}{         * Allocate needed length buffer and additional space for}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00425}00425 \textcolor{comment}{         * page 0x03}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00426}00426 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00427}00427         eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_ade7ff0de51349d4e3c07842a3030312c}{data}} = malloc(eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_abf6ca9a363668fce6edc11b25c071db4}{len}} + \mbox{\hyperlink{port_8h_a73d06cbb4572124a1079a15daa58293d}{MLX5\_EEPROM\_PAGE\_LENGTH}},}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00428}00428             M\_MLX5\_EEPROM, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00429}00429 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00430}00430         \textcolor{comment}{/* Read the whole eeprom information */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00431}00431         error = \mbox{\hyperlink{mlx5__diagnostics_8c_a1107f6b61f43b5591965b89dc200a093}{mlx5\_get\_eeprom}}(dev, eeprom);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00432}00432         \textcolor{keywordflow}{if} (error) \{}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00433}00433                 \mbox{\hyperlink{mlx5__core_8h_aeead4611cdbd6dbc272371c77201a6a5}{mlx5\_core\_err}}(dev, \textcolor{stringliteral}{"{}Failed reading EEPROM\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00434}00434                 error = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00435}00435                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00436}00436 \textcolor{comment}{                 * Continue printing partial information in case of}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00437}00437 \textcolor{comment}{                 * an error}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00438}00438 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00439}00439         \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00440}00440         free(eeprom-\/>\mbox{\hyperlink{structmlx5__eeprom_ade7ff0de51349d4e3c07842a3030312c}{data}}, M\_MLX5\_EEPROM);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00441}00441 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00442}00442         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00443}00443 \}}
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00444}00444 }
\DoxyCodeLine{\Hypertarget{mlx5__diagnostics_8c_source_l00445}00445 }

\end{DoxyCode}
