|
@@ -120,7 +120,10 @@ struct ipoib_peer {
|
120
|
120
|
static struct ipoib_peer ipoib_peer_cache[IPOIB_NUM_CACHED_PEERS];
|
121
|
121
|
|
122
|
122
|
/** Oldest IPoIB peer cache entry index */
|
123
|
|
-static unsigned int ipoib_peer_cache_idx = 1;
|
|
123
|
+static unsigned int ipoib_peer_cache_idx = 0;
|
|
124
|
+
|
|
125
|
+/** IPoIB peer cache entry validity flag */
|
|
126
|
+#define IPOIB_PEER_KEY_VALID 0x80
|
124
|
127
|
|
125
|
128
|
/**
|
126
|
129
|
* Look up cached peer by key
|
|
@@ -132,16 +135,17 @@ static struct ipoib_peer * ipoib_lookup_peer_by_key ( unsigned int key ) {
|
132
|
135
|
struct ipoib_peer *peer;
|
133
|
136
|
unsigned int i;
|
134
|
137
|
|
|
138
|
+ if ( ! key )
|
|
139
|
+ return NULL;
|
|
140
|
+
|
135
|
141
|
for ( i = 0 ; i < IPOIB_NUM_CACHED_PEERS ; i++ ) {
|
136
|
142
|
peer = &ipoib_peer_cache[i];
|
137
|
143
|
if ( peer->key == key )
|
138
|
144
|
return peer;
|
139
|
145
|
}
|
140
|
146
|
|
141
|
|
- if ( key != 0 ) {
|
142
|
|
- DBG ( "IPoIB warning: peer cache lost track of key %x while "
|
143
|
|
- "still in use\n", key );
|
144
|
|
- }
|
|
147
|
+ DBG ( "IPoIB warning: peer cache lost track of key %x while still in "
|
|
148
|
+ "use\n", key );
|
145
|
149
|
return NULL;
|
146
|
150
|
}
|
147
|
151
|
|
|
@@ -153,7 +157,7 @@ static struct ipoib_peer * ipoib_lookup_peer_by_key ( unsigned int key ) {
|
153
|
157
|
*/
|
154
|
158
|
static struct ipoib_peer * ipoib_cache_peer ( const struct ipoib_mac *mac ) {
|
155
|
159
|
struct ipoib_peer *peer;
|
156
|
|
- unsigned int key;
|
|
160
|
+ uint8_t key;
|
157
|
161
|
unsigned int i;
|
158
|
162
|
|
159
|
163
|
/* Look for existing cache entry */
|
|
@@ -164,7 +168,7 @@ static struct ipoib_peer * ipoib_cache_peer ( const struct ipoib_mac *mac ) {
|
164
|
168
|
}
|
165
|
169
|
|
166
|
170
|
/* No entry found: create a new one */
|
167
|
|
- key = ipoib_peer_cache_idx++;
|
|
171
|
+ key = ( ipoib_peer_cache_idx++ | IPOIB_PEER_KEY_VALID );
|
168
|
172
|
peer = &ipoib_peer_cache[ key % IPOIB_NUM_CACHED_PEERS ];
|
169
|
173
|
if ( peer->key )
|
170
|
174
|
DBG ( "IPoIB peer %x evicted from cache\n", peer->key );
|
|
@@ -257,7 +261,8 @@ static int ipoib_pull ( struct net_device *netdev,
|
257
|
261
|
*ll_dest = ( dest ? &dest->mac : &ipoib->broadcast );
|
258
|
262
|
*ll_source = ( source ? &source->mac : &ipoib->broadcast );
|
259
|
263
|
*net_proto = ipoib_hdr->proto;
|
260
|
|
- *flags = ( ( *ll_dest == &ipoib->broadcast ) ? LL_BROADCAST : 0 );
|
|
264
|
+ *flags = ( ( *ll_dest == &ipoib->broadcast ) ?
|
|
265
|
+ ( LL_MULTICAST | LL_BROADCAST ) : 0 );
|
261
|
266
|
|
262
|
267
|
return 0;
|
263
|
268
|
}
|