Extract interrupt coalescing settings to a structure so that it could be reused in other data structures.
Unified · Split
| @@ -126,6 +126,11 @@ static const struct virtnet_stat_desc virtnet_rq_stats_desc[] = { · 125 unmodified lines | |||
| 126 | #define VIRTNET_SQ_STATS_LEN ARRAY_SIZE(virtnet_sq_stats_desc) | 126 | #define VIRTNET_SQ_STATS_LEN ARRAY_SIZE(virtnet_sq_stats_desc) |
| 127 | #define VIRTNET_RQ_STATS_LEN ARRAY_SIZE(virtnet_rq_stats_desc) | 127 | #define VIRTNET_RQ_STATS_LEN ARRAY_SIZE(virtnet_rq_stats_desc) |
| 128 | 128 | ||
| 129 | struct virtnet_interrupt_coalesce { | ||
| 130 | u32 max_packets; | ||
| 131 | u32 max_usecs; | ||
| 132 | }; | ||
| 133 | |||
| 129 | /* Internal representation of a send virtqueue */ | 134 | /* Internal representation of a send virtqueue */ |
| 130 | struct send_queue { | 135 | struct send_queue { |
| 131 | /* Virtqueue associated with this send _queue */ | 136 | /* Virtqueue associated with this send _queue */ |
| @@ -281,10 +286,8 @@ struct virtnet_info { · 149 unmodified lines | |||
| 281 | u32 speed; | 286 | u32 speed; |
| 282 | 287 | ||
| 283 | /* Interrupt coalescing settings */ | 288 | /* Interrupt coalescing settings */ |
| 284 | u32 tx_usecs; | 289 | struct virtnet_interrupt_coalesce intr_coal_tx; |
| 285 | u32 rx_usecs; | 290 | struct virtnet_interrupt_coalesce intr_coal_rx; |
| 286 | u32 tx_max_packets; | ||
| 287 | u32 rx_max_packets; | ||
| 288 | 291 | ||
| 289 | unsigned long guest_offloads; | 292 | unsigned long guest_offloads; |
| 290 | unsigned long guest_offloads_capable; | 293 | unsigned long guest_offloads_capable; |
| @@ -3056,8 +3059,8 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi, · 2765 unmodified lines | |||
| 3056 | return -EINVAL; | 3059 | return -EINVAL; |
| 3057 | 3060 | ||
| 3058 | /* Save parameters */ | 3061 | /* Save parameters */ |
| 3059 | vi->tx_usecs = ec->tx_coalesce_usecs; | 3062 | vi->intr_coal_tx.max_usecs = ec->tx_coalesce_usecs; |
| 3060 | vi->tx_max_packets = ec->tx_max_coalesced_frames; | 3063 | vi->intr_coal_tx.max_packets = ec->tx_max_coalesced_frames; |
| 3061 | 3064 | ||
| 3062 | vi->ctrl->coal_rx.rx_usecs = cpu_to_le32(ec->rx_coalesce_usecs); | 3065 | vi->ctrl->coal_rx.rx_usecs = cpu_to_le32(ec->rx_coalesce_usecs); |
| 3063 | vi->ctrl->coal_rx.rx_max_packets = cpu_to_le32(ec->rx_max_coalesced_frames); | 3066 | vi->ctrl->coal_rx.rx_max_packets = cpu_to_le32(ec->rx_max_coalesced_frames); |
| @@ -3069,8 +3072,8 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi, · 5 unmodified lines | |||
| 3069 | return -EINVAL; | 3072 | return -EINVAL; |
| 3070 | 3073 | ||
| 3071 | /* Save parameters */ | 3074 | /* Save parameters */ |
| 3072 | vi->rx_usecs = ec->rx_coalesce_usecs; | 3075 | vi->intr_coal_rx.max_usecs = ec->rx_coalesce_usecs; |
| 3073 | vi->rx_max_packets = ec->rx_max_coalesced_frames; | 3076 | vi->intr_coal_rx.max_packets = ec->rx_max_coalesced_frames; |
| 3074 | 3077 | ||
| 3075 | return 0; | 3078 | return 0; |
| 3076 | } | 3079 | } |
| @@ -3132,10 +3135,10 @@ static int virtnet_get_coalesce(struct net_device *dev, · 55 unmodified lines | |||
| 3132 | struct virtnet_info *vi = netdev_priv(dev); | 3135 | struct virtnet_info *vi = netdev_priv(dev); |
| 3133 | 3136 | ||
| 3134 | if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) { | 3137 | if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) { |
| 3135 | ec->rx_coalesce_usecs = vi->rx_usecs; | 3138 | ec->rx_coalesce_usecs = vi->intr_coal_rx.max_usecs; |
| 3136 | ec->tx_coalesce_usecs = vi->tx_usecs; | 3139 | ec->tx_coalesce_usecs = vi->intr_coal_tx.max_usecs; |
| 3137 | ec->tx_max_coalesced_frames = vi->tx_max_packets; | 3140 | ec->tx_max_coalesced_frames = vi->intr_coal_tx.max_packets; |
| 3138 | ec->rx_max_coalesced_frames = vi->rx_max_packets; | 3141 | ec->rx_max_coalesced_frames = vi->intr_coal_rx.max_packets; |
| 3139 | } else { | 3142 | } else { |
| 3140 | ec->rx_max_coalesced_frames = 1; | 3143 | ec->rx_max_coalesced_frames = 1; |
| 3141 | 3144 | ||
| @@ -4119,10 +4122,10 @@ static int virtnet_probe(struct virtio_device *vdev) · 977 unmodified lines | |||
| 4119 | } | 4122 | } |
| 4120 | 4123 | ||
| 4121 | if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) { | 4124 | if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) { |
| 4122 | vi->rx_usecs = 0; | 4125 | vi->intr_coal_rx.max_usecs = 0; |
| 4123 | vi->tx_usecs = 0; | 4126 | vi->intr_coal_tx.max_usecs = 0; |
| 4124 | vi->tx_max_packets = 0; | 4127 | vi->intr_coal_tx.max_packets = 0; |
| 4125 | vi->rx_max_packets = 0; | 4128 | vi->intr_coal_rx.max_packets = 0; |
| 4126 | } | 4129 | } |
| 4127 | 4130 | ||
| 4128 | if (virtio_has_feature(vdev, VIRTIO_NET_F_HASH_REPORT)) | 4131 | if (virtio_has_feature(vdev, VIRTIO_NET_F_HASH_REPORT)) |