diff options
author | David S. Miller <davem@davemloft.net> | 2017-12-02 21:25:39 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-02 21:25:39 -0500 |
commit | fa935ca224b43031ee10c857d7535aaec85c83b2 (patch) | |
tree | 22971f18f36b10f8da36294f8f56596efd1103c2 | |
parent | ccab371f746abca05a599d074cb3b95a549ef590 (diff) | |
parent | ebd5818cc5d4847897d7fe872e2d9799d7b7fcbb (diff) |
Merge branch 'bnxt_en-fixes'
Michael Chan says:
====================
bnxt_en: Fixes.
A shutdown fix for SMARTNIC, 2 fixes related to TC Flower vxlan
filters, and the last one fixes an out-of-scope variable when sending
short firmware messages.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 55 |
2 files changed, 31 insertions, 29 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index c5c38d4b7d1c..28f5e94274ee 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
@@ -3368,6 +3368,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, | |||
3368 | u16 cp_ring_id, len = 0; | 3368 | u16 cp_ring_id, len = 0; |
3369 | struct hwrm_err_output *resp = bp->hwrm_cmd_resp_addr; | 3369 | struct hwrm_err_output *resp = bp->hwrm_cmd_resp_addr; |
3370 | u16 max_req_len = BNXT_HWRM_MAX_REQ_LEN; | 3370 | u16 max_req_len = BNXT_HWRM_MAX_REQ_LEN; |
3371 | struct hwrm_short_input short_input = {0}; | ||
3371 | 3372 | ||
3372 | req->seq_id = cpu_to_le16(bp->hwrm_cmd_seq++); | 3373 | req->seq_id = cpu_to_le16(bp->hwrm_cmd_seq++); |
3373 | memset(resp, 0, PAGE_SIZE); | 3374 | memset(resp, 0, PAGE_SIZE); |
@@ -3376,7 +3377,6 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, | |||
3376 | 3377 | ||
3377 | if (bp->flags & BNXT_FLAG_SHORT_CMD) { | 3378 | if (bp->flags & BNXT_FLAG_SHORT_CMD) { |
3378 | void *short_cmd_req = bp->hwrm_short_cmd_req_addr; | 3379 | void *short_cmd_req = bp->hwrm_short_cmd_req_addr; |
3379 | struct hwrm_short_input short_input = {0}; | ||
3380 | 3380 | ||
3381 | memcpy(short_cmd_req, req, msg_len); | 3381 | memcpy(short_cmd_req, req, msg_len); |
3382 | memset(short_cmd_req + msg_len, 0, BNXT_HWRM_MAX_REQ_LEN - | 3382 | memset(short_cmd_req + msg_len, 0, BNXT_HWRM_MAX_REQ_LEN - |
@@ -8263,8 +8263,9 @@ static void bnxt_shutdown(struct pci_dev *pdev) | |||
8263 | if (netif_running(dev)) | 8263 | if (netif_running(dev)) |
8264 | dev_close(dev); | 8264 | dev_close(dev); |
8265 | 8265 | ||
8266 | bnxt_ulp_shutdown(bp); | ||
8267 | |||
8266 | if (system_state == SYSTEM_POWER_OFF) { | 8268 | if (system_state == SYSTEM_POWER_OFF) { |
8267 | bnxt_ulp_shutdown(bp); | ||
8268 | bnxt_clear_int_mode(bp); | 8269 | bnxt_clear_int_mode(bp); |
8269 | pci_wake_from_d3(pdev, bp->wol); | 8270 | pci_wake_from_d3(pdev, bp->wol); |
8270 | pci_set_power_state(pdev, PCI_D3hot); | 8271 | pci_set_power_state(pdev, PCI_D3hot); |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c index d5031f436f83..3d201d7324bd 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | |||
@@ -56,7 +56,6 @@ static int bnxt_tc_parse_redir(struct bnxt *bp, | |||
56 | { | 56 | { |
57 | int ifindex = tcf_mirred_ifindex(tc_act); | 57 | int ifindex = tcf_mirred_ifindex(tc_act); |
58 | struct net_device *dev; | 58 | struct net_device *dev; |
59 | u16 dst_fid; | ||
60 | 59 | ||
61 | dev = __dev_get_by_index(dev_net(bp->dev), ifindex); | 60 | dev = __dev_get_by_index(dev_net(bp->dev), ifindex); |
62 | if (!dev) { | 61 | if (!dev) { |
@@ -64,15 +63,7 @@ static int bnxt_tc_parse_redir(struct bnxt *bp, | |||
64 | return -EINVAL; | 63 | return -EINVAL; |
65 | } | 64 | } |
66 | 65 | ||
67 | /* find the FID from dev */ | ||
68 | dst_fid = bnxt_flow_get_dst_fid(bp, dev); | ||
69 | if (dst_fid == BNXT_FID_INVALID) { | ||
70 | netdev_info(bp->dev, "can't get fid for ifindex=%d", ifindex); | ||
71 | return -EINVAL; | ||
72 | } | ||
73 | |||
74 | actions->flags |= BNXT_TC_ACTION_FLAG_FWD; | 66 | actions->flags |= BNXT_TC_ACTION_FLAG_FWD; |
75 | actions->dst_fid = dst_fid; | ||
76 | actions->dst_dev = dev; | 67 | actions->dst_dev = dev; |
77 | return 0; | 68 | return 0; |
78 | } | 69 | } |
@@ -160,13 +151,17 @@ static int bnxt_tc_parse_actions(struct bnxt *bp, | |||
160 | if (rc) | 151 | if (rc) |
161 | return rc; | 152 | return rc; |
162 | 153 | ||
163 | /* Tunnel encap/decap action must be accompanied by a redirect action */ | 154 | if (actions->flags & BNXT_TC_ACTION_FLAG_FWD) { |
164 | if ((actions->flags & BNXT_TC_ACTION_FLAG_TUNNEL_ENCAP || | 155 | if (actions->flags & BNXT_TC_ACTION_FLAG_TUNNEL_ENCAP) { |
165 | actions->flags & BNXT_TC_ACTION_FLAG_TUNNEL_DECAP) && | 156 | /* dst_fid is PF's fid */ |
166 | !(actions->flags & BNXT_TC_ACTION_FLAG_FWD)) { | 157 | actions->dst_fid = bp->pf.fw_fid; |
167 | netdev_info(bp->dev, | 158 | } else { |
168 | "error: no redir action along with encap/decap"); | 159 | /* find the FID from dst_dev */ |
169 | return -EINVAL; | 160 | actions->dst_fid = |
161 | bnxt_flow_get_dst_fid(bp, actions->dst_dev); | ||
162 | if (actions->dst_fid == BNXT_FID_INVALID) | ||
163 | return -EINVAL; | ||
164 | } | ||
170 | } | 165 | } |
171 | 166 | ||
172 | return rc; | 167 | return rc; |
@@ -532,10 +527,8 @@ static int hwrm_cfa_decap_filter_alloc(struct bnxt *bp, | |||
532 | } | 527 | } |
533 | 528 | ||
534 | if (flow->flags & BNXT_TC_FLOW_FLAGS_TUNL_ETH_ADDRS) { | 529 | if (flow->flags & BNXT_TC_FLOW_FLAGS_TUNL_ETH_ADDRS) { |
535 | enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_DST_MACADDR | | 530 | enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_DST_MACADDR; |
536 | CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_SRC_MACADDR; | ||
537 | ether_addr_copy(req.dst_macaddr, l2_info->dmac); | 531 | ether_addr_copy(req.dst_macaddr, l2_info->dmac); |
538 | ether_addr_copy(req.src_macaddr, l2_info->smac); | ||
539 | } | 532 | } |
540 | if (l2_info->num_vlans) { | 533 | if (l2_info->num_vlans) { |
541 | enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_T_IVLAN_VID; | 534 | enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_T_IVLAN_VID; |
@@ -901,10 +894,10 @@ static void bnxt_tc_put_decap_handle(struct bnxt *bp, | |||
901 | 894 | ||
902 | static int bnxt_tc_resolve_tunnel_hdrs(struct bnxt *bp, | 895 | static int bnxt_tc_resolve_tunnel_hdrs(struct bnxt *bp, |
903 | struct ip_tunnel_key *tun_key, | 896 | struct ip_tunnel_key *tun_key, |
904 | struct bnxt_tc_l2_key *l2_info, | 897 | struct bnxt_tc_l2_key *l2_info) |
905 | struct net_device *real_dst_dev) | ||
906 | { | 898 | { |
907 | #ifdef CONFIG_INET | 899 | #ifdef CONFIG_INET |
900 | struct net_device *real_dst_dev = bp->dev; | ||
908 | struct flowi4 flow = { {0} }; | 901 | struct flowi4 flow = { {0} }; |
909 | struct net_device *dst_dev; | 902 | struct net_device *dst_dev; |
910 | struct neighbour *nbr; | 903 | struct neighbour *nbr; |
@@ -1008,14 +1001,13 @@ static int bnxt_tc_get_decap_handle(struct bnxt *bp, struct bnxt_tc_flow *flow, | |||
1008 | */ | 1001 | */ |
1009 | tun_key.u.ipv4.dst = flow->tun_key.u.ipv4.src; | 1002 | tun_key.u.ipv4.dst = flow->tun_key.u.ipv4.src; |
1010 | tun_key.tp_dst = flow->tun_key.tp_dst; | 1003 | tun_key.tp_dst = flow->tun_key.tp_dst; |
1011 | rc = bnxt_tc_resolve_tunnel_hdrs(bp, &tun_key, &l2_info, bp->dev); | 1004 | rc = bnxt_tc_resolve_tunnel_hdrs(bp, &tun_key, &l2_info); |
1012 | if (rc) | 1005 | if (rc) |
1013 | goto put_decap; | 1006 | goto put_decap; |
1014 | 1007 | ||
1015 | decap_key->ttl = tun_key.ttl; | ||
1016 | decap_l2_info = &decap_node->l2_info; | 1008 | decap_l2_info = &decap_node->l2_info; |
1009 | /* decap smac is wildcarded */ | ||
1017 | ether_addr_copy(decap_l2_info->dmac, l2_info.smac); | 1010 | ether_addr_copy(decap_l2_info->dmac, l2_info.smac); |
1018 | ether_addr_copy(decap_l2_info->smac, l2_info.dmac); | ||
1019 | if (l2_info.num_vlans) { | 1011 | if (l2_info.num_vlans) { |
1020 | decap_l2_info->num_vlans = l2_info.num_vlans; | 1012 | decap_l2_info->num_vlans = l2_info.num_vlans; |
1021 | decap_l2_info->inner_vlan_tpid = l2_info.inner_vlan_tpid; | 1013 | decap_l2_info->inner_vlan_tpid = l2_info.inner_vlan_tpid; |
@@ -1095,8 +1087,7 @@ static int bnxt_tc_get_encap_handle(struct bnxt *bp, struct bnxt_tc_flow *flow, | |||
1095 | if (encap_node->tunnel_handle != INVALID_TUNNEL_HANDLE) | 1087 | if (encap_node->tunnel_handle != INVALID_TUNNEL_HANDLE) |
1096 | goto done; | 1088 | goto done; |
1097 | 1089 | ||
1098 | rc = bnxt_tc_resolve_tunnel_hdrs(bp, encap_key, &encap_node->l2_info, | 1090 | rc = bnxt_tc_resolve_tunnel_hdrs(bp, encap_key, &encap_node->l2_info); |
1099 | flow->actions.dst_dev); | ||
1100 | if (rc) | 1091 | if (rc) |
1101 | goto put_encap; | 1092 | goto put_encap; |
1102 | 1093 | ||
@@ -1169,6 +1160,15 @@ static int __bnxt_tc_del_flow(struct bnxt *bp, | |||
1169 | return 0; | 1160 | return 0; |
1170 | } | 1161 | } |
1171 | 1162 | ||
1163 | static void bnxt_tc_set_src_fid(struct bnxt *bp, struct bnxt_tc_flow *flow, | ||
1164 | u16 src_fid) | ||
1165 | { | ||
1166 | if (flow->actions.flags & BNXT_TC_ACTION_FLAG_TUNNEL_DECAP) | ||
1167 | flow->src_fid = bp->pf.fw_fid; | ||
1168 | else | ||
1169 | flow->src_fid = src_fid; | ||
1170 | } | ||
1171 | |||
1172 | /* Add a new flow or replace an existing flow. | 1172 | /* Add a new flow or replace an existing flow. |
1173 | * Notes on locking: | 1173 | * Notes on locking: |
1174 | * There are essentially two critical sections here. | 1174 | * There are essentially two critical sections here. |
@@ -1204,7 +1204,8 @@ static int bnxt_tc_add_flow(struct bnxt *bp, u16 src_fid, | |||
1204 | rc = bnxt_tc_parse_flow(bp, tc_flow_cmd, flow); | 1204 | rc = bnxt_tc_parse_flow(bp, tc_flow_cmd, flow); |
1205 | if (rc) | 1205 | if (rc) |
1206 | goto free_node; | 1206 | goto free_node; |
1207 | flow->src_fid = src_fid; | 1207 | |
1208 | bnxt_tc_set_src_fid(bp, flow, src_fid); | ||
1208 | 1209 | ||
1209 | if (!bnxt_tc_can_offload(bp, flow)) { | 1210 | if (!bnxt_tc_can_offload(bp, flow)) { |
1210 | rc = -ENOSPC; | 1211 | rc = -ENOSPC; |