Commit e82b7c38 authored by Niranjana Vishwanathapura's avatar Niranjana Vishwanathapura Committed by Doug Ledford

IB/opa_vnic: Properly set vesw port status

Update eth_link_status and operating status information to
represent the overall status of the virtual Ethernet switch port.
Reviewed-by: default avatarSudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 4bbdfe25
...@@ -112,6 +112,27 @@ static u16 opa_vnic_select_queue(struct net_device *netdev, struct sk_buff *skb, ...@@ -112,6 +112,27 @@ static u16 opa_vnic_select_queue(struct net_device *netdev, struct sk_buff *skb,
return rc; return rc;
} }
static void opa_vnic_update_state(struct opa_vnic_adapter *adapter, bool up)
{
struct __opa_veswport_info *info = &adapter->info;
mutex_lock(&adapter->lock);
/* Operational state can only be DROP_ALL or FORWARDING */
if ((info->vport.config_state == OPA_VNIC_STATE_FORWARDING) && up) {
info->vport.oper_state = OPA_VNIC_STATE_FORWARDING;
info->vport.eth_link_status = OPA_VNIC_ETH_LINK_UP;
} else {
info->vport.oper_state = OPA_VNIC_STATE_DROP_ALL;
info->vport.eth_link_status = OPA_VNIC_ETH_LINK_DOWN;
}
if (info->vport.config_state == OPA_VNIC_STATE_FORWARDING)
netif_dormant_off(adapter->netdev);
else
netif_dormant_on(adapter->netdev);
mutex_unlock(&adapter->lock);
}
/* opa_vnic_process_vema_config - process vema configuration updates */ /* opa_vnic_process_vema_config - process vema configuration updates */
void opa_vnic_process_vema_config(struct opa_vnic_adapter *adapter) void opa_vnic_process_vema_config(struct opa_vnic_adapter *adapter)
{ {
...@@ -164,14 +185,8 @@ void opa_vnic_process_vema_config(struct opa_vnic_adapter *adapter) ...@@ -164,14 +185,8 @@ void opa_vnic_process_vema_config(struct opa_vnic_adapter *adapter)
adapter->flow_tbl[i] = port_count ? port_num[i % port_count] : adapter->flow_tbl[i] = port_count ? port_num[i % port_count] :
OPA_VNIC_INVALID_PORT; OPA_VNIC_INVALID_PORT;
/* Operational state can only be DROP_ALL or FORWARDING */ /* update state */
if (info->vport.config_state == OPA_VNIC_STATE_FORWARDING) { opa_vnic_update_state(adapter, !!(netdev->flags & IFF_UP));
info->vport.oper_state = OPA_VNIC_STATE_FORWARDING;
netif_dormant_off(netdev);
} else {
info->vport.oper_state = OPA_VNIC_STATE_DROP_ALL;
netif_dormant_on(netdev);
}
} }
/* /*
...@@ -269,8 +284,8 @@ static int opa_netdev_open(struct net_device *netdev) ...@@ -269,8 +284,8 @@ static int opa_netdev_open(struct net_device *netdev)
return rc; return rc;
} }
/* Update eth link status and send trap */ /* Update status and send trap */
adapter->info.vport.eth_link_status = OPA_VNIC_ETH_LINK_UP; opa_vnic_update_state(adapter, true);
opa_vnic_vema_report_event(adapter, opa_vnic_vema_report_event(adapter,
OPA_VESWPORT_TRAP_ETH_LINK_STATUS_CHANGE); OPA_VESWPORT_TRAP_ETH_LINK_STATUS_CHANGE);
return 0; return 0;
...@@ -288,8 +303,8 @@ static int opa_netdev_close(struct net_device *netdev) ...@@ -288,8 +303,8 @@ static int opa_netdev_close(struct net_device *netdev)
return rc; return rc;
} }
/* Update eth link status and send trap */ /* Update status and send trap */
adapter->info.vport.eth_link_status = OPA_VNIC_ETH_LINK_DOWN; opa_vnic_update_state(adapter, false);
opa_vnic_vema_report_event(adapter, opa_vnic_vema_report_event(adapter,
OPA_VESWPORT_TRAP_ETH_LINK_STATUS_CHANGE); OPA_VESWPORT_TRAP_ETH_LINK_STATUS_CHANGE);
return 0; return 0;
......
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