\hypertarget{mlx5__ib__mad_8c_source}{}\doxysection{mlx5\+\_\+ib\+\_\+mad.\+c}
\label{mlx5__ib__mad_8c_source}\index{dev/mlx5/mlx5\_ib/mlx5\_ib\_mad.c@{dev/mlx5/mlx5\_ib/mlx5\_ib\_mad.c}}
\mbox{\hyperlink{mlx5__ib__mad_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00002}00002 \textcolor{comment}{ * Copyright (c) 2013-\/2015, Mellanox Technologies, Ltd.  All rights reserved.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00004}00004 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00005}00005 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00006}00006 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00007}00007 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00008}00008 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00009}00009 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00010}00010 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00011}00011 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00012}00012 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00013}00013 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00014}00014 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00015}00015 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00016}00016 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00017}00017 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00018}00018 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00019}00019 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00020}00020 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00021}00021 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00022}00022 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00023}00023 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00024}00024 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00025}00025 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00026}00026 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00027}00027 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00028}00028 \textcolor{preprocessor}{\#include "{}opt\_rss.h"{}}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00029}00029 \textcolor{preprocessor}{\#include "{}opt\_ratelimit.h"{}}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00030}00030 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00031}00031 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{vport_8h}{dev/mlx5/vport.h}}>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <rdma/ib\_mad.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <rdma/ib\_smi.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <rdma/ib\_pma.h>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{mlx5__ib_8h}{dev/mlx5/mlx5\_ib/mlx5\_ib.h}}>}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00036}00036 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00037}00037 \textcolor{keyword}{enum} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00038}\mbox{\hyperlink{mlx5__ib__mad_8c_a5efefa44b296976f2147b8acbed1752caa913289e30109a09deaa63dba496c0ef}{00038}}         \mbox{\hyperlink{mlx5__ib__mad_8c_a5efefa44b296976f2147b8acbed1752caa913289e30109a09deaa63dba496c0ef}{MLX5\_IB\_VENDOR\_CLASS1}} = 0x9,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00039}00039         \mbox{\hyperlink{mlx5__ib__mad_8c_a5efefa44b296976f2147b8acbed1752ca41b1b5535083e5559c2acbabb1b21538}{MLX5\_IB\_VENDOR\_CLASS2}} = 0xa}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00040}\mbox{\hyperlink{mlx5__ib__mad_8c_a5efefa44b296976f2147b8acbed1752ca41b1b5535083e5559c2acbabb1b21538}{00040}} \};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00041}00041 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00042}\mbox{\hyperlink{mlx5__ib_8h_af6c30eb096f71e74c540e7ed347a48e9}{00042}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_af6c30eb096f71e74c540e7ed347a48e9}{mlx5\_MAD\_IFC}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev, \textcolor{keywordtype}{int} ignore\_mkey, \textcolor{keywordtype}{int} ignore\_bkey,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00043}00043                  u8 port, \textcolor{keyword}{const} \textcolor{keyword}{struct} ib\_wc *in\_wc, \textcolor{keyword}{const} \textcolor{keyword}{struct} ib\_grh *in\_grh,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00044}00044                  \textcolor{keyword}{const} \textcolor{keywordtype}{void} *in\_mad, \textcolor{keywordtype}{void} *response\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00045}00045 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00046}00046         u8 op\_modifier = 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00047}00047 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00048}00048         \textcolor{comment}{/* Key check traps can't be generated unless we have in\_wc to}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00049}00049 \textcolor{comment}{         * tell us where to send the trap.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00050}00050 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00051}00051         \textcolor{keywordflow}{if} (ignore\_mkey || !in\_wc)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00052}00052                 op\_modifier |= 0x1;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00053}00053         \textcolor{keywordflow}{if} (ignore\_bkey || !in\_wc)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00054}00054                 op\_modifier |= 0x2;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00056}00056         \textcolor{keywordflow}{return} \mbox{\hyperlink{driver_8h_ac29fc1f3bc0c1d7b5a929065b2c2ad1d}{mlx5\_core\_mad\_ifc}}(dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}, in\_mad, response\_mad, op\_modifier, port);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00057}00057 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00059}\mbox{\hyperlink{mlx5__ib__mad_8c_a6f3de8875c2aae77178b4cf91277f85f}{00059}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_a6f3de8875c2aae77178b4cf91277f85f}{process\_mad}}(\textcolor{keyword}{struct} ib\_device *ibdev, \textcolor{keywordtype}{int} mad\_flags, u8 port\_num,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00060}00060                        \textcolor{keyword}{const} \textcolor{keyword}{struct} ib\_wc *in\_wc, \textcolor{keyword}{const} \textcolor{keyword}{struct} ib\_grh *in\_grh,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00061}00061                        \textcolor{keyword}{const} \textcolor{keyword}{struct} ib\_mad *in\_mad, \textcolor{keyword}{struct} ib\_mad *out\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00062}00062 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00063}00063         u16 slid;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00064}00064         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00065}00065 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00066}00066         slid = in\_wc ? in\_wc-\/>slid : be16\_to\_cpu(IB\_LID\_PERMISSIVE);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00067}00067 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00068}00068         \textcolor{keywordflow}{if} (in\_mad-\/>mad\_hdr.method == IB\_MGMT\_METHOD\_TRAP \&\& slid == 0)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00069}00069                 \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_SUCCESS | IB\_MAD\_RESULT\_CONSUMED;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00071}00071         \textcolor{keywordflow}{if} (in\_mad-\/>mad\_hdr.mgmt\_class == IB\_MGMT\_CLASS\_SUBN\_LID\_ROUTED ||}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00072}00072             in\_mad-\/>mad\_hdr.mgmt\_class == IB\_MGMT\_CLASS\_SUBN\_DIRECTED\_ROUTE) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00073}00073                 \textcolor{keywordflow}{if} (in\_mad-\/>mad\_hdr.method   != IB\_MGMT\_METHOD\_GET \&\&}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00074}00074                     in\_mad-\/>mad\_hdr.method   != IB\_MGMT\_METHOD\_SET \&\&}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00075}00075                     in\_mad-\/>mad\_hdr.method   != IB\_MGMT\_METHOD\_TRAP\_REPRESS)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00076}00076                         \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_SUCCESS;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00077}00077 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00078}00078                 \textcolor{comment}{/* Don't process SMInfo queries -\/-\/ the SMA can't handle them.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00079}00079 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00080}00080                 \textcolor{keywordflow}{if} (in\_mad-\/>mad\_hdr.attr\_id == IB\_SMP\_ATTR\_SM\_INFO)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00081}00081                         \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_SUCCESS;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00082}00082         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (in\_mad-\/>mad\_hdr.mgmt\_class == IB\_MGMT\_CLASS\_PERF\_MGMT ||}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00083}00083                    in\_mad-\/>mad\_hdr.mgmt\_class == \mbox{\hyperlink{mlx5__ib__mad_8c_a5efefa44b296976f2147b8acbed1752caa913289e30109a09deaa63dba496c0ef}{MLX5\_IB\_VENDOR\_CLASS1}}   ||}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00084}00084                    in\_mad-\/>mad\_hdr.mgmt\_class == \mbox{\hyperlink{mlx5__ib__mad_8c_a5efefa44b296976f2147b8acbed1752ca41b1b5535083e5559c2acbabb1b21538}{MLX5\_IB\_VENDOR\_CLASS2}}   ||}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00085}00085                    in\_mad-\/>mad\_hdr.mgmt\_class == IB\_MGMT\_CLASS\_CONG\_MGMT) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00086}00086                 \textcolor{keywordflow}{if} (in\_mad-\/>mad\_hdr.method  != IB\_MGMT\_METHOD\_GET \&\&}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00087}00087                     in\_mad-\/>mad\_hdr.method  != IB\_MGMT\_METHOD\_SET)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00088}00088                         \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_SUCCESS;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00089}00089         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00090}00090                 \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_SUCCESS;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00091}00091         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00092}00092 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00093}00093         err = \mbox{\hyperlink{mlx5__ib__mad_8c_af6c30eb096f71e74c540e7ed347a48e9}{mlx5\_MAD\_IFC}}(\mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(ibdev),}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00094}00094                            mad\_flags \& IB\_MAD\_IGNORE\_MKEY,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00095}00095                            mad\_flags \& IB\_MAD\_IGNORE\_BKEY,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00096}00096                            port\_num, in\_wc, in\_grh, in\_mad, out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00097}00097         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00098}00098                 \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_FAILURE;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00099}00099 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00100}00100         \textcolor{comment}{/* set return bit in status of directed route responses */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00101}00101         \textcolor{keywordflow}{if} (in\_mad-\/>mad\_hdr.mgmt\_class == IB\_MGMT\_CLASS\_SUBN\_DIRECTED\_ROUTE)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00102}00102                 out\_mad-\/>mad\_hdr.status |= cpu\_to\_be16(1 << 15);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00103}00103 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00104}00104         \textcolor{keywordflow}{if} (in\_mad-\/>mad\_hdr.method == IB\_MGMT\_METHOD\_TRAP\_REPRESS)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00105}00105                 \textcolor{comment}{/* no response for trap repress */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00106}00106                 \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_SUCCESS | IB\_MAD\_RESULT\_CONSUMED;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00107}00107 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00108}00108         \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_SUCCESS | IB\_MAD\_RESULT\_REPLY;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00109}00109 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00110}00110 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00111}\mbox{\hyperlink{mlx5__ib__mad_8c_ad97c9642274f2a9679d4dc67e3d211f9}{00111}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mad_8c_ad97c9642274f2a9679d4dc67e3d211f9}{pma\_cnt\_ext\_assign}}(\textcolor{keyword}{struct} ib\_pma\_portcounters\_ext *pma\_cnt\_ext,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00112}00112                                \textcolor{keywordtype}{void} *out)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00113}00113 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00114}00114 \textcolor{preprocessor}{\#define MLX5\_SUM\_CNT(p, cntr1, cntr2)   \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00115}00115 \textcolor{preprocessor}{        (MLX5\_GET64(query\_vport\_counter\_out, p, cntr1) + \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00116}00116 \textcolor{preprocessor}{        MLX5\_GET64(query\_vport\_counter\_out, p, cntr2))}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00117}00117 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00118}00118         pma\_cnt\_ext-\/>port\_xmit\_data =}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00119}00119                 cpu\_to\_be64(\mbox{\hyperlink{mlx5__ib__mad_8c_a920d8ba4e3db7db6c170aa10fcdc33e8}{MLX5\_SUM\_CNT}}(out, transmitted\_ib\_unicast.octets,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00120}00120                                          transmitted\_ib\_multicast.octets) >> 2);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00121}00121         pma\_cnt\_ext-\/>port\_rcv\_data =}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00122}00122                 cpu\_to\_be64(\mbox{\hyperlink{mlx5__ib__mad_8c_a920d8ba4e3db7db6c170aa10fcdc33e8}{MLX5\_SUM\_CNT}}(out, received\_ib\_unicast.octets,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00123}00123                                          received\_ib\_multicast.octets) >> 2);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00124}00124         pma\_cnt\_ext-\/>port\_xmit\_packets =}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00125}00125                 cpu\_to\_be64(\mbox{\hyperlink{mlx5__ib__mad_8c_a920d8ba4e3db7db6c170aa10fcdc33e8}{MLX5\_SUM\_CNT}}(out, transmitted\_ib\_unicast.packets,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00126}00126                                          transmitted\_ib\_multicast.packets));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00127}00127         pma\_cnt\_ext-\/>port\_rcv\_packets =}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00128}00128                 cpu\_to\_be64(\mbox{\hyperlink{mlx5__ib__mad_8c_a920d8ba4e3db7db6c170aa10fcdc33e8}{MLX5\_SUM\_CNT}}(out, received\_ib\_unicast.packets,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00129}00129                                          received\_ib\_multicast.packets));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00130}00130         pma\_cnt\_ext-\/>port\_unicast\_xmit\_packets =}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00131}00131                 \mbox{\hyperlink{device_8h_a042d0db08f14dfaaf4dc20df99394c67}{MLX5\_GET64\_BE}}(query\_vport\_counter\_out,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00132}00132                               out, transmitted\_ib\_unicast.packets);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00133}00133         pma\_cnt\_ext-\/>port\_unicast\_rcv\_packets =}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00134}00134                 \mbox{\hyperlink{device_8h_a042d0db08f14dfaaf4dc20df99394c67}{MLX5\_GET64\_BE}}(query\_vport\_counter\_out,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00135}00135                               out, received\_ib\_unicast.packets);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00136}00136         pma\_cnt\_ext-\/>port\_multicast\_xmit\_packets =}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00137}00137                 \mbox{\hyperlink{device_8h_a042d0db08f14dfaaf4dc20df99394c67}{MLX5\_GET64\_BE}}(query\_vport\_counter\_out,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00138}00138                               out, transmitted\_ib\_multicast.packets);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00139}00139         pma\_cnt\_ext-\/>port\_multicast\_rcv\_packets =}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00140}00140                 \mbox{\hyperlink{device_8h_a042d0db08f14dfaaf4dc20df99394c67}{MLX5\_GET64\_BE}}(query\_vport\_counter\_out,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00141}00141                               out, received\_ib\_multicast.packets);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00142}00142 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00143}00143 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00144}\mbox{\hyperlink{mlx5__ib__mad_8c_a63cfb6a3a870fb5642b89a5ea35076b8}{00144}} \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mlx5__ib__mad_8c_a63cfb6a3a870fb5642b89a5ea35076b8}{pma\_cnt\_assign}}(\textcolor{keyword}{struct} ib\_pma\_portcounters *pma\_cnt,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00145}00145                            \textcolor{keywordtype}{void} *out)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00146}00146 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00147}00147         \textcolor{comment}{/* Traffic counters will be reported in}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00148}00148 \textcolor{comment}{         * their 64bit form via ib\_pma\_portcounters\_ext by default.}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00149}00149 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00150}00150         \textcolor{keywordtype}{void} *out\_pma = \mbox{\hyperlink{device_8h_ad5cad9c2e464873013bfb7b9761d25a1}{MLX5\_ADDR\_OF}}(ppcnt\_reg, out,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00151}00151                                      counter\_set);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00152}00152 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00153}00153 \textcolor{preprocessor}{\#define MLX5\_ASSIGN\_PMA\_CNTR(counter\_var, counter\_name) \{               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00154}00154 \textcolor{preprocessor}{        counter\_var = MLX5\_GET\_BE(typeof(counter\_var),                  \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00155}00155 \textcolor{preprocessor}{                                  ib\_port\_cntrs\_grp\_data\_layout,        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00156}00156 \textcolor{preprocessor}{                                  out\_pma, counter\_name);               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00157}00157 \textcolor{preprocessor}{        \}}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00158}00158 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00159}00159         \mbox{\hyperlink{mlx5__ib__mad_8c_a35b2cd8160070d094e20042b33ed7399}{MLX5\_ASSIGN\_PMA\_CNTR}}(pma\_cnt-\/>symbol\_error\_counter,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00160}00160                              symbol\_error\_counter);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00161}00161         \mbox{\hyperlink{mlx5__ib__mad_8c_a35b2cd8160070d094e20042b33ed7399}{MLX5\_ASSIGN\_PMA\_CNTR}}(pma\_cnt-\/>link\_error\_recovery\_counter,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00162}00162                              link\_error\_recovery\_counter);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00163}00163         \mbox{\hyperlink{mlx5__ib__mad_8c_a35b2cd8160070d094e20042b33ed7399}{MLX5\_ASSIGN\_PMA\_CNTR}}(pma\_cnt-\/>link\_downed\_counter,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00164}00164                              link\_downed\_counter);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00165}00165         \mbox{\hyperlink{mlx5__ib__mad_8c_a35b2cd8160070d094e20042b33ed7399}{MLX5\_ASSIGN\_PMA\_CNTR}}(pma\_cnt-\/>port\_rcv\_errors,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00166}00166                              port\_rcv\_errors);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00167}00167         \mbox{\hyperlink{mlx5__ib__mad_8c_a35b2cd8160070d094e20042b33ed7399}{MLX5\_ASSIGN\_PMA\_CNTR}}(pma\_cnt-\/>port\_rcv\_remphys\_errors,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00168}00168                              port\_rcv\_remote\_physical\_errors);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00169}00169         \mbox{\hyperlink{mlx5__ib__mad_8c_a35b2cd8160070d094e20042b33ed7399}{MLX5\_ASSIGN\_PMA\_CNTR}}(pma\_cnt-\/>port\_rcv\_switch\_relay\_errors,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00170}00170                              port\_rcv\_switch\_relay\_errors);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00171}00171         \mbox{\hyperlink{mlx5__ib__mad_8c_a35b2cd8160070d094e20042b33ed7399}{MLX5\_ASSIGN\_PMA\_CNTR}}(pma\_cnt-\/>port\_xmit\_discards,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00172}00172                              port\_xmit\_discards);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00173}00173         \mbox{\hyperlink{mlx5__ib__mad_8c_a35b2cd8160070d094e20042b33ed7399}{MLX5\_ASSIGN\_PMA\_CNTR}}(pma\_cnt-\/>port\_xmit\_constraint\_errors,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00174}00174                              port\_xmit\_constraint\_errors);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00175}00175         \mbox{\hyperlink{mlx5__ib__mad_8c_a35b2cd8160070d094e20042b33ed7399}{MLX5\_ASSIGN\_PMA\_CNTR}}(pma\_cnt-\/>port\_rcv\_constraint\_errors,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00176}00176                              port\_rcv\_constraint\_errors);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00177}00177         \mbox{\hyperlink{mlx5__ib__mad_8c_a35b2cd8160070d094e20042b33ed7399}{MLX5\_ASSIGN\_PMA\_CNTR}}(pma\_cnt-\/>link\_overrun\_errors,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00178}00178                              link\_overrun\_errors);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00179}00179         \mbox{\hyperlink{mlx5__ib__mad_8c_a35b2cd8160070d094e20042b33ed7399}{MLX5\_ASSIGN\_PMA\_CNTR}}(pma\_cnt-\/>vl15\_dropped,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00180}00180                              vl\_15\_dropped);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00181}00181 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00182}00182 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00183}\mbox{\hyperlink{mlx5__ib__mad_8c_abcfefbf90003e1d93727a4a969f4d376}{00183}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_abcfefbf90003e1d93727a4a969f4d376}{process\_pma\_cmd}}(\textcolor{keyword}{struct} ib\_device *ibdev, u8 port\_num,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00184}00184                            \textcolor{keyword}{const} \textcolor{keyword}{struct} ib\_mad *in\_mad, \textcolor{keyword}{struct} ib\_mad *out\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00185}00185 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00186}00186         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(ibdev);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00187}00187         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00188}00188         \textcolor{keywordtype}{void} *out\_cnt;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00189}00189 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00190}00190         \textcolor{comment}{/* Decalring support of extended counters */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00191}00191         \textcolor{keywordflow}{if} (in\_mad-\/>mad\_hdr.attr\_id == IB\_PMA\_CLASS\_PORT\_INFO) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00192}00192                 \textcolor{keyword}{struct }ib\_class\_port\_info cpi = \{\};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00193}00193 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00194}00194                 cpi.capability\_mask = IB\_PMA\_CLASS\_CAP\_EXT\_WIDTH;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00195}00195                 memcpy((out\_mad-\/>data + 40), \&cpi, \textcolor{keyword}{sizeof}(cpi));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00196}00196                 \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_SUCCESS | IB\_MAD\_RESULT\_REPLY;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00197}00197         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00198}00198 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00199}00199         \textcolor{keywordflow}{if} (in\_mad-\/>mad\_hdr.attr\_id == IB\_PMA\_PORT\_COUNTERS\_EXT) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00200}00200                 \textcolor{keyword}{struct }ib\_pma\_portcounters\_ext *pma\_cnt\_ext =}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00201}00201                         (\textcolor{keyword}{struct }ib\_pma\_portcounters\_ext *)(out\_mad-\/>data + 40);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00202}00202                 \textcolor{keywordtype}{int} sz = \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(query\_vport\_counter\_out);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00203}00203 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00204}00204                 out\_cnt = \mbox{\hyperlink{driver_8h_af928b1985830513c1c81b095b31ad8a7}{mlx5\_vzalloc}}(sz);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00205}00205                 \textcolor{keywordflow}{if} (!out\_cnt)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00206}00206                         \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_FAILURE;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00207}00207 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00208}00208                 err = \mbox{\hyperlink{mlx5__vport_8c_afa18c2d0b6619e94a9b54c33d7364df1}{mlx5\_core\_query\_vport\_counter}}(dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}, 0, 0,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00209}00209                                                     port\_num, out\_cnt, sz);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00210}00210                 \textcolor{keywordflow}{if} (!err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00211}00211                         \mbox{\hyperlink{mlx5__ib__mad_8c_ad97c9642274f2a9679d4dc67e3d211f9}{pma\_cnt\_ext\_assign}}(pma\_cnt\_ext, out\_cnt);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00212}00212         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00213}00213                 \textcolor{keyword}{struct }ib\_pma\_portcounters *pma\_cnt =}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00214}00214                         (\textcolor{keyword}{struct }ib\_pma\_portcounters *)(out\_mad-\/>data + 40);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00215}00215                 \textcolor{keywordtype}{int} sz = \mbox{\hyperlink{device_8h_a459f4e51a5d10dfb6fed7cafff215cb4}{MLX5\_ST\_SZ\_BYTES}}(ppcnt\_reg);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00216}00216 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00217}00217                 out\_cnt = \mbox{\hyperlink{driver_8h_af928b1985830513c1c81b095b31ad8a7}{mlx5\_vzalloc}}(sz);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00218}00218                 \textcolor{keywordflow}{if} (!out\_cnt)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00219}00219                         \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_FAILURE;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00220}00220 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00221}00221                 err = \mbox{\hyperlink{mlx5__vport_8c_a5dabba4262dc188b4b60990077028432}{mlx5\_core\_query\_ib\_ppcnt}}(dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}, port\_num,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00222}00222                                                out\_cnt, sz);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00223}00223                 \textcolor{keywordflow}{if} (!err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00224}00224                         \mbox{\hyperlink{mlx5__ib__mad_8c_a63cfb6a3a870fb5642b89a5ea35076b8}{pma\_cnt\_assign}}(pma\_cnt, out\_cnt);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00225}00225                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00226}00226 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00227}00227         kvfree(out\_cnt);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00228}00228         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00229}00229                 \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_FAILURE;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00230}00230 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00231}00231         \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_SUCCESS | IB\_MAD\_RESULT\_REPLY;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00232}00232 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00233}00233 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00234}\mbox{\hyperlink{mlx5__ib_8h_a6d2ed9c258c37363ca7ace7dfb480e04}{00234}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_a6d2ed9c258c37363ca7ace7dfb480e04}{mlx5\_ib\_process\_mad}}(\textcolor{keyword}{struct} ib\_device *ibdev, \textcolor{keywordtype}{int} mad\_flags, u8 port\_num,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00235}00235                         \textcolor{keyword}{const} \textcolor{keyword}{struct} ib\_wc *in\_wc, \textcolor{keyword}{const} \textcolor{keyword}{struct} ib\_grh *in\_grh,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00236}00236                         \textcolor{keyword}{const} \textcolor{keyword}{struct} ib\_mad\_hdr *in, \textcolor{keywordtype}{size\_t} in\_mad\_size,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00237}00237                         \textcolor{keyword}{struct} ib\_mad\_hdr *out, \textcolor{keywordtype}{size\_t} *out\_mad\_size,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00238}00238                         u16 *out\_mad\_pkey\_index)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00239}00239 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00240}00240         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(ibdev);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00241}00241         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *mdev = dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00242}00242         \textcolor{keyword}{const} \textcolor{keyword}{struct }ib\_mad *in\_mad = (\textcolor{keyword}{const} \textcolor{keyword}{struct }ib\_mad *)in;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00243}00243         \textcolor{keyword}{struct }ib\_mad *out\_mad = (\textcolor{keyword}{struct }ib\_mad *)out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00244}00244 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00245}00245         \textcolor{keywordflow}{if} (WARN\_ON\_ONCE(in\_mad\_size != \textcolor{keyword}{sizeof}(*in\_mad) ||}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00246}00246                          *out\_mad\_size != \textcolor{keyword}{sizeof}(*out\_mad)))}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00247}00247                 \textcolor{keywordflow}{return} IB\_MAD\_RESULT\_FAILURE;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00248}00248 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00249}00249         memset(out\_mad-\/>data, 0, \textcolor{keyword}{sizeof}(out\_mad-\/>data));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00250}00250 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00251}00251         \textcolor{keywordflow}{if} (\mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(mdev, vport\_counters) \&\&}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00252}00252             in\_mad-\/>mad\_hdr.mgmt\_class == IB\_MGMT\_CLASS\_PERF\_MGMT \&\&}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00253}00253             in\_mad-\/>mad\_hdr.method == IB\_MGMT\_METHOD\_GET) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00254}00254                 \textcolor{keywordflow}{return} \mbox{\hyperlink{mlx5__ib__mad_8c_abcfefbf90003e1d93727a4a969f4d376}{process\_pma\_cmd}}(ibdev, port\_num, in\_mad, out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00255}00255         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00256}00256                 \textcolor{keywordflow}{return} \mbox{\hyperlink{mlx5__ib__mad_8c_a6f3de8875c2aae77178b4cf91277f85f}{process\_mad}}(ibdev, mad\_flags, port\_num, in\_wc, in\_grh,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00257}00257                                    in\_mad, out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00258}00258         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00259}00259 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00260}00260 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00261}\mbox{\hyperlink{mlx5__ib_8h_ac81de27456f75bbf6ee979ad3f8c7504}{00261}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_ac81de27456f75bbf6ee979ad3f8c7504}{mlx5\_query\_ext\_port\_caps}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev, u8 port)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00262}00262 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00263}00263         \textcolor{keyword}{struct }ib\_smp *in\_mad  = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00264}00264         \textcolor{keyword}{struct }ib\_smp *out\_mad = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00265}00265         \textcolor{keywordtype}{int} err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00266}00266         u16 packet\_error;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00267}00267 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00268}00268         in\_mad  = kzalloc(\textcolor{keyword}{sizeof}(*in\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00269}00269         out\_mad = kmalloc(\textcolor{keyword}{sizeof}(*out\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00270}00270         \textcolor{keywordflow}{if} (!in\_mad || !out\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00271}00271                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00272}00272 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00273}00273         \mbox{\hyperlink{mlx5__ib_8h_a0e78bda4854e4c43de09d9b5b69a83c2}{init\_query\_mad}}(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00274}00274         in\_mad-\/>attr\_id = \mbox{\hyperlink{device_8h_a33f250a26d43bf921d3ecd5e2a2a2009}{MLX5\_ATTR\_EXTENDED\_PORT\_INFO}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00275}00275         in\_mad-\/>attr\_mod = cpu\_to\_be32(port);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00276}00276 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00277}00277         err = \mbox{\hyperlink{mlx5__ib__mad_8c_af6c30eb096f71e74c540e7ed347a48e9}{mlx5\_MAD\_IFC}}(dev, 1, 1, 1, NULL, NULL, in\_mad, out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00278}00278 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00279}00279         packet\_error = be16\_to\_cpu(out\_mad-\/>status);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00280}00280 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00281}00281         dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}}-\/>\mbox{\hyperlink{structmlx5__core__dev_a75383810eefe03a336bb7a483ae06b7d}{port\_caps}}[port -\/ 1].\mbox{\hyperlink{structmlx5__port__caps_abc191c7d7e170c8df70fa5072a618582}{ext\_port\_cap}} = (!err \&\& !packet\_error) ?}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00282}00282                 \mbox{\hyperlink{device_8h_af715e26dfffd1f8de1c18449e2770cffa10117a61edfe914ee475fbc58b1d1eb6}{MLX\_EXT\_PORT\_CAP\_FLAG\_EXTENDED\_PORT\_INFO}} : 0;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00283}00283 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00284}00284 out:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00285}00285         kfree(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00286}00286         kfree(out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00287}00287         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00288}00288 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00289}00289 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00290}\mbox{\hyperlink{mlx5__ib_8h_a8938b6d10d410af3fea6a85fe1281708}{00290}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_a8938b6d10d410af3fea6a85fe1281708}{mlx5\_query\_mad\_ifc\_smp\_attr\_node\_info}}(\textcolor{keyword}{struct} ib\_device *ibdev,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00291}00291                                           \textcolor{keyword}{struct} ib\_smp *out\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00292}00292 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00293}00293         \textcolor{keyword}{struct }ib\_smp *in\_mad = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00294}00294         \textcolor{keywordtype}{int} err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00295}00295 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00296}00296         in\_mad = kzalloc(\textcolor{keyword}{sizeof}(*in\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00297}00297         \textcolor{keywordflow}{if} (!in\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00298}00298                 \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00299}00299 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00300}00300         \mbox{\hyperlink{mlx5__ib_8h_a0e78bda4854e4c43de09d9b5b69a83c2}{init\_query\_mad}}(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00301}00301         in\_mad-\/>attr\_id = IB\_SMP\_ATTR\_NODE\_INFO;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00302}00302 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00303}00303         err = \mbox{\hyperlink{mlx5__ib__mad_8c_af6c30eb096f71e74c540e7ed347a48e9}{mlx5\_MAD\_IFC}}(\mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(ibdev), 1, 1, 1, NULL, NULL, in\_mad,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00304}00304                            out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00305}00305 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00306}00306         kfree(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00307}00307         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00308}00308 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00309}00309 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00310}\mbox{\hyperlink{mlx5__ib_8h_a774e8109f944fb224c2c6502f8cc5e4f}{00310}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_a774e8109f944fb224c2c6502f8cc5e4f}{mlx5\_query\_mad\_ifc\_system\_image\_guid}}(\textcolor{keyword}{struct} ib\_device *ibdev,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00311}00311                                          \_\_be64 *sys\_image\_guid)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00312}00312 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00313}00313         \textcolor{keyword}{struct }ib\_smp *out\_mad = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00314}00314         \textcolor{keywordtype}{int} err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00315}00315 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00316}00316         out\_mad = kmalloc(\textcolor{keyword}{sizeof}(*out\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00317}00317         \textcolor{keywordflow}{if} (!out\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00318}00318                 \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00319}00319 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00320}00320         err = \mbox{\hyperlink{mlx5__ib__mad_8c_a8938b6d10d410af3fea6a85fe1281708}{mlx5\_query\_mad\_ifc\_smp\_attr\_node\_info}}(ibdev, out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00321}00321         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00322}00322                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00323}00323 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00324}00324         memcpy(sys\_image\_guid, out\_mad-\/>data + 4, 8);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00325}00325 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00326}00326 out:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00327}00327         kfree(out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00328}00328 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00329}00329         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00330}00330 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00331}00331 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00332}\mbox{\hyperlink{mlx5__ib_8h_ad60b8042351b63302528442264f8fa92}{00332}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_ad60b8042351b63302528442264f8fa92}{mlx5\_query\_mad\_ifc\_max\_pkeys}}(\textcolor{keyword}{struct} ib\_device *ibdev,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00333}00333                                  u16 *max\_pkeys)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00334}00334 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00335}00335         \textcolor{keyword}{struct }ib\_smp *out\_mad = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00336}00336         \textcolor{keywordtype}{int} err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00337}00337 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00338}00338         out\_mad = kmalloc(\textcolor{keyword}{sizeof}(*out\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00339}00339         \textcolor{keywordflow}{if} (!out\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00340}00340                 \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00341}00341 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00342}00342         err = \mbox{\hyperlink{mlx5__ib__mad_8c_a8938b6d10d410af3fea6a85fe1281708}{mlx5\_query\_mad\_ifc\_smp\_attr\_node\_info}}(ibdev, out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00343}00343         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00344}00344                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00345}00345 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00346}00346         *max\_pkeys = be16\_to\_cpup((\_\_be16 *)(out\_mad-\/>data + 28));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00347}00347 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00348}00348 out:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00349}00349         kfree(out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00350}00350 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00351}00351         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00352}00352 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00353}00353 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00354}\mbox{\hyperlink{mlx5__ib_8h_ace990b080fac903b127badf45783da0f}{00354}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_ace990b080fac903b127badf45783da0f}{mlx5\_query\_mad\_ifc\_vendor\_id}}(\textcolor{keyword}{struct} ib\_device *ibdev,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00355}00355                                  u32 *vendor\_id)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00356}00356 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00357}00357         \textcolor{keyword}{struct }ib\_smp *out\_mad = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00358}00358         \textcolor{keywordtype}{int} err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00359}00359 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00360}00360         out\_mad = kmalloc(\textcolor{keyword}{sizeof}(*out\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00361}00361         \textcolor{keywordflow}{if} (!out\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00362}00362                 \textcolor{keywordflow}{return} -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00363}00363 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00364}00364         err = \mbox{\hyperlink{mlx5__ib__mad_8c_a8938b6d10d410af3fea6a85fe1281708}{mlx5\_query\_mad\_ifc\_smp\_attr\_node\_info}}(ibdev, out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00365}00365         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00366}00366                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00367}00367 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00368}00368         *vendor\_id = be32\_to\_cpup((\_\_be32 *)(out\_mad-\/>data + 36)) \& 0xffff;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00369}00369 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00370}00370 out:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00371}00371         kfree(out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00372}00372 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00373}00373         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00374}00374 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00375}00375 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00376}\mbox{\hyperlink{mlx5__ib_8h_a099eaca6bfdcfdfb1fc472161a8cc270}{00376}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_a099eaca6bfdcfdfb1fc472161a8cc270}{mlx5\_query\_mad\_ifc\_node\_desc}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev, \textcolor{keywordtype}{char} *node\_desc)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00377}00377 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00378}00378         \textcolor{keyword}{struct }ib\_smp *in\_mad  = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00379}00379         \textcolor{keyword}{struct }ib\_smp *out\_mad = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00380}00380         \textcolor{keywordtype}{int} err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00381}00381 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00382}00382         in\_mad  = kzalloc(\textcolor{keyword}{sizeof}(*in\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00383}00383         out\_mad = kmalloc(\textcolor{keyword}{sizeof}(*out\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00384}00384         \textcolor{keywordflow}{if} (!in\_mad || !out\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00385}00385                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00386}00386 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00387}00387         \mbox{\hyperlink{mlx5__ib_8h_a0e78bda4854e4c43de09d9b5b69a83c2}{init\_query\_mad}}(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00388}00388         in\_mad-\/>attr\_id = IB\_SMP\_ATTR\_NODE\_DESC;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00389}00389 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00390}00390         err = \mbox{\hyperlink{mlx5__ib__mad_8c_af6c30eb096f71e74c540e7ed347a48e9}{mlx5\_MAD\_IFC}}(dev, 1, 1, 1, NULL, NULL, in\_mad, out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00391}00391         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00392}00392                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00393}00393 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00394}00394         memcpy(node\_desc, out\_mad-\/>data, IB\_DEVICE\_NODE\_DESC\_MAX);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00395}00395 out:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00396}00396         kfree(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00397}00397         kfree(out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00398}00398         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00399}00399 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00400}00400 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00401}\mbox{\hyperlink{mlx5__ib_8h_a3b99787361b5751ad1bac58e9e00d627}{00401}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_a3b99787361b5751ad1bac58e9e00d627}{mlx5\_query\_mad\_ifc\_node\_guid}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev, \_\_be64 *node\_guid)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00402}00402 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00403}00403         \textcolor{keyword}{struct }ib\_smp *in\_mad  = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00404}00404         \textcolor{keyword}{struct }ib\_smp *out\_mad = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00405}00405         \textcolor{keywordtype}{int} err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00406}00406 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00407}00407         in\_mad  = kzalloc(\textcolor{keyword}{sizeof}(*in\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00408}00408         out\_mad = kmalloc(\textcolor{keyword}{sizeof}(*out\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00409}00409         \textcolor{keywordflow}{if} (!in\_mad || !out\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00410}00410                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00411}00411 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00412}00412         \mbox{\hyperlink{mlx5__ib_8h_a0e78bda4854e4c43de09d9b5b69a83c2}{init\_query\_mad}}(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00413}00413         in\_mad-\/>attr\_id = IB\_SMP\_ATTR\_NODE\_INFO;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00414}00414 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00415}00415         err = \mbox{\hyperlink{mlx5__ib__mad_8c_af6c30eb096f71e74c540e7ed347a48e9}{mlx5\_MAD\_IFC}}(dev, 1, 1, 1, NULL, NULL, in\_mad, out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00416}00416         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00417}00417                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00418}00418 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00419}00419         memcpy(node\_guid, out\_mad-\/>data + 12, 8);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00420}00420 out:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00421}00421         kfree(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00422}00422         kfree(out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00423}00423         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00424}00424 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00425}00425 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00426}\mbox{\hyperlink{mlx5__ib_8h_a08c267a9ebe3a7ea21515d39f3764ed5}{00426}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_a08c267a9ebe3a7ea21515d39f3764ed5}{mlx5\_query\_mad\_ifc\_pkey}}(\textcolor{keyword}{struct} ib\_device *ibdev, u8 port, u16 index,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00427}00427                             u16 *pkey)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00428}00428 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00429}00429         \textcolor{keyword}{struct }ib\_smp *in\_mad  = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00430}00430         \textcolor{keyword}{struct }ib\_smp *out\_mad = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00431}00431         \textcolor{keywordtype}{int} err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00432}00432 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00433}00433         in\_mad  = kzalloc(\textcolor{keyword}{sizeof}(*in\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00434}00434         out\_mad = kmalloc(\textcolor{keyword}{sizeof}(*out\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00435}00435         \textcolor{keywordflow}{if} (!in\_mad || !out\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00436}00436                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00437}00437 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00438}00438         \mbox{\hyperlink{mlx5__ib_8h_a0e78bda4854e4c43de09d9b5b69a83c2}{init\_query\_mad}}(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00439}00439         in\_mad-\/>attr\_id  = IB\_SMP\_ATTR\_PKEY\_TABLE;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00440}00440         in\_mad-\/>attr\_mod = cpu\_to\_be32(index / 32);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00441}00441 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00442}00442         err = \mbox{\hyperlink{mlx5__ib__mad_8c_af6c30eb096f71e74c540e7ed347a48e9}{mlx5\_MAD\_IFC}}(\mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(ibdev), 1, 1, port, NULL, NULL, in\_mad,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00443}00443                            out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00444}00444         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00445}00445                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00446}00446 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00447}00447         *pkey = be16\_to\_cpu(((\_\_be16 *)out\_mad-\/>data)[index \% 32]);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00448}00448 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00449}00449 out:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00450}00450         kfree(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00451}00451         kfree(out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00452}00452         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00453}00453 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00454}00454 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00455}\mbox{\hyperlink{mlx5__ib_8h_a5acdcd87fb8ab024aadc1f8063db0cbb}{00455}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_a5acdcd87fb8ab024aadc1f8063db0cbb}{mlx5\_query\_mad\_ifc\_gids}}(\textcolor{keyword}{struct} ib\_device *ibdev, u8 port, \textcolor{keywordtype}{int} index,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00456}00456                             \textcolor{keyword}{union} ib\_gid *gid)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00457}00457 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00458}00458         \textcolor{keyword}{struct }ib\_smp *in\_mad  = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00459}00459         \textcolor{keyword}{struct }ib\_smp *out\_mad = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00460}00460         \textcolor{keywordtype}{int} err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00461}00461 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00462}00462         in\_mad  = kzalloc(\textcolor{keyword}{sizeof}(*in\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00463}00463         out\_mad = kmalloc(\textcolor{keyword}{sizeof}(*out\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00464}00464         \textcolor{keywordflow}{if} (!in\_mad || !out\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00465}00465                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00466}00466 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00467}00467         \mbox{\hyperlink{mlx5__ib_8h_a0e78bda4854e4c43de09d9b5b69a83c2}{init\_query\_mad}}(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00468}00468         in\_mad-\/>attr\_id  = IB\_SMP\_ATTR\_PORT\_INFO;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00469}00469         in\_mad-\/>attr\_mod = cpu\_to\_be32(port);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00470}00470 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00471}00471         err = \mbox{\hyperlink{mlx5__ib__mad_8c_af6c30eb096f71e74c540e7ed347a48e9}{mlx5\_MAD\_IFC}}(\mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(ibdev), 1, 1, port, NULL, NULL, in\_mad,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00472}00472                            out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00473}00473         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00474}00474                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00475}00475 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00476}00476         memcpy(gid-\/>raw, out\_mad-\/>data + 8, 8);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00477}00477 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00478}00478         \mbox{\hyperlink{mlx5__ib_8h_a0e78bda4854e4c43de09d9b5b69a83c2}{init\_query\_mad}}(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00479}00479         in\_mad-\/>attr\_id  = IB\_SMP\_ATTR\_GUID\_INFO;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00480}00480         in\_mad-\/>attr\_mod = cpu\_to\_be32(index / 8);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00481}00481 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00482}00482         err = \mbox{\hyperlink{mlx5__ib__mad_8c_af6c30eb096f71e74c540e7ed347a48e9}{mlx5\_MAD\_IFC}}(\mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(ibdev), 1, 1, port, NULL, NULL, in\_mad,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00483}00483                            out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00484}00484         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00485}00485                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00486}00486 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00487}00487         memcpy(gid-\/>raw + 8, out\_mad-\/>data + (index \% 8) * 8, 8);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00488}00488 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00489}00489 out:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00490}00490         kfree(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00491}00491         kfree(out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00492}00492         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00493}00493 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00494}00494 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00495}\mbox{\hyperlink{mlx5__ib_8h_a78401cdf6971857d83920d1fcc714c61}{00495}} \textcolor{keywordtype}{int} \mbox{\hyperlink{mlx5__ib__mad_8c_a78401cdf6971857d83920d1fcc714c61}{mlx5\_query\_mad\_ifc\_port}}(\textcolor{keyword}{struct} ib\_device *ibdev, u8 port,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00496}00496                             \textcolor{keyword}{struct} ib\_port\_attr *props)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00497}00497 \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00498}00498         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__ib__dev}{mlx5\_ib\_dev}} *dev = \mbox{\hyperlink{mlx5__ib_8h_a1806639f13e6865f0fa7aab4dd3ec6c7}{to\_mdev}}(ibdev);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00499}00499         \textcolor{keyword}{struct }\mbox{\hyperlink{structmlx5__core__dev}{mlx5\_core\_dev}} *mdev = dev-\/>\mbox{\hyperlink{structmlx5__ib__dev_ad83604569dbe7573baa7644158cee224}{mdev}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00500}00500         \textcolor{keyword}{struct }ib\_smp *in\_mad  = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00501}00501         \textcolor{keyword}{struct }ib\_smp *out\_mad = NULL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00502}00502         \textcolor{keywordtype}{int} ext\_active\_speed;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00503}00503         \textcolor{keywordtype}{int} err = -\/ENOMEM;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00504}00504 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00505}00505         \textcolor{keywordflow}{if} (port < 1 || port > \mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(mdev, num\_ports)) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00506}00506                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}invalid port number \%d\(\backslash\)n"{}}, port);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00507}00507                 \textcolor{keywordflow}{return} -\/EINVAL;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00508}00508         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00509}00509 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00510}00510         in\_mad  = kzalloc(\textcolor{keyword}{sizeof}(*in\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00511}00511         out\_mad = kmalloc(\textcolor{keyword}{sizeof}(*out\_mad), GFP\_KERNEL);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00512}00512         \textcolor{keywordflow}{if} (!in\_mad || !out\_mad)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00513}00513                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00514}00514 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00515}00515         memset(props, 0, \textcolor{keyword}{sizeof}(*props));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00516}00516 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00517}00517         \mbox{\hyperlink{mlx5__ib_8h_a0e78bda4854e4c43de09d9b5b69a83c2}{init\_query\_mad}}(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00518}00518         in\_mad-\/>attr\_id  = IB\_SMP\_ATTR\_PORT\_INFO;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00519}00519         in\_mad-\/>attr\_mod = cpu\_to\_be32(port);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00520}00520 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00521}00521         err = \mbox{\hyperlink{mlx5__ib__mad_8c_af6c30eb096f71e74c540e7ed347a48e9}{mlx5\_MAD\_IFC}}(dev, 1, 1, port, NULL, NULL, in\_mad, out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00522}00522         \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00523}00523                 \mbox{\hyperlink{mlx5__ib_8h_a648fb83654f708e827821ca7fa53779a}{mlx5\_ib\_warn}}(dev, \textcolor{stringliteral}{"{}err \%d\(\backslash\)n"{}}, err);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00524}00524                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00525}00525         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00526}00526 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00527}00527         props-\/>lid              = be16\_to\_cpup((\_\_be16 *)(out\_mad-\/>data + 16));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00528}00528         props-\/>lmc              = out\_mad-\/>data[34] \& 0x7;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00529}00529         props-\/>sm\_lid           = be16\_to\_cpup((\_\_be16 *)(out\_mad-\/>data + 18));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00530}00530         props-\/>sm\_sl            = out\_mad-\/>data[36] \& 0xf;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00531}00531         props-\/>state            = out\_mad-\/>data[32] \& 0xf;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00532}00532         props-\/>phys\_state       = out\_mad-\/>data[33] >> 4;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00533}00533         props-\/>port\_cap\_flags   = be32\_to\_cpup((\_\_be32 *)(out\_mad-\/>data + 20));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00534}00534         props-\/>gid\_tbl\_len      = out\_mad-\/>data[50];}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00535}00535         props-\/>max\_msg\_sz       = 1 << \mbox{\hyperlink{device_8h_ab4698570d3992612e8c6ccf9fde798c3}{MLX5\_CAP\_GEN}}(mdev, log\_max\_msg);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00536}00536         props-\/>pkey\_tbl\_len     = mdev-\/>\mbox{\hyperlink{structmlx5__core__dev_a75383810eefe03a336bb7a483ae06b7d}{port\_caps}}[port -\/ 1].\mbox{\hyperlink{structmlx5__port__caps_a53a7caa833759f4171631d394e32880d}{pkey\_table\_len}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00537}00537         props-\/>bad\_pkey\_cntr    = be16\_to\_cpup((\_\_be16 *)(out\_mad-\/>data + 46));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00538}00538         props-\/>qkey\_viol\_cntr   = be16\_to\_cpup((\_\_be16 *)(out\_mad-\/>data + 48));}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00539}00539         props-\/>active\_width     = out\_mad-\/>data[31] \& 0xf;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00540}00540         props-\/>active\_speed     = out\_mad-\/>data[35] >> 4;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00541}00541         props-\/>max\_mtu          = out\_mad-\/>data[41] \& 0xf;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00542}00542         props-\/>active\_mtu       = out\_mad-\/>data[36] >> 4;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00543}00543         props-\/>subnet\_timeout   = out\_mad-\/>data[51] \& 0x1f;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00544}00544         props-\/>max\_vl\_num       = out\_mad-\/>data[37] >> 4;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00545}00545         props-\/>init\_type\_reply  = out\_mad-\/>data[41] >> 4;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00546}00546 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00547}00547         \textcolor{comment}{/* Check if extended speeds (EDR/FDR/...) are supported */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00548}00548         \textcolor{keywordflow}{if} (props-\/>port\_cap\_flags \& IB\_PORT\_EXTENDED\_SPEEDS\_SUP) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00549}00549                 ext\_active\_speed = out\_mad-\/>data[62] >> 4;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00550}00550 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00551}00551                 \textcolor{keywordflow}{switch} (ext\_active\_speed) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00552}00552                 \textcolor{keywordflow}{case} 1:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00553}00553                         props-\/>active\_speed = 16; \textcolor{comment}{/* FDR */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00554}00554                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00555}00555                 \textcolor{keywordflow}{case} 2:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00556}00556                         props-\/>active\_speed = 32; \textcolor{comment}{/* EDR */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00557}00557                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00558}00558                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00559}00559         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00560}00560 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00561}00561         \textcolor{comment}{/* If reported active speed is QDR, check if is FDR-\/10 */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00562}00562         \textcolor{keywordflow}{if} (props-\/>active\_speed == 4) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00563}00563                 \textcolor{keywordflow}{if} (mdev-\/>\mbox{\hyperlink{structmlx5__core__dev_a75383810eefe03a336bb7a483ae06b7d}{port\_caps}}[port -\/ 1].\mbox{\hyperlink{structmlx5__port__caps_abc191c7d7e170c8df70fa5072a618582}{ext\_port\_cap}} \&}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00564}00564                     \mbox{\hyperlink{device_8h_af715e26dfffd1f8de1c18449e2770cffa10117a61edfe914ee475fbc58b1d1eb6}{MLX\_EXT\_PORT\_CAP\_FLAG\_EXTENDED\_PORT\_INFO}}) \{}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00565}00565                         \mbox{\hyperlink{mlx5__ib_8h_a0e78bda4854e4c43de09d9b5b69a83c2}{init\_query\_mad}}(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00566}00566                         in\_mad-\/>attr\_id = \mbox{\hyperlink{device_8h_a33f250a26d43bf921d3ecd5e2a2a2009}{MLX5\_ATTR\_EXTENDED\_PORT\_INFO}};}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00567}00567                         in\_mad-\/>attr\_mod = cpu\_to\_be32(port);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00568}00568 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00569}00569                         err = \mbox{\hyperlink{mlx5__ib__mad_8c_af6c30eb096f71e74c540e7ed347a48e9}{mlx5\_MAD\_IFC}}(dev, 1, 1, port,}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00570}00570                                            NULL, NULL, in\_mad, out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00571}00571                         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00572}00572                                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00573}00573 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00574}00574                         \textcolor{comment}{/* Checking LinkSpeedActive for FDR-\/10 */}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00575}00575                         \textcolor{keywordflow}{if} (out\_mad-\/>data[15] \& 0x1)}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00576}00576                                 props-\/>active\_speed = 8;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00577}00577                 \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00578}00578         \}}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00579}00579 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00580}00580 out:}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00581}00581         kfree(in\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00582}00582         kfree(out\_mad);}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00583}00583 }
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00584}00584         \textcolor{keywordflow}{return} err;}
\DoxyCodeLine{\Hypertarget{mlx5__ib__mad_8c_source_l00585}00585 \}}

\end{DoxyCode}
