X710网卡链路状态控制

驱动版本i40e-2.10.19.82,在ifconfig将网口down的时候,发现链路并没有断开,网卡的指示灯还是亮的。如下为控制网卡shutdown的函数:

/**
 * i40e_down - Shutdown the connection processing
 * @vsi: the VSI being stopped
 **/
void i40e_down(struct i40e_vsi *vsi)
{
    int i;

    /* It is assumed that the caller of this function
     * sets the vsi->state __I40E_VSI_DOWN bit.
     */
    if (vsi->netdev) {
        netif_carrier_off(vsi->netdev);
        netif_tx_disable(vsi->netdev);
    }
    i40e_vsi_disable_irq(vsi);
    i40e_vsi_stop_rings(vsi);
    if ((vsi->type == I40E_VSI_MAIN) &&
        (vsi->back->flags & I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED))
        i40e_force_link_state(vsi->back, false);

以上可见,如果没有设置标志位I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED,链路操作函数i40e_force_link_state不会执行。相应的在函数i40e_up中,也是根据此标志位,决定是否将链路启用。

/**
 * i40e_up - Bring the connection back up after being down
 * @vsi: the VSI being configured
 **/
int i40e_up(struct i40e_vsi *vsi)
{
    int err;

    if (vsi->type == I40E_VSI_MAIN &&
        (vsi->back->flags & I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED))
        i40e_force_link_state(vsi->back, true);

    err = i40e_vsi_configure(vsi);
    if (!err)
        err = i40e_up_complete(vsi);

    return err;

链路不关闭将导致对端设备感知不到,影响路由协议的切换。在初始化函数i40e_sw_init中(其在i40e_probe函数中调用),增加标志I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED即可。不太清楚INTEL为什么没有默认设置此标志位。

static int i40e_sw_init(struct i40e_pf *pf)
{
    ...

    /* Set default capability flags */
    pf->flags = I40E_FLAG_RX_CSUM_ENABLED |
            I40E_FLAG_MSI_ENABLED     |
            I40E_FLAG_MSIX_ENABLED;
    pf->flags |= I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED;
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值