Commit fa935ca2 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents ccab371f ebd5818c
...@@ -3368,6 +3368,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, ...@@ -3368,6 +3368,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
u16 cp_ring_id, len = 0; u16 cp_ring_id, len = 0;
struct hwrm_err_output *resp = bp->hwrm_cmd_resp_addr; struct hwrm_err_output *resp = bp->hwrm_cmd_resp_addr;
u16 max_req_len = BNXT_HWRM_MAX_REQ_LEN; u16 max_req_len = BNXT_HWRM_MAX_REQ_LEN;
struct hwrm_short_input short_input = {0};
req->seq_id = cpu_to_le16(bp->hwrm_cmd_seq++); req->seq_id = cpu_to_le16(bp->hwrm_cmd_seq++);
memset(resp, 0, PAGE_SIZE); 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,7 +3377,6 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
if (bp->flags & BNXT_FLAG_SHORT_CMD) { if (bp->flags & BNXT_FLAG_SHORT_CMD) {
void *short_cmd_req = bp->hwrm_short_cmd_req_addr; void *short_cmd_req = bp->hwrm_short_cmd_req_addr;
struct hwrm_short_input short_input = {0};
memcpy(short_cmd_req, req, msg_len); memcpy(short_cmd_req, req, msg_len);
memset(short_cmd_req + msg_len, 0, BNXT_HWRM_MAX_REQ_LEN - 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,8 +8263,9 @@ static void bnxt_shutdown(struct pci_dev *pdev)
if (netif_running(dev)) if (netif_running(dev))
dev_close(dev); dev_close(dev);
if (system_state == SYSTEM_POWER_OFF) {
bnxt_ulp_shutdown(bp); bnxt_ulp_shutdown(bp);
if (system_state == SYSTEM_POWER_OFF) {
bnxt_clear_int_mode(bp); bnxt_clear_int_mode(bp);
pci_wake_from_d3(pdev, bp->wol); pci_wake_from_d3(pdev, bp->wol);
pci_set_power_state(pdev, PCI_D3hot); pci_set_power_state(pdev, PCI_D3hot);
......
...@@ -56,7 +56,6 @@ static int bnxt_tc_parse_redir(struct bnxt *bp, ...@@ -56,7 +56,6 @@ static int bnxt_tc_parse_redir(struct bnxt *bp,
{ {
int ifindex = tcf_mirred_ifindex(tc_act); int ifindex = tcf_mirred_ifindex(tc_act);
struct net_device *dev; struct net_device *dev;
u16 dst_fid;
dev = __dev_get_by_index(dev_net(bp->dev), ifindex); dev = __dev_get_by_index(dev_net(bp->dev), ifindex);
if (!dev) { if (!dev) {
...@@ -64,15 +63,7 @@ static int bnxt_tc_parse_redir(struct bnxt *bp, ...@@ -64,15 +63,7 @@ static int bnxt_tc_parse_redir(struct bnxt *bp,
return -EINVAL; return -EINVAL;
} }
/* find the FID from dev */
dst_fid = bnxt_flow_get_dst_fid(bp, dev);
if (dst_fid == BNXT_FID_INVALID) {
netdev_info(bp->dev, "can't get fid for ifindex=%d", ifindex);
return -EINVAL;
}
actions->flags |= BNXT_TC_ACTION_FLAG_FWD; actions->flags |= BNXT_TC_ACTION_FLAG_FWD;
actions->dst_fid = dst_fid;
actions->dst_dev = dev; actions->dst_dev = dev;
return 0; return 0;
} }
...@@ -160,14 +151,18 @@ static int bnxt_tc_parse_actions(struct bnxt *bp, ...@@ -160,14 +151,18 @@ static int bnxt_tc_parse_actions(struct bnxt *bp,
if (rc) if (rc)
return rc; return rc;
/* Tunnel encap/decap action must be accompanied by a redirect action */ if (actions->flags & BNXT_TC_ACTION_FLAG_FWD) {
if ((actions->flags & BNXT_TC_ACTION_FLAG_TUNNEL_ENCAP || if (actions->flags & BNXT_TC_ACTION_FLAG_TUNNEL_ENCAP) {
actions->flags & BNXT_TC_ACTION_FLAG_TUNNEL_DECAP) && /* dst_fid is PF's fid */
!(actions->flags & BNXT_TC_ACTION_FLAG_FWD)) { actions->dst_fid = bp->pf.fw_fid;
netdev_info(bp->dev, } else {
"error: no redir action along with encap/decap"); /* find the FID from dst_dev */
actions->dst_fid =
bnxt_flow_get_dst_fid(bp, actions->dst_dev);
if (actions->dst_fid == BNXT_FID_INVALID)
return -EINVAL; return -EINVAL;
} }
}
return rc; return rc;
} }
...@@ -532,10 +527,8 @@ static int hwrm_cfa_decap_filter_alloc(struct bnxt *bp, ...@@ -532,10 +527,8 @@ static int hwrm_cfa_decap_filter_alloc(struct bnxt *bp,
} }
if (flow->flags & BNXT_TC_FLOW_FLAGS_TUNL_ETH_ADDRS) { if (flow->flags & BNXT_TC_FLOW_FLAGS_TUNL_ETH_ADDRS) {
enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_DST_MACADDR | enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_DST_MACADDR;
CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_SRC_MACADDR;
ether_addr_copy(req.dst_macaddr, l2_info->dmac); ether_addr_copy(req.dst_macaddr, l2_info->dmac);
ether_addr_copy(req.src_macaddr, l2_info->smac);
} }
if (l2_info->num_vlans) { if (l2_info->num_vlans) {
enables |= CFA_DECAP_FILTER_ALLOC_REQ_ENABLES_T_IVLAN_VID; 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,10 +894,10 @@ static void bnxt_tc_put_decap_handle(struct bnxt *bp,
static int bnxt_tc_resolve_tunnel_hdrs(struct bnxt *bp, static int bnxt_tc_resolve_tunnel_hdrs(struct bnxt *bp,
struct ip_tunnel_key *tun_key, struct ip_tunnel_key *tun_key,
struct bnxt_tc_l2_key *l2_info, struct bnxt_tc_l2_key *l2_info)
struct net_device *real_dst_dev)
{ {
#ifdef CONFIG_INET #ifdef CONFIG_INET
struct net_device *real_dst_dev = bp->dev;
struct flowi4 flow = { {0} }; struct flowi4 flow = { {0} };
struct net_device *dst_dev; struct net_device *dst_dev;
struct neighbour *nbr; struct neighbour *nbr;
...@@ -1008,14 +1001,13 @@ static int bnxt_tc_get_decap_handle(struct bnxt *bp, struct bnxt_tc_flow *flow, ...@@ -1008,14 +1001,13 @@ static int bnxt_tc_get_decap_handle(struct bnxt *bp, struct bnxt_tc_flow *flow,
*/ */
tun_key.u.ipv4.dst = flow->tun_key.u.ipv4.src; tun_key.u.ipv4.dst = flow->tun_key.u.ipv4.src;
tun_key.tp_dst = flow->tun_key.tp_dst; tun_key.tp_dst = flow->tun_key.tp_dst;
rc = bnxt_tc_resolve_tunnel_hdrs(bp, &tun_key, &l2_info, bp->dev); rc = bnxt_tc_resolve_tunnel_hdrs(bp, &tun_key, &l2_info);
if (rc) if (rc)
goto put_decap; goto put_decap;
decap_key->ttl = tun_key.ttl;
decap_l2_info = &decap_node->l2_info; decap_l2_info = &decap_node->l2_info;
/* decap smac is wildcarded */
ether_addr_copy(decap_l2_info->dmac, l2_info.smac); ether_addr_copy(decap_l2_info->dmac, l2_info.smac);
ether_addr_copy(decap_l2_info->smac, l2_info.dmac);
if (l2_info.num_vlans) { if (l2_info.num_vlans) {
decap_l2_info->num_vlans = l2_info.num_vlans; decap_l2_info->num_vlans = l2_info.num_vlans;
decap_l2_info->inner_vlan_tpid = l2_info.inner_vlan_tpid; 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,8 +1087,7 @@ static int bnxt_tc_get_encap_handle(struct bnxt *bp, struct bnxt_tc_flow *flow,
if (encap_node->tunnel_handle != INVALID_TUNNEL_HANDLE) if (encap_node->tunnel_handle != INVALID_TUNNEL_HANDLE)
goto done; goto done;
rc = bnxt_tc_resolve_tunnel_hdrs(bp, encap_key, &encap_node->l2_info, rc = bnxt_tc_resolve_tunnel_hdrs(bp, encap_key, &encap_node->l2_info);
flow->actions.dst_dev);
if (rc) if (rc)
goto put_encap; goto put_encap;
...@@ -1169,6 +1160,15 @@ static int __bnxt_tc_del_flow(struct bnxt *bp, ...@@ -1169,6 +1160,15 @@ static int __bnxt_tc_del_flow(struct bnxt *bp,
return 0; return 0;
} }
static void bnxt_tc_set_src_fid(struct bnxt *bp, struct bnxt_tc_flow *flow,
u16 src_fid)
{
if (flow->actions.flags & BNXT_TC_ACTION_FLAG_TUNNEL_DECAP)
flow->src_fid = bp->pf.fw_fid;
else
flow->src_fid = src_fid;
}
/* Add a new flow or replace an existing flow. /* Add a new flow or replace an existing flow.
* Notes on locking: * Notes on locking:
* There are essentially two critical sections here. * There are essentially two critical sections here.
...@@ -1204,7 +1204,8 @@ static int bnxt_tc_add_flow(struct bnxt *bp, u16 src_fid, ...@@ -1204,7 +1204,8 @@ static int bnxt_tc_add_flow(struct bnxt *bp, u16 src_fid,
rc = bnxt_tc_parse_flow(bp, tc_flow_cmd, flow); rc = bnxt_tc_parse_flow(bp, tc_flow_cmd, flow);
if (rc) if (rc)
goto free_node; goto free_node;
flow->src_fid = src_fid;
bnxt_tc_set_src_fid(bp, flow, src_fid);
if (!bnxt_tc_can_offload(bp, flow)) { if (!bnxt_tc_can_offload(bp, flow)) {
rc = -ENOSPC; rc = -ENOSPC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment