|
@@ -283,6 +283,42 @@ static void snpnet_poll ( struct net_device *netdev ) {
|
283
|
283
|
snpnet_check_link ( netdev );
|
284
|
284
|
}
|
285
|
285
|
|
|
286
|
+/**
|
|
287
|
+ * Set receive filters
|
|
288
|
+ *
|
|
289
|
+ * @v netdev Network device
|
|
290
|
+ * @ret rc Return status code
|
|
291
|
+ */
|
|
292
|
+static int snpnet_rx_filters ( struct net_device *netdev ) {
|
|
293
|
+ struct snp_nic *snp = netdev->priv;
|
|
294
|
+ UINT32 filters[] = {
|
|
295
|
+ snp->snp->Mode->ReceiveFilterMask,
|
|
296
|
+ ( EFI_SIMPLE_NETWORK_RECEIVE_UNICAST |
|
|
297
|
+ EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST |
|
|
298
|
+ EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST ),
|
|
299
|
+ ( EFI_SIMPLE_NETWORK_RECEIVE_UNICAST |
|
|
300
|
+ EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST ),
|
|
301
|
+ ( EFI_SIMPLE_NETWORK_RECEIVE_UNICAST ),
|
|
302
|
+ };
|
|
303
|
+ unsigned int i;
|
|
304
|
+ EFI_STATUS efirc;
|
|
305
|
+ int rc;
|
|
306
|
+
|
|
307
|
+ /* Try possible receive filters in turn */
|
|
308
|
+ for ( i = 0; i < ( sizeof ( filters ) / sizeof ( filters[0] ) ); i++ ) {
|
|
309
|
+ efirc = snp->snp->ReceiveFilters ( snp->snp, filters[i],
|
|
310
|
+ 0, TRUE, 0, NULL );
|
|
311
|
+ if ( efirc == 0 )
|
|
312
|
+ return 0;
|
|
313
|
+ rc = -EEFI ( efirc );
|
|
314
|
+ DBGC ( snp, "SNP %s could not set receive filters %#02x (have "
|
|
315
|
+ "%#02x): %s\n", netdev->name, filters[i],
|
|
316
|
+ snp->snp->Mode->ReceiveFilterSetting, strerror ( rc ) );
|
|
317
|
+ }
|
|
318
|
+
|
|
319
|
+ return rc;
|
|
320
|
+}
|
|
321
|
+
|
286
|
322
|
/**
|
287
|
323
|
* Open network device
|
288
|
324
|
*
|
|
@@ -292,7 +328,6 @@ static void snpnet_poll ( struct net_device *netdev ) {
|
292
|
328
|
static int snpnet_open ( struct net_device *netdev ) {
|
293
|
329
|
struct snp_nic *snp = netdev->priv;
|
294
|
330
|
EFI_MAC_ADDRESS *mac = ( ( void * ) netdev->ll_addr );
|
295
|
|
- UINT32 filters;
|
296
|
331
|
EFI_STATUS efirc;
|
297
|
332
|
int rc;
|
298
|
333
|
|
|
@@ -322,16 +357,7 @@ static int snpnet_open ( struct net_device *netdev ) {
|
322
|
357
|
}
|
323
|
358
|
|
324
|
359
|
/* Set receive filters */
|
325
|
|
- filters = ( EFI_SIMPLE_NETWORK_RECEIVE_UNICAST |
|
326
|
|
- EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST |
|
327
|
|
- EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST |
|
328
|
|
- EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS |
|
329
|
|
- EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST );
|
330
|
|
- if ( ( efirc = snp->snp->ReceiveFilters ( snp->snp, filters, 0, TRUE,
|
331
|
|
- 0, NULL ) ) != 0 ) {
|
332
|
|
- rc = -EEFI ( efirc );
|
333
|
|
- DBGC ( snp, "SNP %s could not set receive filters: %s\n",
|
334
|
|
- netdev->name, strerror ( rc ) );
|
|
360
|
+ if ( ( rc = snpnet_rx_filters ( netdev ) ) != 0 ) {
|
335
|
361
|
/* Ignore error */
|
336
|
362
|
}
|
337
|
363
|
|