netvsc: remove unnecessary indirection of page_buffer

The internal API was passing struct hv_page_buffer **
when only simple struct hv_page_buffer * was necessary
for passing an array.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
stephen hemminger 2017-07-28 08:59:44 -07:00 committed by David S. Miller
parent 4a2176c63b
commit 02b6de01af
4 changed files with 17 additions and 20 deletions

View File

@ -190,7 +190,7 @@ void netvsc_device_remove(struct hv_device *device);
int netvsc_send(struct net_device_context *ndc, int netvsc_send(struct net_device_context *ndc,
struct hv_netvsc_packet *packet, struct hv_netvsc_packet *packet,
struct rndis_message *rndis_msg, struct rndis_message *rndis_msg,
struct hv_page_buffer **page_buffer, struct hv_page_buffer *page_buffer,
struct sk_buff *skb); struct sk_buff *skb);
void netvsc_linkstatus_callback(struct hv_device *device_obj, void netvsc_linkstatus_callback(struct hv_device *device_obj,
struct rndis_message *resp); struct rndis_message *resp);

View File

@ -697,7 +697,7 @@ static u32 netvsc_copy_to_send_buf(struct netvsc_device *net_device,
u32 pend_size, u32 pend_size,
struct hv_netvsc_packet *packet, struct hv_netvsc_packet *packet,
struct rndis_message *rndis_msg, struct rndis_message *rndis_msg,
struct hv_page_buffer **pb, struct hv_page_buffer *pb,
struct sk_buff *skb) struct sk_buff *skb)
{ {
char *start = net_device->send_buf; char *start = net_device->send_buf;
@ -718,9 +718,9 @@ static u32 netvsc_copy_to_send_buf(struct netvsc_device *net_device,
} }
for (i = 0; i < page_count; i++) { for (i = 0; i < page_count; i++) {
char *src = phys_to_virt((*pb)[i].pfn << PAGE_SHIFT); char *src = phys_to_virt(pb[i].pfn << PAGE_SHIFT);
u32 offset = (*pb)[i].offset; u32 offset = pb[i].offset;
u32 len = (*pb)[i].len; u32 len = pb[i].len;
memcpy(dest, (src + offset), len); memcpy(dest, (src + offset), len);
msg_size += len; msg_size += len;
@ -739,7 +739,7 @@ static inline int netvsc_send_pkt(
struct hv_device *device, struct hv_device *device,
struct hv_netvsc_packet *packet, struct hv_netvsc_packet *packet,
struct netvsc_device *net_device, struct netvsc_device *net_device,
struct hv_page_buffer **pb, struct hv_page_buffer *pb,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct nvsp_message nvmsg; struct nvsp_message nvmsg;
@ -750,7 +750,6 @@ static inline int netvsc_send_pkt(
struct netdev_queue *txq = netdev_get_tx_queue(ndev, packet->q_idx); struct netdev_queue *txq = netdev_get_tx_queue(ndev, packet->q_idx);
u64 req_id; u64 req_id;
int ret; int ret;
struct hv_page_buffer *pgbuf;
u32 ring_avail = hv_ringbuf_avail_percent(&out_channel->outbound); u32 ring_avail = hv_ringbuf_avail_percent(&out_channel->outbound);
nvmsg.hdr.msg_type = NVSP_MSG1_TYPE_SEND_RNDIS_PKT; nvmsg.hdr.msg_type = NVSP_MSG1_TYPE_SEND_RNDIS_PKT;
@ -776,11 +775,11 @@ static inline int netvsc_send_pkt(
return -ENODEV; return -ENODEV;
if (packet->page_buf_cnt) { if (packet->page_buf_cnt) {
pgbuf = packet->cp_partial ? (*pb) + if (packet->cp_partial)
packet->rmsg_pgcnt : (*pb); pb += packet->rmsg_pgcnt;
ret = vmbus_sendpacket_pagebuffer_ctl(out_channel, ret = vmbus_sendpacket_pagebuffer_ctl(out_channel,
pgbuf, pb, packet->page_buf_cnt,
packet->page_buf_cnt,
&nvmsg, &nvmsg,
sizeof(struct nvsp_message), sizeof(struct nvsp_message),
req_id, req_id,
@ -830,7 +829,7 @@ static inline void move_pkt_msd(struct hv_netvsc_packet **msd_send,
int netvsc_send(struct net_device_context *ndev_ctx, int netvsc_send(struct net_device_context *ndev_ctx,
struct hv_netvsc_packet *packet, struct hv_netvsc_packet *packet,
struct rndis_message *rndis_msg, struct rndis_message *rndis_msg,
struct hv_page_buffer **pb, struct hv_page_buffer *pb,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct netvsc_device *net_device struct netvsc_device *net_device

View File

@ -282,9 +282,8 @@ static u32 fill_pg_buf(struct page *page, u32 offset, u32 len,
static u32 init_page_array(void *hdr, u32 len, struct sk_buff *skb, static u32 init_page_array(void *hdr, u32 len, struct sk_buff *skb,
struct hv_netvsc_packet *packet, struct hv_netvsc_packet *packet,
struct hv_page_buffer **page_buf) struct hv_page_buffer *pb)
{ {
struct hv_page_buffer *pb = *page_buf;
u32 slots_used = 0; u32 slots_used = 0;
char *data = skb->data; char *data = skb->data;
int frags = skb_shinfo(skb)->nr_frags; int frags = skb_shinfo(skb)->nr_frags;
@ -359,8 +358,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
u32 rndis_msg_size; u32 rndis_msg_size;
struct rndis_per_packet_info *ppi; struct rndis_per_packet_info *ppi;
u32 hash; u32 hash;
struct hv_page_buffer page_buf[MAX_PAGE_BUFFER_COUNT]; struct hv_page_buffer pb[MAX_PAGE_BUFFER_COUNT];
struct hv_page_buffer *pb = page_buf;
/* We can only transmit MAX_PAGE_BUFFER_COUNT number /* We can only transmit MAX_PAGE_BUFFER_COUNT number
* of pages in a single packet. If skb is scattered around * of pages in a single packet. If skb is scattered around
@ -503,12 +501,12 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
rndis_msg->msg_len += rndis_msg_size; rndis_msg->msg_len += rndis_msg_size;
packet->total_data_buflen = rndis_msg->msg_len; packet->total_data_buflen = rndis_msg->msg_len;
packet->page_buf_cnt = init_page_array(rndis_msg, rndis_msg_size, packet->page_buf_cnt = init_page_array(rndis_msg, rndis_msg_size,
skb, packet, &pb); skb, packet, pb);
/* timestamp packet in software */ /* timestamp packet in software */
skb_tx_timestamp(skb); skb_tx_timestamp(skb);
ret = netvsc_send(net_device_ctx, packet, rndis_msg, &pb, skb); ret = netvsc_send(net_device_ctx, packet, rndis_msg, pb, skb);
if (likely(ret == 0)) if (likely(ret == 0))
return NETDEV_TX_OK; return NETDEV_TX_OK;

View File

@ -214,11 +214,11 @@ static void dump_rndis_message(struct hv_device *hv_dev,
static int rndis_filter_send_request(struct rndis_device *dev, static int rndis_filter_send_request(struct rndis_device *dev,
struct rndis_request *req) struct rndis_request *req)
{ {
int ret;
struct hv_netvsc_packet *packet; struct hv_netvsc_packet *packet;
struct hv_page_buffer page_buf[2]; struct hv_page_buffer page_buf[2];
struct hv_page_buffer *pb = page_buf; struct hv_page_buffer *pb = page_buf;
struct net_device_context *net_device_ctx = netdev_priv(dev->ndev); struct net_device_context *net_device_ctx = netdev_priv(dev->ndev);
int ret;
/* Setup the packet to send it */ /* Setup the packet to send it */
packet = &req->pkt; packet = &req->pkt;
@ -245,7 +245,7 @@ static int rndis_filter_send_request(struct rndis_device *dev,
} }
rcu_read_lock_bh(); rcu_read_lock_bh();
ret = netvsc_send(net_device_ctx, packet, NULL, &pb, NULL); ret = netvsc_send(net_device_ctx, packet, NULL, pb, NULL);
rcu_read_unlock_bh(); rcu_read_unlock_bh();
return ret; return ret;