| 
				
			 | 
			
			
				
				@@ -6,6 +6,7 @@ 
			 | 
		
		
	
		
			
			| 
				6
			 | 
			
				6
			 | 
			
			
				
				 #include <ipxe/iobuf.h> 
			 | 
		
		
	
		
			
			| 
				7
			 | 
			
				7
			 | 
			
			
				
				 #include <ipxe/tables.h> 
			 | 
		
		
	
		
			
			| 
				8
			 | 
			
				8
			 | 
			
			
				
				 #include <ipxe/ipstat.h> 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				9
			 | 
			
			
				
				+#include <ipxe/netdevice.h> 
			 | 
		
		
	
		
			
			| 
				9
			 | 
			
				10
			 | 
			
			
				
				 #include <ipxe/tcpip.h> 
			 | 
		
		
	
		
			
			| 
				10
			 | 
			
				11
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				11
			 | 
			
				12
			 | 
			
			
				
				 /** @file 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -122,6 +123,34 @@ struct net_device * tcpip_netdev ( struct sockaddr_tcpip *st_dest ) { 
			 | 
		
		
	
		
			
			| 
				122
			 | 
			
				123
			 | 
			
			
				
				 	return NULL; 
			 | 
		
		
	
		
			
			| 
				123
			 | 
			
				124
			 | 
			
			
				
				 } 
			 | 
		
		
	
		
			
			| 
				124
			 | 
			
				125
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				126
			 | 
			
			
				
				+/** 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				127
			 | 
			
			
				
				+ * Determine maximum transmission unit 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				128
			 | 
			
			
				
				+ * 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				129
			 | 
			
			
				
				+ * @v st_dest		Destination address 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				130
			 | 
			
			
				
				+ * @ret mtu		Maximum transmission unit 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				131
			 | 
			
			
				
				+ */ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				132
			 | 
			
			
				
				+size_t tcpip_mtu ( struct sockaddr_tcpip *st_dest ) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				133
			 | 
			
			
				
				+	struct tcpip_net_protocol *tcpip_net; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				134
			 | 
			
			
				
				+	struct net_device *netdev; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				135
			 | 
			
			
				
				+	size_t mtu; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				136
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				137
			 | 
			
			
				
				+	/* Find appropriate network-layer protocol */ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				138
			 | 
			
			
				
				+	tcpip_net = tcpip_net_protocol ( st_dest ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				139
			 | 
			
			
				
				+	if ( ! tcpip_net ) 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				140
			 | 
			
			
				
				+		return 0; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				141
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				142
			 | 
			
			
				
				+	/* Find transmitting network device */ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				143
			 | 
			
			
				
				+	netdev = tcpip_net->netdev ( st_dest ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				144
			 | 
			
			
				
				+	if ( ! netdev ) 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				145
			 | 
			
			
				
				+		return 0; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				146
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				147
			 | 
			
			
				
				+	/* Calculate MTU */ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				148
			 | 
			
			
				
				+	mtu = ( netdev->max_pkt_len - netdev->ll_protocol->ll_header_len - 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				149
			 | 
			
			
				
				+		tcpip_net->header_len ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				150
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				151
			 | 
			
			
				
				+	return mtu; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				152
			 | 
			
			
				
				+} 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				153
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				125
			 | 
			
				154
			 | 
			
			
				
				 /** 
			 | 
		
		
	
		
			
			| 
				126
			 | 
			
				155
			 | 
			
			
				
				  * Calculate continued TCP/IP checkum 
			 | 
		
		
	
		
			
			| 
				127
			 | 
			
				156
			 | 
			
			
				
				  * 
			 |