提交 7cdd5fc3 编写于 作者: A Alexander Duyck 提交者: David S. Miller

bnxt: Move GENEVE support from hard-coded port to using port notifier

The port number for GENEVE is hard coded into the bnxt driver.  This is the
kind of thing we want to avoid going forward.  For now I will integrate
this back into the port notifier so that we can change the GENEVE port
number if we need to in the future.
Signed-off-by: NAlexander Duyck <aduyck@mirantis.com>
Acked-by: NMichael Chan <michael.chan@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ad51b8e9
...@@ -5253,13 +5253,8 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) ...@@ -5253,13 +5253,8 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
netdev_warn(bp->dev, "failed to update phy settings\n"); netdev_warn(bp->dev, "failed to update phy settings\n");
} }
if (irq_re_init) { if (irq_re_init)
udp_tunnel_get_rx_info(bp->dev); udp_tunnel_get_rx_info(bp->dev);
if (!bnxt_hwrm_tunnel_dst_port_alloc(
bp, htons(0x17c1),
TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE))
bp->nge_port_cnt = 1;
}
set_bit(BNXT_STATE_OPEN, &bp->state); set_bit(BNXT_STATE_OPEN, &bp->state);
bnxt_enable_int(bp); bnxt_enable_int(bp);
...@@ -5877,6 +5872,15 @@ static void bnxt_sp_task(struct work_struct *work) ...@@ -5877,6 +5872,15 @@ static void bnxt_sp_task(struct work_struct *work)
bnxt_hwrm_tunnel_dst_port_free( bnxt_hwrm_tunnel_dst_port_free(
bp, TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN); bp, TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN);
} }
if (test_and_clear_bit(BNXT_GENEVE_ADD_PORT_SP_EVENT, &bp->sp_event)) {
bnxt_hwrm_tunnel_dst_port_alloc(
bp, bp->nge_port,
TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE);
}
if (test_and_clear_bit(BNXT_GENEVE_DEL_PORT_SP_EVENT, &bp->sp_event)) {
bnxt_hwrm_tunnel_dst_port_free(
bp, TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE);
}
if (test_and_clear_bit(BNXT_RESET_TASK_SP_EVENT, &bp->sp_event)) if (test_and_clear_bit(BNXT_RESET_TASK_SP_EVENT, &bp->sp_event))
bnxt_reset(bp, false); bnxt_reset(bp, false);
...@@ -6269,6 +6273,16 @@ static void bnxt_udp_tunnel_add(struct net_device *dev, ...@@ -6269,6 +6273,16 @@ static void bnxt_udp_tunnel_add(struct net_device *dev,
schedule_work(&bp->sp_task); schedule_work(&bp->sp_task);
} }
break; break;
case UDP_TUNNEL_TYPE_GENEVE:
if (bp->nge_port_cnt && bp->nge_port != ti->port)
return;
bp->nge_port_cnt++;
if (bp->nge_port_cnt == 1) {
bp->nge_port = ti->port;
set_bit(BNXT_GENEVE_ADD_PORT_SP_EVENT, &bp->sp_event);
}
break;
default: default:
return; return;
} }
...@@ -6298,6 +6312,16 @@ static void bnxt_udp_tunnel_del(struct net_device *dev, ...@@ -6298,6 +6312,16 @@ static void bnxt_udp_tunnel_del(struct net_device *dev,
set_bit(BNXT_VXLAN_DEL_PORT_SP_EVENT, &bp->sp_event); set_bit(BNXT_VXLAN_DEL_PORT_SP_EVENT, &bp->sp_event);
break; break;
case UDP_TUNNEL_TYPE_GENEVE:
if (!bp->nge_port_cnt || bp->nge_port != ti->port)
return;
bp->nge_port_cnt--;
if (bp->nge_port_cnt != 0)
return;
set_bit(BNXT_GENEVE_DEL_PORT_SP_EVENT, &bp->sp_event);
break;
default: default:
return; return;
} }
......
...@@ -1049,6 +1049,7 @@ struct bnxt { ...@@ -1049,6 +1049,7 @@ struct bnxt {
__be16 vxlan_port; __be16 vxlan_port;
u8 vxlan_port_cnt; u8 vxlan_port_cnt;
__le16 vxlan_fw_dst_port_id; __le16 vxlan_fw_dst_port_id;
__be16 nge_port;
u8 nge_port_cnt; u8 nge_port_cnt;
__le16 nge_fw_dst_port_id; __le16 nge_fw_dst_port_id;
u8 port_partition_type; u8 port_partition_type;
...@@ -1078,6 +1079,8 @@ struct bnxt { ...@@ -1078,6 +1079,8 @@ struct bnxt {
#define BNXT_PERIODIC_STATS_SP_EVENT 9 #define BNXT_PERIODIC_STATS_SP_EVENT 9
#define BNXT_HWRM_PORT_MODULE_SP_EVENT 10 #define BNXT_HWRM_PORT_MODULE_SP_EVENT 10
#define BNXT_RESET_TASK_SILENT_SP_EVENT 11 #define BNXT_RESET_TASK_SILENT_SP_EVENT 11
#define BNXT_GENEVE_ADD_PORT_SP_EVENT 12
#define BNXT_GENEVE_DEL_PORT_SP_EVENT 13
struct bnxt_pf_info pf; struct bnxt_pf_info pf;
#ifdef CONFIG_BNXT_SRIOV #ifdef CONFIG_BNXT_SRIOV
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册