Commit 3a14aedec42c8c5998db24960cd797bd93f675f9
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
Merge branch 'mlx4'
Amir Vadai says: ==================== net/mlx4: Mellanox driver update 15-10-2013 This patchset contains small code cleaning patches, and a patch to make mlx4_core use module_request() in order to load the relevant link layer module (mlx4_en or mlx4_ib) according to the port type. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 8 changed files Side-by-side Diff
- drivers/net/ethernet/mellanox/mlx4/cmd.c
- drivers/net/ethernet/mellanox/mlx4/en_netdev.c
- drivers/net/ethernet/mellanox/mlx4/fw.c
- drivers/net/ethernet/mellanox/mlx4/main.c
- drivers/net/ethernet/mellanox/mlx4/mcg.c
- drivers/net/ethernet/mellanox/mlx4/srq.c
- include/linux/mlx4/cmd.h
- include/linux/mlx4/device.h
drivers/net/ethernet/mellanox/mlx4/cmd.c
... | ... | @@ -2253,7 +2253,6 @@ |
2253 | 2253 | int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos) |
2254 | 2254 | { |
2255 | 2255 | struct mlx4_priv *priv = mlx4_priv(dev); |
2256 | - struct mlx4_vport_oper_state *vf_oper; | |
2257 | 2256 | struct mlx4_vport_state *vf_admin; |
2258 | 2257 | int slave; |
2259 | 2258 | |
... | ... | @@ -2269,7 +2268,6 @@ |
2269 | 2268 | return -EINVAL; |
2270 | 2269 | |
2271 | 2270 | vf_admin = &priv->mfunc.master.vf_admin[slave].vport[port]; |
2272 | - vf_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; | |
2273 | 2271 | |
2274 | 2272 | if ((0 == vlan) && (0 == qos)) |
2275 | 2273 | vf_admin->default_vlan = MLX4_VGT; |
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
... | ... | @@ -1733,7 +1733,7 @@ |
1733 | 1733 | |
1734 | 1734 | /* Unregister Mac address for the port */ |
1735 | 1735 | mlx4_en_put_qp(priv); |
1736 | - if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN)) | |
1736 | + if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_REASSIGN_MAC_EN)) | |
1737 | 1737 | mdev->mac_removed[priv->port] = 1; |
1738 | 1738 | |
1739 | 1739 | /* Free RX Rings */ |
drivers/net/ethernet/mellanox/mlx4/fw.c
... | ... | @@ -652,7 +652,7 @@ |
652 | 652 | QUERY_DEV_CAP_RSVD_LKEY_OFFSET); |
653 | 653 | MLX4_GET(field, outbox, QUERY_DEV_CAP_FW_REASSIGN_MAC); |
654 | 654 | if (field & 1<<6) |
655 | - dev_cap->flags2 |= MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN; | |
655 | + dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_REASSIGN_MAC_EN; | |
656 | 656 | MLX4_GET(dev_cap->max_icm_sz, outbox, |
657 | 657 | QUERY_DEV_CAP_MAX_ICM_SZ_OFFSET); |
658 | 658 | if (dev_cap->flags & MLX4_DEV_CAP_FLAG_COUNTERS) |
... | ... | @@ -1713,7 +1713,6 @@ |
1713 | 1713 | u32 *outbox; |
1714 | 1714 | u32 modifier; |
1715 | 1715 | u16 token; |
1716 | - u16 type_m; | |
1717 | 1716 | u16 type; |
1718 | 1717 | int err; |
1719 | 1718 | u32 num_qps; |
... | ... | @@ -1746,7 +1745,6 @@ |
1746 | 1745 | MLX4_GET(modifier, outbox, GET_OP_REQ_MODIFIER_OFFSET); |
1747 | 1746 | MLX4_GET(token, outbox, GET_OP_REQ_TOKEN_OFFSET); |
1748 | 1747 | MLX4_GET(type, outbox, GET_OP_REQ_TYPE_OFFSET); |
1749 | - type_m = type >> 12; | |
1750 | 1748 | type &= 0xfff; |
1751 | 1749 | |
1752 | 1750 | switch (type) { |
drivers/net/ethernet/mellanox/mlx4/main.c
... | ... | @@ -42,6 +42,7 @@ |
42 | 42 | #include <linux/io-mapping.h> |
43 | 43 | #include <linux/delay.h> |
44 | 44 | #include <linux/netdevice.h> |
45 | +#include <linux/kmod.h> | |
45 | 46 | |
46 | 47 | #include <linux/mlx4/device.h> |
47 | 48 | #include <linux/mlx4/doorbell.h> |
... | ... | @@ -650,6 +651,27 @@ |
650 | 651 | return err; |
651 | 652 | } |
652 | 653 | |
654 | +static void mlx4_request_modules(struct mlx4_dev *dev) | |
655 | +{ | |
656 | + int port; | |
657 | + int has_ib_port = false; | |
658 | + int has_eth_port = false; | |
659 | +#define EN_DRV_NAME "mlx4_en" | |
660 | +#define IB_DRV_NAME "mlx4_ib" | |
661 | + | |
662 | + for (port = 1; port <= dev->caps.num_ports; port++) { | |
663 | + if (dev->caps.port_type[port] == MLX4_PORT_TYPE_IB) | |
664 | + has_ib_port = true; | |
665 | + else if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH) | |
666 | + has_eth_port = true; | |
667 | + } | |
668 | + | |
669 | + if (has_ib_port) | |
670 | + request_module_nowait(IB_DRV_NAME); | |
671 | + if (has_eth_port) | |
672 | + request_module_nowait(EN_DRV_NAME); | |
673 | +} | |
674 | + | |
653 | 675 | /* |
654 | 676 | * Change the port configuration of the device. |
655 | 677 | * Every user of this function must hold the port mutex. |
... | ... | @@ -681,6 +703,11 @@ |
681 | 703 | } |
682 | 704 | mlx4_set_port_mask(dev); |
683 | 705 | err = mlx4_register_device(dev); |
706 | + if (err) { | |
707 | + mlx4_err(dev, "Failed to register device\n"); | |
708 | + goto out; | |
709 | + } | |
710 | + mlx4_request_modules(dev); | |
684 | 711 | } |
685 | 712 | |
686 | 713 | out: |
... | ... | @@ -2304,6 +2331,8 @@ |
2304 | 2331 | err = mlx4_register_device(dev); |
2305 | 2332 | if (err) |
2306 | 2333 | goto err_port; |
2334 | + | |
2335 | + mlx4_request_modules(dev); | |
2307 | 2336 | |
2308 | 2337 | mlx4_sense_init(dev); |
2309 | 2338 | mlx4_start_sense(dev); |
drivers/net/ethernet/mellanox/mlx4/mcg.c
... | ... | @@ -645,7 +645,7 @@ |
645 | 645 | int mlx4_map_sw_to_hw_steering_mode(struct mlx4_dev *dev, |
646 | 646 | enum mlx4_net_trans_promisc_mode flow_type) |
647 | 647 | { |
648 | - if (flow_type >= MLX4_FS_MODE_NUM || flow_type < 0) { | |
648 | + if (flow_type >= MLX4_FS_MODE_NUM) { | |
649 | 649 | mlx4_err(dev, "Invalid flow type. type = %d\n", flow_type); |
650 | 650 | return -EINVAL; |
651 | 651 | } |
... | ... | @@ -681,7 +681,7 @@ |
681 | 681 | int mlx4_map_sw_to_hw_steering_id(struct mlx4_dev *dev, |
682 | 682 | enum mlx4_net_trans_rule_id id) |
683 | 683 | { |
684 | - if (id >= MLX4_NET_TRANS_RULE_NUM || id < 0) { | |
684 | + if (id >= MLX4_NET_TRANS_RULE_NUM) { | |
685 | 685 | mlx4_err(dev, "Invalid network rule id. id = %d\n", id); |
686 | 686 | return -EINVAL; |
687 | 687 | } |
... | ... | @@ -706,7 +706,7 @@ |
706 | 706 | int mlx4_hw_rule_sz(struct mlx4_dev *dev, |
707 | 707 | enum mlx4_net_trans_rule_id id) |
708 | 708 | { |
709 | - if (id >= MLX4_NET_TRANS_RULE_NUM || id < 0) { | |
709 | + if (id >= MLX4_NET_TRANS_RULE_NUM) { | |
710 | 710 | mlx4_err(dev, "Invalid network rule id. id = %d\n", id); |
711 | 711 | return -EINVAL; |
712 | 712 | } |
drivers/net/ethernet/mellanox/mlx4/srq.c
include/linux/mlx4/cmd.h
... | ... | @@ -154,10 +154,6 @@ |
154 | 154 | MLX4_CMD_QUERY_IF_STAT = 0X54, |
155 | 155 | MLX4_CMD_SET_IF_STAT = 0X55, |
156 | 156 | |
157 | - /* set port opcode modifiers */ | |
158 | - MLX4_SET_PORT_PRIO2TC = 0x8, | |
159 | - MLX4_SET_PORT_SCHEDULER = 0x9, | |
160 | - | |
161 | 157 | /* register/delete flow steering network rules */ |
162 | 158 | MLX4_QP_FLOW_STEERING_ATTACH = 0x65, |
163 | 159 | MLX4_QP_FLOW_STEERING_DETACH = 0x66, |
... | ... | @@ -182,6 +178,8 @@ |
182 | 178 | MLX4_SET_PORT_VLAN_TABLE = 0x3, |
183 | 179 | MLX4_SET_PORT_PRIO_MAP = 0x4, |
184 | 180 | MLX4_SET_PORT_GID_TABLE = 0x5, |
181 | + MLX4_SET_PORT_PRIO2TC = 0x8, | |
182 | + MLX4_SET_PORT_SCHEDULER = 0x9, | |
185 | 183 | }; |
186 | 184 | |
187 | 185 | enum { |
include/linux/mlx4/device.h
... | ... | @@ -155,7 +155,7 @@ |
155 | 155 | MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, |
156 | 156 | MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, |
157 | 157 | MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3, |
158 | - MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4, | |
158 | + MLX4_DEV_CAP_FLAG2_REASSIGN_MAC_EN = 1LL << 4, | |
159 | 159 | MLX4_DEV_CAP_FLAG2_TS = 1LL << 5, |
160 | 160 | MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6, |
161 | 161 | MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7, |