|
@@ -25,6 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
25
|
25
|
#include <assert.h>
|
26
|
26
|
#include <byteswap.h>
|
27
|
27
|
#include <ipxe/netdevice.h>
|
|
28
|
+#include <ipxe/vlan.h>
|
28
|
29
|
#include <ipxe/iobuf.h>
|
29
|
30
|
#include <ipxe/in.h>
|
30
|
31
|
#include <ipxe/version.h>
|
|
@@ -1545,8 +1546,10 @@ static int efi_snp_probe ( struct net_device *netdev ) {
|
1545
|
1546
|
struct efi_snp_device *snpdev;
|
1546
|
1547
|
EFI_DEVICE_PATH_PROTOCOL *path_end;
|
1547
|
1548
|
MAC_ADDR_DEVICE_PATH *macpath;
|
|
1549
|
+ VLAN_DEVICE_PATH *vlanpath;
|
1548
|
1550
|
size_t path_prefix_len = 0;
|
1549
|
1551
|
unsigned int ifcnt;
|
|
1552
|
+ unsigned int tag;
|
1550
|
1553
|
void *interface;
|
1551
|
1554
|
EFI_STATUS efirc;
|
1552
|
1555
|
int rc;
|
|
@@ -1634,7 +1637,7 @@ static int efi_snp_probe ( struct net_device *netdev ) {
|
1634
|
1637
|
/* Allocate the new device path */
|
1635
|
1638
|
path_prefix_len = efi_devpath_len ( efidev->path );
|
1636
|
1639
|
snpdev->path = zalloc ( path_prefix_len + sizeof ( *macpath ) +
|
1637
|
|
- sizeof ( *path_end ) );
|
|
1640
|
+ sizeof ( *vlanpath ) + sizeof ( *path_end ) );
|
1638
|
1641
|
if ( ! snpdev->path ) {
|
1639
|
1642
|
rc = -ENOMEM;
|
1640
|
1643
|
goto err_alloc_device_path;
|
|
@@ -1643,7 +1646,6 @@ static int efi_snp_probe ( struct net_device *netdev ) {
|
1643
|
1646
|
/* Populate the device path */
|
1644
|
1647
|
memcpy ( snpdev->path, efidev->path, path_prefix_len );
|
1645
|
1648
|
macpath = ( ( ( void * ) snpdev->path ) + path_prefix_len );
|
1646
|
|
- path_end = ( ( void * ) ( macpath + 1 ) );
|
1647
|
1649
|
memset ( macpath, 0, sizeof ( *macpath ) );
|
1648
|
1650
|
macpath->Header.Type = MESSAGING_DEVICE_PATH;
|
1649
|
1651
|
macpath->Header.SubType = MSG_MAC_ADDR_DP;
|
|
@@ -1651,6 +1653,17 @@ static int efi_snp_probe ( struct net_device *netdev ) {
|
1651
|
1653
|
memcpy ( &macpath->MacAddress, netdev->ll_addr,
|
1652
|
1654
|
sizeof ( macpath->MacAddress ) );
|
1653
|
1655
|
macpath->IfType = ntohs ( netdev->ll_protocol->ll_proto );
|
|
1656
|
+ if ( ( tag = vlan_tag ( netdev ) ) ) {
|
|
1657
|
+ vlanpath = ( ( ( void * ) macpath ) + sizeof ( *macpath ) );
|
|
1658
|
+ memset ( vlanpath, 0, sizeof ( *vlanpath ) );
|
|
1659
|
+ vlanpath->Header.Type = MESSAGING_DEVICE_PATH;
|
|
1660
|
+ vlanpath->Header.SubType = MSG_VLAN_DP;
|
|
1661
|
+ vlanpath->Header.Length[0] = sizeof ( *vlanpath );
|
|
1662
|
+ vlanpath->VlanId = tag;
|
|
1663
|
+ path_end = ( ( ( void * ) vlanpath ) + sizeof ( *vlanpath ) );
|
|
1664
|
+ } else {
|
|
1665
|
+ path_end = ( ( ( void * ) macpath ) + sizeof ( *macpath ) );
|
|
1666
|
+ }
|
1654
|
1667
|
memset ( path_end, 0, sizeof ( *path_end ) );
|
1655
|
1668
|
path_end->Type = END_DEVICE_PATH_TYPE;
|
1656
|
1669
|
path_end->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;
|