diff options
author | Hadar Hen Zion <hadarh@mellanox.co.il> | 2012-07-05 00:03:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-07 19:23:05 -0400 |
commit | 8fcfb4db74352d3d447b7a559ad54f7577074d19 (patch) | |
tree | 3d60738ca8b0323189041305fb03128c839104bf | |
parent | c96d97f4d127b61def87b3ee056bec20cfc265d1 (diff) |
net/mlx4_core: Add firmware commands to support device managed flow steering
Add support for firmware commands to attach/detach a new device managed
steering mode. Such network steering rules allow the user to provide an
L2/L3/L4 flow specification to the firmware and have the device to steer
traffic that matches that specification to the provided QP.
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/cmd.c | 19 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mcg.c | 29 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mlx4.h | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 24 | ||||
-rw-r--r-- | include/linux/mlx4/cmd.h | 4 |
5 files changed, 86 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 842c8ce9494e..7e94987d030c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -1080,6 +1080,25 @@ static struct mlx4_cmd_info cmd_info[] = { | |||
1080 | .verify = NULL, | 1080 | .verify = NULL, |
1081 | .wrapper = NULL | 1081 | .wrapper = NULL |
1082 | }, | 1082 | }, |
1083 | /* flow steering commands */ | ||
1084 | { | ||
1085 | .opcode = MLX4_QP_FLOW_STEERING_ATTACH, | ||
1086 | .has_inbox = true, | ||
1087 | .has_outbox = false, | ||
1088 | .out_is_imm = true, | ||
1089 | .encode_slave_id = false, | ||
1090 | .verify = NULL, | ||
1091 | .wrapper = mlx4_QP_FLOW_STEERING_ATTACH_wrapper | ||
1092 | }, | ||
1093 | { | ||
1094 | .opcode = MLX4_QP_FLOW_STEERING_DETACH, | ||
1095 | .has_inbox = false, | ||
1096 | .has_outbox = false, | ||
1097 | .out_is_imm = false, | ||
1098 | .encode_slave_id = false, | ||
1099 | .verify = NULL, | ||
1100 | .wrapper = mlx4_QP_FLOW_STEERING_DETACH_wrapper | ||
1101 | }, | ||
1083 | }; | 1102 | }; |
1084 | 1103 | ||
1085 | static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave, | 1104 | static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c index 319c9d45d59a..3c59a33a98a5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mcg.c +++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c | |||
@@ -62,6 +62,35 @@ int mlx4_get_qp_per_mgm(struct mlx4_dev *dev) | |||
62 | return 4 * (mlx4_get_mgm_entry_size(dev) / 16 - 2); | 62 | return 4 * (mlx4_get_mgm_entry_size(dev) / 16 - 2); |
63 | } | 63 | } |
64 | 64 | ||
65 | static int mlx4_QP_FLOW_STEERING_ATTACH(struct mlx4_dev *dev, | ||
66 | struct mlx4_cmd_mailbox *mailbox, | ||
67 | u32 size, | ||
68 | u64 *reg_id) | ||
69 | { | ||
70 | u64 imm; | ||
71 | int err = 0; | ||
72 | |||
73 | err = mlx4_cmd_imm(dev, mailbox->dma, &imm, size, 0, | ||
74 | MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A, | ||
75 | MLX4_CMD_NATIVE); | ||
76 | if (err) | ||
77 | return err; | ||
78 | *reg_id = imm; | ||
79 | |||
80 | return err; | ||
81 | } | ||
82 | |||
83 | static int mlx4_QP_FLOW_STEERING_DETACH(struct mlx4_dev *dev, u64 regid) | ||
84 | { | ||
85 | int err = 0; | ||
86 | |||
87 | err = mlx4_cmd(dev, regid, 0, 0, | ||
88 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, | ||
89 | MLX4_CMD_NATIVE); | ||
90 | |||
91 | return err; | ||
92 | } | ||
93 | |||
65 | static int mlx4_READ_ENTRY(struct mlx4_dev *dev, int index, | 94 | static int mlx4_READ_ENTRY(struct mlx4_dev *dev, int index, |
66 | struct mlx4_cmd_mailbox *mailbox) | 95 | struct mlx4_cmd_mailbox *mailbox) |
67 | { | 96 | { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index a425a984758f..c07e882e8369 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h | |||
@@ -1118,6 +1118,16 @@ int mlx4_QUERY_IF_STAT_wrapper(struct mlx4_dev *dev, int slave, | |||
1118 | struct mlx4_cmd_mailbox *inbox, | 1118 | struct mlx4_cmd_mailbox *inbox, |
1119 | struct mlx4_cmd_mailbox *outbox, | 1119 | struct mlx4_cmd_mailbox *outbox, |
1120 | struct mlx4_cmd_info *cmd); | 1120 | struct mlx4_cmd_info *cmd); |
1121 | int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | ||
1122 | struct mlx4_vhcr *vhcr, | ||
1123 | struct mlx4_cmd_mailbox *inbox, | ||
1124 | struct mlx4_cmd_mailbox *outbox, | ||
1125 | struct mlx4_cmd_info *cmd); | ||
1126 | int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave, | ||
1127 | struct mlx4_vhcr *vhcr, | ||
1128 | struct mlx4_cmd_mailbox *inbox, | ||
1129 | struct mlx4_cmd_mailbox *outbox, | ||
1130 | struct mlx4_cmd_info *cmd); | ||
1121 | 1131 | ||
1122 | int mlx4_get_mgm_entry_size(struct mlx4_dev *dev); | 1132 | int mlx4_get_mgm_entry_size(struct mlx4_dev *dev); |
1123 | int mlx4_get_qp_per_mgm(struct mlx4_dev *dev); | 1133 | int mlx4_get_qp_per_mgm(struct mlx4_dev *dev); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 6bdac2955f8b..a8ca960f4620 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -2738,6 +2738,30 @@ ex_put: | |||
2738 | return err; | 2738 | return err; |
2739 | } | 2739 | } |
2740 | 2740 | ||
2741 | int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | ||
2742 | struct mlx4_vhcr *vhcr, | ||
2743 | struct mlx4_cmd_mailbox *inbox, | ||
2744 | struct mlx4_cmd_mailbox *outbox, | ||
2745 | struct mlx4_cmd_info *cmd) | ||
2746 | { | ||
2747 | return mlx4_cmd_imm(dev, inbox->dma, &vhcr->out_param, | ||
2748 | vhcr->in_modifier, 0, | ||
2749 | MLX4_QP_FLOW_STEERING_ATTACH, | ||
2750 | MLX4_CMD_TIME_CLASS_A, | ||
2751 | MLX4_CMD_NATIVE); | ||
2752 | } | ||
2753 | |||
2754 | int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave, | ||
2755 | struct mlx4_vhcr *vhcr, | ||
2756 | struct mlx4_cmd_mailbox *inbox, | ||
2757 | struct mlx4_cmd_mailbox *outbox, | ||
2758 | struct mlx4_cmd_info *cmd) | ||
2759 | { | ||
2760 | return mlx4_cmd(dev, vhcr->in_param, 0, 0, | ||
2761 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, | ||
2762 | MLX4_CMD_NATIVE); | ||
2763 | } | ||
2764 | |||
2741 | enum { | 2765 | enum { |
2742 | BUSY_MAX_RETRIES = 10 | 2766 | BUSY_MAX_RETRIES = 10 |
2743 | }; | 2767 | }; |
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h index 1f3860a8a109..260695186256 100644 --- a/include/linux/mlx4/cmd.h +++ b/include/linux/mlx4/cmd.h | |||
@@ -154,6 +154,10 @@ enum { | |||
154 | /* set port opcode modifiers */ | 154 | /* set port opcode modifiers */ |
155 | MLX4_SET_PORT_PRIO2TC = 0x8, | 155 | MLX4_SET_PORT_PRIO2TC = 0x8, |
156 | MLX4_SET_PORT_SCHEDULER = 0x9, | 156 | MLX4_SET_PORT_SCHEDULER = 0x9, |
157 | |||
158 | /* register/delete flow steering network rules */ | ||
159 | MLX4_QP_FLOW_STEERING_ATTACH = 0x65, | ||
160 | MLX4_QP_FLOW_STEERING_DETACH = 0x66, | ||
157 | }; | 161 | }; |
158 | 162 | ||
159 | enum { | 163 | enum { |