diff options
| author | stephen hemminger <stephen@networkplumber.org> | 2013-12-09 19:17:40 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2013-12-10 22:28:06 -0500 |
| commit | d24bae32fa9b541eb87edf1b3439f590c3b2dda5 (patch) | |
| tree | d3c271422753a4d1c1e1430f18f8aa28b8d7908f | |
| parent | d73aa2867f33582314f098277421ded65f5745a9 (diff) | |
virtio_net: remove unused parameter to send_command
All the code passes NULL for the last sg list (in).
Simplify by just removing it.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/virtio_net.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 56c2229d28fd..d26f695ee64d 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -876,13 +876,12 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 876 | * never fail unless improperly formated. | 876 | * never fail unless improperly formated. |
| 877 | */ | 877 | */ |
| 878 | static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, | 878 | static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, |
| 879 | struct scatterlist *out, | 879 | struct scatterlist *out) |
| 880 | struct scatterlist *in) | ||
| 881 | { | 880 | { |
| 882 | struct scatterlist *sgs[4], hdr, stat; | 881 | struct scatterlist *sgs[4], hdr, stat; |
| 883 | struct virtio_net_ctrl_hdr ctrl; | 882 | struct virtio_net_ctrl_hdr ctrl; |
| 884 | virtio_net_ctrl_ack status = ~0; | 883 | virtio_net_ctrl_ack status = ~0; |
| 885 | unsigned out_num = 0, in_num = 0, tmp; | 884 | unsigned out_num = 0, tmp; |
| 886 | 885 | ||
| 887 | /* Caller should know better */ | 886 | /* Caller should know better */ |
| 888 | BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); | 887 | BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); |
| @@ -895,16 +894,13 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, | |||
| 895 | 894 | ||
| 896 | if (out) | 895 | if (out) |
| 897 | sgs[out_num++] = out; | 896 | sgs[out_num++] = out; |
| 898 | if (in) | ||
| 899 | sgs[out_num + in_num++] = in; | ||
| 900 | 897 | ||
| 901 | /* Add return status. */ | 898 | /* Add return status. */ |
| 902 | sg_init_one(&stat, &status, sizeof(status)); | 899 | sg_init_one(&stat, &status, sizeof(status)); |
| 903 | sgs[out_num + in_num++] = &stat; | 900 | sgs[out_num] = &stat; |
| 904 | 901 | ||
| 905 | BUG_ON(out_num + in_num > ARRAY_SIZE(sgs)); | 902 | BUG_ON(out_num + 1 > ARRAY_SIZE(sgs)); |
| 906 | BUG_ON(virtqueue_add_sgs(vi->cvq, sgs, out_num, in_num, vi, GFP_ATOMIC) | 903 | BUG_ON(virtqueue_add_sgs(vi->cvq, sgs, out_num, 1, vi, GFP_ATOMIC) < 0); |
| 907 | < 0); | ||
| 908 | 904 | ||
| 909 | if (unlikely(!virtqueue_kick(vi->cvq))) | 905 | if (unlikely(!virtqueue_kick(vi->cvq))) |
| 910 | return status == VIRTIO_NET_OK; | 906 | return status == VIRTIO_NET_OK; |
| @@ -934,8 +930,7 @@ static int virtnet_set_mac_address(struct net_device *dev, void *p) | |||
| 934 | if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR)) { | 930 | if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR)) { |
| 935 | sg_init_one(&sg, addr->sa_data, dev->addr_len); | 931 | sg_init_one(&sg, addr->sa_data, dev->addr_len); |
| 936 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC, | 932 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC, |
| 937 | VIRTIO_NET_CTRL_MAC_ADDR_SET, | 933 | VIRTIO_NET_CTRL_MAC_ADDR_SET, &sg)) { |
| 938 | &sg, NULL)) { | ||
| 939 | dev_warn(&vdev->dev, | 934 | dev_warn(&vdev->dev, |
| 940 | "Failed to set mac address by vq command.\n"); | 935 | "Failed to set mac address by vq command.\n"); |
| 941 | return -EINVAL; | 936 | return -EINVAL; |
| @@ -1008,7 +1003,7 @@ static void virtnet_ack_link_announce(struct virtnet_info *vi) | |||
| 1008 | { | 1003 | { |
| 1009 | rtnl_lock(); | 1004 | rtnl_lock(); |
| 1010 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_ANNOUNCE, | 1005 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_ANNOUNCE, |
| 1011 | VIRTIO_NET_CTRL_ANNOUNCE_ACK, NULL, NULL)) | 1006 | VIRTIO_NET_CTRL_ANNOUNCE_ACK, NULL)) |
| 1012 | dev_warn(&vi->dev->dev, "Failed to ack link announce.\n"); | 1007 | dev_warn(&vi->dev->dev, "Failed to ack link announce.\n"); |
| 1013 | rtnl_unlock(); | 1008 | rtnl_unlock(); |
| 1014 | } | 1009 | } |
| @@ -1026,7 +1021,7 @@ static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs) | |||
| 1026 | sg_init_one(&sg, &s, sizeof(s)); | 1021 | sg_init_one(&sg, &s, sizeof(s)); |
| 1027 | 1022 | ||
| 1028 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MQ, | 1023 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MQ, |
| 1029 | VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET, &sg, NULL)) { | 1024 | VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET, &sg)) { |
| 1030 | dev_warn(&dev->dev, "Fail to set num of queue pairs to %d\n", | 1025 | dev_warn(&dev->dev, "Fail to set num of queue pairs to %d\n", |
| 1031 | queue_pairs); | 1026 | queue_pairs); |
| 1032 | return -EINVAL; | 1027 | return -EINVAL; |
| @@ -1076,16 +1071,14 @@ static void virtnet_set_rx_mode(struct net_device *dev) | |||
| 1076 | sg_init_one(sg, &promisc, sizeof(promisc)); | 1071 | sg_init_one(sg, &promisc, sizeof(promisc)); |
| 1077 | 1072 | ||
| 1078 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, | 1073 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, |
| 1079 | VIRTIO_NET_CTRL_RX_PROMISC, | 1074 | VIRTIO_NET_CTRL_RX_PROMISC, sg)) |
| 1080 | sg, NULL)) | ||
| 1081 | dev_warn(&dev->dev, "Failed to %sable promisc mode.\n", | 1075 | dev_warn(&dev->dev, "Failed to %sable promisc mode.\n", |
| 1082 | promisc ? "en" : "dis"); | 1076 | promisc ? "en" : "dis"); |
| 1083 | 1077 | ||
| 1084 | sg_init_one(sg, &allmulti, sizeof(allmulti)); | 1078 | sg_init_one(sg, &allmulti, sizeof(allmulti)); |
| 1085 | 1079 | ||
| 1086 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, | 1080 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX, |
| 1087 | VIRTIO_NET_CTRL_RX_ALLMULTI, | 1081 | VIRTIO_NET_CTRL_RX_ALLMULTI, sg)) |
| 1088 | sg, NULL)) | ||
| 1089 | dev_warn(&dev->dev, "Failed to %sable allmulti mode.\n", | 1082 | dev_warn(&dev->dev, "Failed to %sable allmulti mode.\n", |
| 1090 | allmulti ? "en" : "dis"); | 1083 | allmulti ? "en" : "dis"); |
| 1091 | 1084 | ||
| @@ -1121,8 +1114,7 @@ static void virtnet_set_rx_mode(struct net_device *dev) | |||
| 1121 | sizeof(mac_data->entries) + (mc_count * ETH_ALEN)); | 1114 | sizeof(mac_data->entries) + (mc_count * ETH_ALEN)); |
| 1122 | 1115 | ||
| 1123 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC, | 1116 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC, |
| 1124 | VIRTIO_NET_CTRL_MAC_TABLE_SET, | 1117 | VIRTIO_NET_CTRL_MAC_TABLE_SET, sg)) |
| 1125 | sg, NULL)) | ||
| 1126 | dev_warn(&dev->dev, "Failed to set MAC filter table.\n"); | 1118 | dev_warn(&dev->dev, "Failed to set MAC filter table.\n"); |
| 1127 | 1119 | ||
| 1128 | kfree(buf); | 1120 | kfree(buf); |
| @@ -1137,7 +1129,7 @@ static int virtnet_vlan_rx_add_vid(struct net_device *dev, | |||
| 1137 | sg_init_one(&sg, &vid, sizeof(vid)); | 1129 | sg_init_one(&sg, &vid, sizeof(vid)); |
| 1138 | 1130 | ||
| 1139 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, | 1131 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, |
| 1140 | VIRTIO_NET_CTRL_VLAN_ADD, &sg, NULL)) | 1132 | VIRTIO_NET_CTRL_VLAN_ADD, &sg)) |
| 1141 | dev_warn(&dev->dev, "Failed to add VLAN ID %d.\n", vid); | 1133 | dev_warn(&dev->dev, "Failed to add VLAN ID %d.\n", vid); |
| 1142 | return 0; | 1134 | return 0; |
| 1143 | } | 1135 | } |
| @@ -1151,7 +1143,7 @@ static int virtnet_vlan_rx_kill_vid(struct net_device *dev, | |||
| 1151 | sg_init_one(&sg, &vid, sizeof(vid)); | 1143 | sg_init_one(&sg, &vid, sizeof(vid)); |
| 1152 | 1144 | ||
| 1153 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, | 1145 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, |
| 1154 | VIRTIO_NET_CTRL_VLAN_DEL, &sg, NULL)) | 1146 | VIRTIO_NET_CTRL_VLAN_DEL, &sg)) |
| 1155 | dev_warn(&dev->dev, "Failed to kill VLAN ID %d.\n", vid); | 1147 | dev_warn(&dev->dev, "Failed to kill VLAN ID %d.\n", vid); |
| 1156 | return 0; | 1148 | return 0; |
| 1157 | } | 1149 | } |
