| @@ -191,7 +191,6 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv, · 190 unmodified lines |
| 191 | 191 | ring->prod = 0; |
| 192 | 192 | ring->cons = 0xffffffff; |
| 193 | 193 | ring->last_nr_txbb = 1; |
| 194 | | − ring->poll_cnt = 0; |
| 195 | 194 | memset(ring->tx_info, 0, ring->size * sizeof(struct mlx4_en_tx_info)); |
| 196 | 195 | memset(ring->buf, 0, ring->buf_size); |
| 197 | 196 | |
| @@ -512,7 +511,8 @@ static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv, · 314 unmodified lines |
| 512 | 511 | return ring->buf + index * TXBB_SIZE; |
| 513 | 512 | } |
| 514 | 513 | |
| 515 | | −static int is_inline(int inline_thold, struct sk_buff *skb, void **pfrag) |
| 514 | +static bool is_inline(int inline_thold, const struct sk_buff *skb, |
| 515 | + void **pfrag) |
| 516 | 516 | { |
| 517 | 517 | void *ptr; |
| 518 | 518 | |
| @@ -535,7 +535,7 @@ static int is_inline(int inline_thold, struct sk_buff *skb, void **pfrag) · 16 unmodified lines |
| 535 | 535 | return 0; |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | | −static int inline_size(struct sk_buff *skb) |
| 538 | +static int inline_size(const struct sk_buff *skb) |
| 539 | 539 | { |
| 540 | 540 | if (skb->len + CTRL_SIZE + sizeof(struct mlx4_wqe_inline_seg) |
| 541 | 541 | <= MLX4_INLINE_ALIGN) |
| @@ -546,7 +546,8 @@ static int inline_size(struct sk_buff *skb) · 4 unmodified lines |
| 546 | 546 | sizeof(struct mlx4_wqe_inline_seg), 16); |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | | −static int get_real_size(struct sk_buff *skb, struct net_device *dev, |
| 549 | +static int get_real_size(const struct sk_buff *skb, |
| 550 | + struct net_device *dev, |
| 550 | 551 | int *lso_header_size) |
| 551 | 552 | { |
| 552 | 553 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| @@ -581,8 +582,10 @@ static int get_real_size(struct sk_buff *skb, struct net_device *dev, · 28 unmodified lines |
| 581 | 582 | return real_size; |
| 582 | 583 | } |
| 583 | 584 | |
| 584 | | −static void build_inline_wqe(struct mlx4_en_tx_desc *tx_desc, struct sk_buff *skb, |
| 585 | | − int real_size, u16 *vlan_tag, int tx_ind, void *fragptr) |
| 585 | +static void build_inline_wqe(struct mlx4_en_tx_desc *tx_desc, |
| 586 | + const struct sk_buff *skb, |
| 587 | + int real_size, u16 *vlan_tag, |
| 588 | + int tx_ind, void *fragptr) |
| 586 | 589 | { |
| 587 | 590 | struct mlx4_wqe_inline_seg *inl = &tx_desc->inl; |
| 588 | 591 | int spc = MLX4_INLINE_ALIGN - CTRL_SIZE - sizeof *inl; |
| @@ -642,7 +645,8 @@ u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb, · 53 unmodified lines |
| 642 | 645 | return fallback(dev, skb) % rings_p_up + up * rings_p_up; |
| 643 | 646 | } |
| 644 | 647 | |
| 645 | | −static void mlx4_bf_copy(void __iomem *dst, unsigned long *src, unsigned bytecnt) |
| 648 | +static void mlx4_bf_copy(void __iomem *dst, const void *src, |
| 649 | + unsigned int bytecnt) |
| 646 | 650 | { |
| 647 | 651 | __iowrite64_copy(dst, src, bytecnt / 8); |
| 648 | 652 | } |
| @@ -736,11 +740,10 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) · 87 unmodified lines |
| 736 | 740 | tx_info->skb = skb; |
| 737 | 741 | tx_info->nr_txbb = nr_txbb; |
| 738 | 742 | |
| 743 | + data = &tx_desc->data; |
| 739 | 744 | if (lso_header_size) |
| 740 | 745 | data = ((void *)&tx_desc->lso + ALIGN(lso_header_size + 4, |
| 741 | 746 | DS_SIZE)); |
| 742 | | − else |
| 743 | | − data = &tx_desc->data; |
| 744 | 747 | |
| 745 | 748 | /* valid only for none inline segments */ |
| 746 | 749 | tx_info->data_offset = (void *)data - (void *)tx_desc; |
| @@ -753,9 +756,9 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) · 6 unmodified lines |
| 753 | 756 | if (is_inline(ring->inline_thold, skb, &fragptr)) { |
| 754 | 757 | tx_info->inl = 1; |
| 755 | 758 | } else { |
| 756 | | − /* Map fragments */ |
| 759 | + /* Map fragments if any */ |
| 757 | 760 | for (i = skb_shinfo(skb)->nr_frags - 1; i >= 0; i--) { |
| 758 | | − struct skb_frag_struct *frag; |
| 761 | + const struct skb_frag_struct *frag; |
| 759 | 762 | dma_addr_t dma; |
| 760 | 763 | |
| 761 | 764 | frag = &skb_shinfo(skb)->frags[i]; |
| @@ -772,7 +775,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) · 10 unmodified lines |
| 772 | 775 | --data; |
| 773 | 776 | } |
| 774 | 777 | |
| 775 | | − /* Map linear part */ |
| 778 | + /* Map linear part if needed */ |
| 776 | 779 | if (tx_info->linear) { |
| 777 | 780 | u32 byte_count = skb_headlen(skb) - lso_header_size; |
| 778 | 781 | dma_addr_t dma; |
| @@ -795,18 +798,14 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) · 16 unmodified lines |
| 795 | 798 | * For timestamping add flag to skb_shinfo and |
| 796 | 799 | * set flag for further reference |
| 797 | 800 | */ |
| 798 | | − if (ring->hwtstamp_tx_type == HWTSTAMP_TX_ON && |
| 799 | | − skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { |
| 800 | | − skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; |
| 801 | + if (unlikely(ring->hwtstamp_tx_type == HWTSTAMP_TX_ON && |
| 802 | + shinfo->tx_flags & SKBTX_HW_TSTAMP)) { |
| 803 | + shinfo->tx_flags |= SKBTX_IN_PROGRESS; |
| 801 | 804 | tx_info->ts_requested = 1; |
| 802 | 805 | } |
| 803 | 806 | |
| 804 | 807 | /* Prepare ctrl segement apart opcode+ownership, which depends on |
| 805 | 808 | * whether LSO is used */ |
| 806 | | − tx_desc->ctrl.vlan_tag = cpu_to_be16(vlan_tag); |
| 807 | | − tx_desc->ctrl.ins_vlan = MLX4_WQE_CTRL_INS_VLAN * |
| 808 | | − !!vlan_tx_tag_present(skb); |
| 809 | | − tx_desc->ctrl.fence_size = (real_size / 16) & 0x3f; |
| 810 | 809 | tx_desc->ctrl.srcrb_flags = priv->ctrl_flags; |
| 811 | 810 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
| 812 | 811 | tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM | |
| @@ -852,7 +851,6 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) · 39 unmodified lines |
| 852 | 851 | cpu_to_be32(MLX4_EN_BIT_DESC_OWN) : 0); |
| 853 | 852 | tx_info->nr_bytes = max_t(unsigned int, skb->len, ETH_ZLEN); |
| 854 | 853 | ring->packets++; |
| 855 | | − |
| 856 | 854 | } |
| 857 | 855 | ring->bytes += tx_info->nr_bytes; |
| 858 | 856 | netdev_tx_sent_queue(ring->tx_queue, tx_info->nr_bytes); |
| @@ -874,7 +872,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) · 15 unmodified lines |
| 874 | 872 | ring->prod += nr_txbb; |
| 875 | 873 | |
| 876 | 874 | /* If we used a bounce buffer then copy descriptor back into place */ |
| 877 | | − if (bounce) |
| 875 | + if (unlikely(bounce)) |
| 878 | 876 | tx_desc = mlx4_en_bounce_to_desc(priv, ring, index, desc_size); |
| 879 | 877 | |
| 880 | 878 | skb_tx_timestamp(skb); |
| @@ -894,13 +892,18 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) · 13 unmodified lines |
| 894 | 892 | |
| 895 | 893 | wmb(); |
| 896 | 894 | |
| 897 | | − mlx4_bf_copy(ring->bf.reg + ring->bf.offset, (unsigned long *) &tx_desc->ctrl, |
| 898 | | − desc_size); |
| 895 | + mlx4_bf_copy(ring->bf.reg + ring->bf.offset, &tx_desc->ctrl, |
| 896 | + desc_size); |
| 899 | 897 | |
| 900 | 898 | wmb(); |
| 901 | 899 | |
| 902 | 900 | ring->bf.offset ^= ring->bf.buf_size; |
| 903 | 901 | } else { |
| 902 | + tx_desc->ctrl.vlan_tag = cpu_to_be16(vlan_tag); |
| 903 | + tx_desc->ctrl.ins_vlan = MLX4_WQE_CTRL_INS_VLAN * |
| 904 | + !!vlan_tx_tag_present(skb); |
| 905 | + tx_desc->ctrl.fence_size = real_size; |
| 906 | + |
| 904 | 907 | /* Ensure new descriptor hits memory |
| 905 | 908 | * before setting ownership of this descriptor to HW |
| 906 | 909 | */ |