ethernet驱动支持802.1Q(vlantag 1518包)

由于上层交换机增加了vlan tag所以ap giga port需要更改以支持从上层交换机过来的1518大包
具体更改的是ethernet.c 中的cvm_oct_change_mtu(struct net_device *dev, int new_mtu)
/**
 * Change the link MTU. Unimplemented
 *
 * @param dev     Device to change
 * @param new_mtu The new MTU
 * @return Zero on success
 */
static int cvm_oct_change_mtu(struct net_device *dev, int new_mtu)
{
    cvm_oct_private_t* priv = (cvm_oct_private_t*)dev->priv;  
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 int vlan_bytes = 4;
#else
 int vlan_bytes = 0;
#endif
    int max_packet = new_mtu + 14 + 4 + vlan_bytes; /* Add ethernet header and FCS, and VLAN if configured. */
    /* Limit the MTU to make sure the ethernet packets are between 64 bytes
        and 65535 bytes */
    if ((max_packet < 64) || (max_packet > 65392))
    {
        printk("MTU must be between %d and %d.\n", 64-14-4-vlan_bytes, 65392-14-4-vlan_bytes);
        return -EINVAL;
    }
    dev->mtu = new_mtu;
    if (priv->isRGMII)
    {
        /* Set the hardware to truncate packets larger than the MTU. The jabber
            register must be set to a multiple of 8 bytes, so round up */
        int interface = INTERFACE(priv->port);
        int index = INDEX(priv->port);
       
        cvmx_write_csr(CVMX_GMXX_RXX_JABBER(index, interface), (max_packet + 7) & ~7u);
    }
    if (OCTEON_IS_MODEL(OCTEON_CN50XX))
    {
        cvmx_pip_frm_len_chkx_t pip_frm;
        pip_frm.u64 = cvmx_read_csr(CVMX_PIP_FRM_LEN_CHKX(0));
        pip_frm.cn50xx.maxlen = max_packet;
        cvmx_write_csr(CVMX_PIP_FRM_LEN_CHKX(0), pip_frm.u64);
    }
    if (octeon_is_pass1() && (new_mtu>CVMX_FPA_PACKET_POOL_SIZE - CVMX_HELPER_FIRST_MBUFF_SKIP - 32))
        printk("Warning: Octeon Pass 1 has problems with chained buffers. You may lose buffers with jumbo frames\n");
    return 0;
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值