Browse Source

[aoe] Start retry timer before potential temporary transmission failure

The retry timer needs to be running as soon as we know that we are
trying to transmit a command.  If transmission fails because of a
temporary error condition, then the timer will allow us to retry the
transmission later.
tags/v0.9.6
Michael Brown 15 years ago
parent
commit
43aa69d7b3
1 changed files with 11 additions and 4 deletions
  1. 11
    4
      src/net/aoe.c

+ 11
- 4
src/net/aoe.c View File

94
 		return -ENETUNREACH;
94
 		return -ENETUNREACH;
95
 	}
95
 	}
96
 
96
 
97
+	/* If we are transmitting anything that requires a response,
98
+         * start the retransmission timer.  Do this before attempting
99
+         * to allocate the I/O buffer, in case allocation itself
100
+         * fails.
101
+         */
102
+	start_timer ( &aoe->timer );
103
+
97
 	/* Calculate count and data_out_len for this subcommand */
104
 	/* Calculate count and data_out_len for this subcommand */
98
 	count = command->cb.count.native;
105
 	count = command->cb.count.native;
99
 	if ( count > AOE_MAX_COUNT )
106
 	if ( count > AOE_MAX_COUNT )
101
 	data_out_len = ( command->data_out ? ( count * ATA_SECTOR_SIZE ) : 0 );
108
 	data_out_len = ( command->data_out ? ( count * ATA_SECTOR_SIZE ) : 0 );
102
 
109
 
103
 	/* Create outgoing I/O buffer */
110
 	/* Create outgoing I/O buffer */
104
-	iobuf = alloc_iob ( ETH_HLEN + sizeof ( *aoehdr ) + sizeof ( *aoecmd ) +
105
-			  data_out_len );
111
+	iobuf = alloc_iob ( ETH_HLEN + sizeof ( *aoehdr ) +
112
+			    sizeof ( *aoecmd ) + data_out_len );
106
 	if ( ! iobuf )
113
 	if ( ! iobuf )
107
 		return -ENOMEM;
114
 		return -ENOMEM;
108
 	iob_reserve ( iobuf, ETH_HLEN );
115
 	iob_reserve ( iobuf, ETH_HLEN );
133
 			 aoe->command_offset, data_out_len );
140
 			 aoe->command_offset, data_out_len );
134
 
141
 
135
 	/* Send packet */
142
 	/* Send packet */
136
-	start_timer ( &aoe->timer );
137
 	return net_tx ( iobuf, aoe->netdev, &aoe_protocol, aoe->target );
143
 	return net_tx ( iobuf, aoe->netdev, &aoe_protocol, aoe->target );
138
 }
144
 }
139
 
145
 
231
  * @ret rc		Return status code
237
  * @ret rc		Return status code
232
  *
238
  *
233
  */
239
  */
234
-static int aoe_rx ( struct io_buffer *iobuf, struct net_device *netdev __unused,
240
+static int aoe_rx ( struct io_buffer *iobuf,
241
+		    struct net_device *netdev __unused,
235
 		    const void *ll_source ) {
242
 		    const void *ll_source ) {
236
 	struct aoehdr *aoehdr = iobuf->data;
243
 	struct aoehdr *aoehdr = iobuf->data;
237
 	unsigned int len = iob_len ( iobuf );
244
 	unsigned int len = iob_len ( iobuf );

Loading…
Cancel
Save