BNX2X: spatch ether->mtu -> ether->maxmtu
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 10 Feb 2015 17:04:35 +0000 (12:04 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 2 Mar 2015 16:59:09 +0000 (11:59 -0500)
Yes, that's max max trans unit.  Compared to min-max-trans-unit (minmtu).

kern/drivers/net/bnx2x/bnx2x_cmn.c
kern/drivers/net/bnx2x/bnx2x_ethtool.c
kern/drivers/net/bnx2x/bnx2x_main.c
kern/drivers/net/bnx2x/bnx2x_vfpf.c
scripts/spatch/linux/scalar.cocci

index 309408c..1d1c65f 100644 (file)
@@ -1007,7 +1007,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
                /* Since we don't have a jumbo ring
                 * copy small packets if mtu > 1500
                 */
                /* Since we don't have a jumbo ring
                 * copy small packets if mtu > 1500
                 */
-               if ((bp->dev->mtu > ETH_MAX_PACKET_SIZE) &&
+               if ((bp->dev->maxmtu > ETH_MAX_PACKET_SIZE) &&
                    (len <= RX_COPY_THRESH)) {
                        skb = napi_alloc_skb(&fp->napi, len);
                        if (skb == NULL) {
                    (len <= RX_COPY_THRESH)) {
                        skb = napi_alloc_skb(&fp->napi, len);
                        if (skb == NULL) {
@@ -1388,7 +1388,7 @@ void bnx2x_init_rx_rings(struct bnx2x *bp)
                struct bnx2x_fastpath *fp = &bp->fp[j];
 
                DP(NETIF_MSG_IFUP,
                struct bnx2x_fastpath *fp = &bp->fp[j];
 
                DP(NETIF_MSG_IFUP,
-                  "mtu %d  rx_buf_size %d\n", bp->dev->mtu, fp->rx_buf_size);
+                  "mtu %d  rx_buf_size %d\n", bp->dev->maxmtu, fp->rx_buf_size);
 
                if (!fp->disable_tpa) {
                        /* Fill the per-aggregation pool */
 
                if (!fp->disable_tpa) {
                        /* Fill the per-aggregation pool */
@@ -2013,7 +2013,7 @@ static void bnx2x_set_rx_buf_size(struct bnx2x *bp)
                         */
                        mtu = BNX2X_FCOE_MINI_JUMBO_MTU;
                else
                         */
                        mtu = BNX2X_FCOE_MINI_JUMBO_MTU;
                else
-                       mtu = bp->dev->mtu;
+                       mtu = bp->dev->maxmtu;
                fp->rx_buf_size = BNX2X_FW_RX_ALIGN_START +
                                  IP_HEADER_ALIGNMENT_PADDING +
                                  ETH_OVREHEAD +
                fp->rx_buf_size = BNX2X_FW_RX_ALIGN_START +
                                  IP_HEADER_ALIGNMENT_PADDING +
                                  ETH_OVREHEAD +
@@ -2475,7 +2475,7 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index)
         */
        fp->disable_tpa = !(bp->flags & TPA_ENABLE_FLAG ||
                                  (bp->flags & GRO_ENABLE_FLAG &&
         */
        fp->disable_tpa = !(bp->flags & TPA_ENABLE_FLAG ||
                                  (bp->flags & GRO_ENABLE_FLAG &&
-                                  bnx2x_mtu_allows_gro(bp->dev->mtu)));
+                                  bnx2x_mtu_allows_gro(bp->dev->maxmtu)));
        if (bp->flags & TPA_ENABLE_FLAG)
                fp->mode = TPA_MODE_LRO;
        else if (bp->flags & GRO_ENABLE_FLAG)
        if (bp->flags & TPA_ENABLE_FLAG)
                fp->mode = TPA_MODE_LRO;
        else if (bp->flags & GRO_ENABLE_FLAG)
@@ -4797,7 +4797,7 @@ int bnx2x_change_mtu(struct ether *dev, int new_mtu)
         * because the actual alloc size is
         * only updated as part of load
         */
         * because the actual alloc size is
         * only updated as part of load
         */
-       dev->mtu = new_mtu;
+       dev->maxmtu = new_mtu;
 
        return bnx2x_reload_if_running(dev);
 }
 
        return bnx2x_reload_if_running(dev);
 }
index 78f6903..062025c 100644 (file)
@@ -2440,8 +2440,8 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode)
        }
 
        /* prepare the loopback packet */
        }
 
        /* prepare the loopback packet */
-       pkt_size = (((bp->dev->mtu < ETH_MAX_PACKET_SIZE) ?
-                    bp->dev->mtu : ETH_MAX_PACKET_SIZE) + ETHERHDRSIZE);
+       pkt_size = (((bp->dev->maxmtu < ETH_MAX_PACKET_SIZE) ?
+                    bp->dev->maxmtu : ETH_MAX_PACKET_SIZE) + ETHERHDRSIZE);
        skb = netdev_alloc_skb(bp->dev, fp_rx->rx_buf_size);
        if (!skb) {
                DP(BNX2X_MSG_ETHTOOL, "Can't allocate skb\n");
        skb = netdev_alloc_skb(bp->dev, fp_rx->rx_buf_size);
        if (!skb) {
                DP(BNX2X_MSG_ETHTOOL, "Can't allocate skb\n");
index a0e0e93..b82b545 100644 (file)
@@ -2280,7 +2280,7 @@ static void bnx2x_set_requested_fc(struct bnx2x *bp)
         * It is recommended to turn off RX FC for jumbo frames
         *  for better performance
         */
         * It is recommended to turn off RX FC for jumbo frames
         *  for better performance
         */
-       if (CHIP_IS_E1x(bp) && (bp->dev->mtu > 5000))
+       if (CHIP_IS_E1x(bp) && (bp->dev->maxmtu > 5000))
                bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_TX;
        else
                bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_BOTH;
                bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_TX;
        else
                bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_BOTH;
@@ -3128,7 +3128,7 @@ static void bnx2x_pf_q_prep_general(struct bnx2x *bp,
        if (IS_FCOE_FP(fp))
                gen_init->mtu = BNX2X_FCOE_MINI_JUMBO_MTU;
        else
        if (IS_FCOE_FP(fp))
                gen_init->mtu = BNX2X_FCOE_MINI_JUMBO_MTU;
        else
-               gen_init->mtu = bp->dev->mtu;
+               gen_init->mtu = bp->dev->maxmtu;
 
        gen_init->cos = cos;
 
 
        gen_init->cos = cos;
 
@@ -3153,7 +3153,7 @@ static void bnx2x_pf_rx_q_prep(struct bnx2x *bp,
                                MAX_RX_SGE_CNT * NUM_RX_SGE_PAGES);
 
                tpa_agg_size = TPA_AGG_SIZE;
                                MAX_RX_SGE_CNT * NUM_RX_SGE_PAGES);
 
                tpa_agg_size = TPA_AGG_SIZE;
-               max_sge = SGE_PAGE_ALIGN(bp->dev->mtu) >>
+               max_sge = SGE_PAGE_ALIGN(bp->dev->maxmtu) >>
                        SGE_PAGE_SHIFT;
                max_sge = ((max_sge + PAGES_PER_SGE - 1) &
                          (~(PAGES_PER_SGE-1))) >> PAGES_PER_SGE_SHIFT;
                        SGE_PAGE_SHIFT;
                max_sge = ((max_sge + PAGES_PER_SGE - 1) &
                          (~(PAGES_PER_SGE-1))) >> PAGES_PER_SGE_SHIFT;
@@ -3358,7 +3358,7 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp)
                                DRV_INFO_ETH_STAT_NUM_MACS_REQUIRED,
                                ether_stat->mac_local + MAC_PAD, MAC_PAD,
                                Eaddrlen);
                                DRV_INFO_ETH_STAT_NUM_MACS_REQUIRED,
                                ether_stat->mac_local + MAC_PAD, MAC_PAD,
                                Eaddrlen);
-       ether_stat->mtu_size = bp->dev->mtu;
+       ether_stat->mtu_size = bp->dev->maxmtu;
        if (bp->dev->feat & NETIF_F_RXCSUM)
                ether_stat->feature_flags |= FEATURE_ETH_CHKSUM_OFFLOAD_MASK;
        if (bp->dev->feat & NETIF_F_TSO)
        if (bp->dev->feat & NETIF_F_RXCSUM)
                ether_stat->feature_flags |= FEATURE_ETH_CHKSUM_OFFLOAD_MASK;
        if (bp->dev->feat & NETIF_F_TSO)
@@ -7462,11 +7462,11 @@ static int bnx2x_init_hw_port(struct bnx2x *bp)
 
                if (IS_MF(bp))
                        low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246);
 
                if (IS_MF(bp))
                        low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246);
-               else if (bp->dev->mtu > 4096) {
+               else if (bp->dev->maxmtu > 4096) {
                        if (bp->flags & ONE_PORT_FLAG)
                                low = 160;
                        else {
                        if (bp->flags & ONE_PORT_FLAG)
                                low = 160;
                        else {
-                               val = bp->dev->mtu;
+                               val = bp->dev->maxmtu;
                                /* (24*1024 + val*4)/256 */
                                low = 96 + (val/64) +
                                                ((val % 64) ? 1 : 0);
                                /* (24*1024 + val*4)/256 */
                                low = 96 + (val/64) +
                                                ((val % 64) ? 1 : 0);
index 9b1f0cd..84e4dd8 100644 (file)
@@ -624,11 +624,11 @@ int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp,
        req->rxq.vf_sb = fp_idx;
        req->rxq.sb_index = HC_INDEX_ETH_RX_CQ_CONS;
        req->rxq.hc_rate = bp->rx_ticks ? 1000000/bp->rx_ticks : 0;
        req->rxq.vf_sb = fp_idx;
        req->rxq.sb_index = HC_INDEX_ETH_RX_CQ_CONS;
        req->rxq.hc_rate = bp->rx_ticks ? 1000000/bp->rx_ticks : 0;
-       req->rxq.mtu = bp->dev->mtu;
+       req->rxq.mtu = bp->dev->maxmtu;
        req->rxq.buf_sz = fp->rx_buf_size;
        req->rxq.sge_buf_sz = BCM_PAGE_SIZE * PAGES_PER_SGE;
        req->rxq.tpa_agg_sz = tpa_agg_size;
        req->rxq.buf_sz = fp->rx_buf_size;
        req->rxq.sge_buf_sz = BCM_PAGE_SIZE * PAGES_PER_SGE;
        req->rxq.tpa_agg_sz = tpa_agg_size;
-       req->rxq.max_sge_pkt = SGE_PAGE_ALIGN(bp->dev->mtu) >> SGE_PAGE_SHIFT;
+       req->rxq.max_sge_pkt = SGE_PAGE_ALIGN(bp->dev->maxmtu) >> SGE_PAGE_SHIFT;
        req->rxq.max_sge_pkt = ((req->rxq.max_sge_pkt + PAGES_PER_SGE - 1) &
                          (~(PAGES_PER_SGE-1))) >> PAGES_PER_SGE_SHIFT;
        req->rxq.flags = flags;
        req->rxq.max_sge_pkt = ((req->rxq.max_sge_pkt + PAGES_PER_SGE - 1) &
                          (~(PAGES_PER_SGE-1))) >> PAGES_PER_SGE_SHIFT;
        req->rxq.flags = flags;
index 0cbe57e..eb44d95 100644 (file)
@@ -105,3 +105,10 @@ struct ether *p;
 expression E;
 @@
 -p->hw_enc_features = E;
 expression E;
 @@
 -p->hw_enc_features = E;
+
+// yes, that's a max max trans unit...
+@@
+struct ether *p;
+@@
+-p->mtu
++p->maxmtu