<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18702"></HEAD>
<BODY>
<DIV><SPAN class=833455812-17112009><FONT color=#0000ff size=2
face=Arial>Applied on 2575.</FONT></SPAN></DIV>
<DIV><SPAN class=833455812-17112009><FONT color=#0000ff size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=833455812-17112009><FONT color=#0000ff size=2
face=Arial>Thanks</FONT></SPAN></DIV>
<DIV><SPAN class=833455812-17112009><FONT color=#0000ff size=2
face=Arial>Tzachi</FONT></SPAN></DIV><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Tzachi Dar <BR><B>Sent:</B> Sunday,
November 15, 2009 8:03 PM<BR><B>To:</B>
ofw@lists.openfabrics.org<BR><B>Cc:</B> Windows Design<BR><B>Subject:</B>
patch: [MLX4_BUS] support ModStatConfg command to query if port is enabled or
disabled.<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=857260218-15112009>signed off by:
urih</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Index:
Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/fw.c<BR>===================================================================<BR>---
Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/fw.c (revision 4795)<BR>+++
Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/fw.c (revision 4796)<BR>@@
-626,6 +626,54 @@<BR> return
err;<BR> }<BR> <BR>+<BR>+static int<BR>+query_port_state(struct
mlx4_dev *dev, u8 port)<BR>+{<BR>+ int err = 0;<BR>+
u32 input_modifier = 0; <BR>+ u64
out_param;<BR>+<BR>+#define MOD_STAT_OPMOD_QUERY_INLINE 0x3<BR>+#define
MOD_STAT_OFFSET_PORT_EN 0x8<BR>+<BR>+ input_modifier = (1
<< 28) | (port << 8) |
MOD_STAT_OFFSET_PORT_EN;<BR>+<BR>+ err = mlx4_cmd_imm(dev,
0, &out_param, input_modifier,
<BR>+
MOD_STAT_OPMOD_QUERY_INLINE,
<BR>+
MLX4_CMD_QUERY_STAT_CFG,<BR>+
MLX4_CMD_TIME_CLASS_A);<BR>+ if (err) {<BR>+ return
err;<BR>+ }<BR>+ <BR>+
dev->caps.port_state[port] = (((out_param >> 20) & 1) ?
MLX4_PORT_ENABLED : MLX4_PORT_DISABLED);<BR>+ return
0;<BR>+}<BR>+<BR>+int mlx4_port_state(struct mlx4_dev
*dev)<BR>+{<BR>+ u8 i = 0;<BR>+ int err =
0;<BR>+<BR>+ <BR>+ for (i = 1; i <=
MLX4_MAX_PORTS; ++i)<BR>+
{<BR>+ dev->caps.port_state[i] =
MLX4_PORT_ENABLED;<BR>+ }<BR>+
<BR>+ for (i = 1; i <= MLX4_MAX_PORTS;
++i)<BR>+ {<BR>+
err = query_port_state(dev, i);<BR>+
if (err)<BR>+
{<BR>+
return err;<BR>+
}<BR>+ }<BR>+ <BR>+
return 0;<BR>+}<BR>+<BR> static void get_board_id(u8 *vsd, char
*board_id)<BR> {<BR> int i;<BR>Index:
Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/fw.h<BR>===================================================================<BR>---
Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/fw.h (revision 4795)<BR>+++
Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/fw.h (revision 4796)<BR>@@
-160,6 +160,7 @@<BR> int mlx4_UNMAP_FA(struct mlx4_dev
*dev);<BR> int mlx4_RUN_FW(struct mlx4_dev *dev);<BR> int
mlx4_QUERY_FW(struct mlx4_dev *dev);<BR>+int mlx4_port_state(struct mlx4_dev
*dev);<BR> int mlx4_QUERY_ADAPTER(struct mlx4_dev *dev, struct
mlx4_adapter *adapter);<BR> int mlx4_INIT_HCA(struct mlx4_dev *dev,
struct mlx4_init_hca_param *param);<BR> int mlx4_CLOSE_HCA(struct
mlx4_dev *dev, int panic);<BR>Index:
Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/main.c<BR>===================================================================<BR>---
Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/main.c (revision 4795)<BR>+++
Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/main.c (revision 4796)<BR>@@
-146,12 +146,28 @@<BR> <BR> BOOLEAN mlx4_is_eth_port(struct mlx4_dev
*dev, int port_number)<BR> {<BR>- if
(dev->caps.port_type[port_number+1] == MLX4_PORT_TYPE_ETH) {<BR>+ if
(dev->caps.port_type[port_number] == MLX4_PORT_TYPE_ETH)
{<BR> return TRUE;<BR> }<BR> return
FALSE;<BR> }<BR> <BR>+BOOLEAN mlx4_is_ib_port(struct mlx4_dev *dev,
int port_number)<BR>+{<BR>+ if (dev->caps.port_type[port_number] ==
MLX4_PORT_TYPE_IB){<BR>+ return
TRUE;<BR>+ }<BR>+ return
FALSE; <BR>+}<BR>+<BR>+BOOLEAN
mlx4_is_enabled_port(struct mlx4_dev *dev, int port_number)<BR>+{<BR>+ if
(dev->caps.port_state[port_number] == MLX4_PORT_ENABLED)
{<BR>+ return TRUE;<BR>+ }<BR>+ return
FALSE;<BR>+}<BR>+<BR> static int mlx4_dev_cap(struct mlx4_dev *dev,
struct mlx4_dev_cap *dev_cap)<BR> {<BR> int err;<BR>@@ -671,6
+687,12 @@<BR> goto
err_stop_fw;<BR> }<BR> <BR>+
//<BR>+ // Initilize the port state. It's a new command that
is supported only in FW 2.6.1280. <BR>+ //If running on
earlier FW version the command can fail. Ignore the error code
returned<BR>+ //<BR>+
mlx4_port_state(dev);<BR>+<BR> process_mod_param_profile();<BR> profile
= default_profile;<BR> <BR>Index:
Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/mlx4.h<BR>===================================================================<BR>---
Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/mlx4.h (revision 4795)<BR>+++
Q:/projinf3/trunk/hw/mlx4/kernel/bus/net/mlx4.h (revision 4796)<BR>@@
-65,6 +65,11 @@<BR> MLX4_PORT_TYPE_ETH = 1 <<
1,<BR> };<BR> <BR>+enum mlx4_port_state
{<BR>+ MLX4_PORT_ENABLED = 1 <<
0,<BR>+ MLX4_PORT_DISABLED = 1 <<
1,<BR>+};<BR>+<BR> #define
MAX_HCA_CARDS 8<BR> <BR> #pragma warning(disable:4201) //
nameless struct/union<BR>@@ -387,6 +392,8 @@<BR> void
mlx4_net_init();<BR> <BR> BOOLEAN mlx4_is_eth_port(struct mlx4_dev
*dev, int port_number);<BR>+BOOLEAN mlx4_is_ib_port(struct mlx4_dev *dev, int
port_number);<BR>+BOOLEAN mlx4_is_enabled_port(struct mlx4_dev *dev, int
port_number);<BR> int mlx4_count_ib_ports(struct mlx4_dev
*dev);<BR> <BR> struct mlx4_dev_cap;<BR>Index:
Q:/projinf3/trunk/hw/mlx4/kernel/bus/inc/device.h<BR>===================================================================<BR>---
Q:/projinf3/trunk/hw/mlx4/kernel/bus/inc/device.h (revision 4795)<BR>+++
Q:/projinf3/trunk/hw/mlx4/kernel/bus/inc/device.h (revision 4796)<BR>@@
-208,7 +208,8
@@<BR> int log_num_prios;<BR> int num_fc_exch;<BR> enum
mlx4_port_type port_type[MLX4_MAX_PORTS +
1];<BR>- int reserved_fexch_mpts_base;
<BR>+ enum mlx4_port_state port_state[MLX4_MAX_PORTS +
1];<BR>+
int reserved_fexch_mpts_base;
<BR> int total_reserved_qps;<BR> };<BR> <BR>Index:
Q:/projinf3/trunk/hw/mlx4/kernel/bus/inc/cmd.h<BR>===================================================================<BR>---
Q:/projinf3/trunk/hw/mlx4/kernel/bus/inc/cmd.h (revision 4795)<BR>+++
Q:/projinf3/trunk/hw/mlx4/kernel/bus/inc/cmd.h (revision 4796)<BR>@@
-114,6 +114,7 @@<BR> /* miscellaneous commands
*/<BR> MLX4_CMD_DIAG_RPRT =
0x30,<BR> MLX4_CMD_NOP = 0x31,<BR>+
MLX4_CMD_QUERY_STAT_CFG = 0x34,<BR> <BR> /* debug
commands */<BR> MLX4_CMD_QUERY_DEBUG_MSG = 0x2a,<BR>Index:
Q:/projinf3/trunk/hw/mlx4/kernel/bus/drv/drv.c<BR>===================================================================<BR>---
Q:/projinf3/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision 4795)<BR>+++
Q:/projinf3/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision 4796)<BR>@@
-221,7 +221,9 @@<BR> int
number_of_ib_ports;<BR> PFDO_DEVICE_DATA p_fdo =
FdoGetData(Device);<BR> struct mlx4_dev *mdev =
p_fdo->pci_dev.dev;<BR>-<BR>+ BOOLEAN ib_created =
FALSE;<BR>+ BOOLEAN eth_created =
FALSE;<BR>+
<BR> MLX4_ENTER(MLX4_DBG_DRV);<BR> <BR> if (
p_fdo->children_created )<BR>@@ -232,22 +234,38 @@<BR> // this
routine will create all the children on base on this
info<BR> number_of_ib_ports =
mlx4_count_ib_ports(mdev);<BR> ASSERT(number_of_ib_ports >=0
&& number_of_ib_ports
<=2);<BR>- <BR>- if(number_of_ib_ports > 0)
{<BR>- status = __create_child(Device, BUS_HARDWARE_IDS,
BUS_HARDWARE_DESCRIPTION, 0 );<BR>- if (!NT_SUCCESS(status))
{<BR>- MLX4_PRINT_EV(TRACE_LEVEL_ERROR, MLX4_DBG_DRV,
("__create_child (ib)failed with 0x%x\n",
status));<BR>- }<BR>- }<BR> <BR>- // Create ethernet
ports if needed<BR>- for (i = 0; i < MLX4_MAX_PORTS; i++)
{<BR>- if(mlx4_is_eth_port(mdev, i)) {<BR>- status
= __create_child(Device, ETH_HARDWARE_IDS, ETH_HARDWARE_DESCRIPTION, i+1
);<BR>- if (!NT_SUCCESS(status))
{<BR>- MLX4_PRINT_EV(TRACE_LEVEL_ERROR, MLX4_DBG_DRV,
("__create_child (eth) failed with 0x%x\n",
status));<BR>- }<BR>- }<BR>+ for (i = 1; i
<= MLX4_MAX_PORTS; i++) {<BR>+ if
(mlx4_is_enabled_port(mdev, i))
{<BR>+
if(mlx4_is_eth_port(mdev, i))
{<BR>+
status = __create_child(Device, ETH_HARDWARE_IDS, ETH_HARDWARE_DESCRIPTION,
i);<BR>+
if (!NT_SUCCESS(status))
{<BR>+
MLX4_PRINT_EV(TRACE_LEVEL_ERROR, MLX4_DBG_DRV, ("__create_child (eth) failed
with 0x%x\n",
status));<BR>+
break;<BR>+
}<BR>+
eth_created =
TRUE;<BR>+ }
else
{<BR>+
if
(eth_created){<BR>+
//<BR>+
// Illegal configuration the IB should be the first
port<BR>+
//<BR>+
status =
STATUS_INVALID_PARAMETER;<BR>+
MLX4_PRINT_EV(TRACE_LEVEL_ERROR, MLX4_DBG_DRV, ("__create_child (IB) failed.
Invalid configuration, IB should be the first
port."));<BR>+
break;
<BR>+
}<BR>+
<BR>+
if
(ib_created){<BR>+
continue;<BR>+
}<BR>+<BR>+
status = __create_child(Device, BUS_HARDWARE_IDS, BUS_HARDWARE_DESCRIPTION, 0
);<BR>+
if (!NT_SUCCESS(status))
{<BR>+
MLX4_PRINT_EV(TRACE_LEVEL_ERROR, MLX4_DBG_DRV, ("__create_child (ib)failed
with 0x%x\n",
status));<BR>+
break;<BR>+
}<BR>+
ib_created =
TRUE;<BR>+
}<BR>+
}<BR> }<BR> <BR> p_fdo->children_created =
TRUE;<BR></DIV></BLOCKQUOTE></FONT></BODY></HTML>