hv_netvsc: Clean up two unused variables
Subsystems (3)
Haiyang Zhang
maintainerPATCH 1/3 hv_netvsc: Clean up two unused variables
--- drivers/net/hyperv/hyperv_net.h | 1 - drivers/net/hyperv/netvsc.c | 1 - drivers/net/hyperv/rndis_filter.c | 2 -- 3 files changed, 0 insertions(+), 4 deletions(-)
drivers/net/hyperv/hyperv_net.h +0 -1
@@ -130,7 +130,6 @@ struct hv_netvsc_packet {u32 status;bool part_of_skb; -struct hv_device *device;bool is_data_pkt;bool xmit_more;/* from skb */ u16 vlan_tci;
drivers/net/hyperv/netvsc.c +0 -1
@@ -1011,7 +1011,6 @@ static void netvsc_receive(struct netvsc_device *net_device, } count = vmxferpage_packet->range_cnt; - netvsc_packet->device = device; netvsc_packet->channel = channel;/* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */
drivers/net/hyperv/rndis_filter.c +0 -2
@@ -47,8 +47,6 @@ struct rndis_request {/* Simplify allocation by having a netvsc packet inline */ struct hv_netvsc_packet pkt; -/* Set 2 pages for rndis requests crossing page boundary */ -struct hv_page_buffer buf[2 ];struct rndis_message request_msg;/*
Signature · 1 line
1.7.4.1
Haiyang Zhang
maintainerPATCH 2/3 hv_netvsc: Define a macro RNDIS_AND_PPI_SIZE
The sum of RNDIS msg and PPI struct sizes is used in multiple places, so we define a macro for them.
--- drivers/net/hyperv/hyperv_net.h | 6 ++++++ drivers/net/hyperv/netvsc_drv.c | 15 +++------------ 2 files changed, 9 insertions(+), 12 deletions(-)
drivers/net/hyperv/hyperv_net.h +6 -0
@@ -958,6 +958,10 @@ struct ndis_tcp_lso_info {#define NDIS_HASH_PPI_SIZE (sizeof(struct rndis_per_packet_info) + \ sizeof(u32)) +/* Total size of all PPI data */ +#define NDIS_ALL_PPI_SIZE (NDIS_VLAN_PPI_SIZE + NDIS_CSUM_PPI_SIZE + \ + NDIS_LSO_PPI_SIZE + NDIS_HASH_PPI_SIZE) +/* Format of Information buffer passed in a SetRequest for the OID */ /* OID_GEN_RNDIS_CONFIG_PARAMETER. */ struct rndis_config_parameter_info {
@@ -1170,6 +1174,8 @@ struct rndis_message {#define RNDIS_HEADER_SIZE (sizeof(struct rndis_message) - \ sizeof(union rndis_message_container)) +#define RNDIS_AND_PPI_SIZE (sizeof(struct rndis_message) + NDIS_ALL_PPI_SIZE) +#define NDIS_PACKET_TYPE_DIRECTED 0x00000001#define NDIS_PACKET_TYPE_MULTICAST 0x00000002#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
drivers/net/hyperv/netvsc_drv.c +3 -12
@@ -401,10 +401,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)return NETDEV_TX_OK ; } - pkt_sz =sizeof (struct hv_netvsc_packet ) + -sizeof (struct rndis_message ) + -NDIS_VLAN_PPI_SIZE +NDIS_CSUM_PPI_SIZE + -NDIS_LSO_PPI_SIZE +NDIS_HASH_PPI_SIZE ; + pkt_sz =sizeof (struct hv_netvsc_packet ) +RNDIS_AND_PPI_SIZE ;if (head_room < pkt_sz) { packet =kmalloc (pkt_sz,GFP_ATOMIC );
@@ -436,11 +433,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) packet->rndis_msg = (struct rndis_message *)((unsigned long )packet +sizeof (struct hv_netvsc_packet )); -memset (packet->rndis_msg,0 ,sizeof (struct rndis_message ) + -NDIS_VLAN_PPI_SIZE + -NDIS_CSUM_PPI_SIZE + -NDIS_LSO_PPI_SIZE + -NDIS_HASH_PPI_SIZE ); +memset (packet->rndis_msg,0 ,RNDIS_AND_PPI_SIZE );/* Set the completion routine */ packet->send_completion = netvsc_xmit_completion;
@@ -872,9 +865,7 @@ static int netvsc_probe(struct hv_device *dev,return -ENOMEM ; max_needed_headroom =sizeof (struct hv_netvsc_packet ) + -sizeof (struct rndis_message ) + -NDIS_VLAN_PPI_SIZE +NDIS_CSUM_PPI_SIZE + -NDIS_LSO_PPI_SIZE +NDIS_HASH_PPI_SIZE ; +RNDIS_AND_PPI_SIZE ;netif_carrier_off (net);
Signature · 1 line
1.7.4.1
Haiyang Zhang
maintainerPATCH 3/3 hv_netvsc: Fix the packet free when it is in skb headroom
In reply to Haiyang ZhangIn the two places changed, we now use netvsc_xmit_completion() which properly frees hv_netvsc_packet in or not in skb headroom.
--- drivers/net/hyperv/hyperv_net.h | 1 + drivers/net/hyperv/netvsc.c | 6 ++++-- drivers/net/hyperv/netvsc_drv.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-)
drivers/net/hyperv/hyperv_net.h +1 -0
@@ -188,6 +188,7 @@ int netvsc_send(struct hv_device *device, struct hv_netvsc_packet *packet);void netvsc_linkstatus_callback (struct hv_device *device_obj,struct rndis_message *resp); +void netvsc_xmit_completion (void *context);int netvsc_recv_callback (struct hv_device *device_obj,struct hv_netvsc_packet *packet,struct ndis_tcp_ip_checksum_info *csum_info);
drivers/net/hyperv/netvsc.c +4 -2
@@ -878,7 +878,9 @@ int netvsc_send(struct hv_device *device, packet->send_buf_index = section_index; packet->total_data_buflen += msd_len; -kfree (msdp->pkt); +if (msdp->pkt) +netvsc_xmit_completion (msdp->pkt); +if (packet->xmit_more) { msdp->pkt = packet; msdp->count++;
@@ -902,7 +904,7 @@ int netvsc_send(struct hv_device *device,if (m_ret !=0 ) {netvsc_free_send_slot (net_device, msd_send->send_buf_index); -kfree (msd_send); +netvsc_xmit_completion (msd_send); } }
drivers/net/hyperv/netvsc_drv.c +1 -1
@@ -229,7 +229,7 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb,return q_idx; } -static void netvsc_xmit_completion (void *context) +void netvsc_xmit_completion (void *context) {struct hv_netvsc_packet *packet = (struct hv_netvsc_packet *)context; struct sk_buff *skb = (struct sk_buff *)
Signature · 1 line
1.7.4.1
From: Haiyang Zhang <[email protected]>
Date: Mon, 6 Apr 2015 15:22:52 -0700
Quoted 2 lines
Signed-off-by Haiyang Zhang <[email protected]>Reviewed-by K. Y. Srinivasan <[email protected]>
Applied.
Re: [PATCH net-next,2/3] hv_netvsc: Define a macro RNDIS_AND_PPI_SIZE
In reply to Haiyang ZhangFrom: Haiyang Zhang <[email protected]>
Date: Mon, 6 Apr 2015 15:22:53 -0700
Quoted 5 lines
The sum of RNDIS msg and PPI struct sizes is used in multiple places, so we define a macro for them.
Signed-off-by Haiyang Zhang <[email protected]>Reviewed-by K. Y. Srinivasan <[email protected]>
Applied.
Re: [PATCH net-next,3/3] hv_netvsc: Fix the packet free when it is in skb headroom
In reply to Haiyang ZhangFrom: Haiyang Zhang <[email protected]>
Date: Mon, 6 Apr 2015 15:22:54 -0700
Quoted 5 lines
In the two places changed, we now use
netvsc_xmit_completion()which properly freeshv_netvsc_packetin or not in skb headroom.Signed-off-by Haiyang Zhang <[email protected]>Reviewed-by K. Y. Srinivasan <[email protected]>
Applied.