sungem: fix multicast filter CRC calculation
From the Linux sungem driver, we know that the multicast filter CRC is implemented using ether_crc_le() which isn't the same as calling zlib's crc32() function (the zlib implementation requires a complemented initial value and also returns the complemented result). Fix the multicast filter by simply using the new net_crc32_le() function. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
		
							parent
							
								
									a89a6b052a
								
							
						
					
					
						commit
						8f90bc2f8f
					
				@ -11,12 +11,11 @@
 | 
				
			|||||||
#include "hw/pci/pci.h"
 | 
					#include "hw/pci/pci.h"
 | 
				
			||||||
#include "qemu/log.h"
 | 
					#include "qemu/log.h"
 | 
				
			||||||
#include "net/net.h"
 | 
					#include "net/net.h"
 | 
				
			||||||
 | 
					#include "net/eth.h"
 | 
				
			||||||
#include "net/checksum.h"
 | 
					#include "net/checksum.h"
 | 
				
			||||||
#include "hw/net/mii.h"
 | 
					#include "hw/net/mii.h"
 | 
				
			||||||
#include "sysemu/sysemu.h"
 | 
					#include "sysemu/sysemu.h"
 | 
				
			||||||
#include "trace.h"
 | 
					#include "trace.h"
 | 
				
			||||||
/* For crc32 */
 | 
					 | 
				
			||||||
#include <zlib.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TYPE_SUNGEM "sungem"
 | 
					#define TYPE_SUNGEM "sungem"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -595,7 +594,7 @@ static ssize_t sungem_receive(NetClientState *nc, const uint8_t *buf,
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Get MAC crc */
 | 
					    /* Get MAC crc */
 | 
				
			||||||
    mac_crc = crc32(~0, buf, 6);
 | 
					    mac_crc = net_crc32_le(buf, ETH_ALEN);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Packet isn't for me ? */
 | 
					    /* Packet isn't for me ? */
 | 
				
			||||||
    rx_cond = sungem_check_rx_mac(s, buf, mac_crc);
 | 
					    rx_cond = sungem_check_rx_mac(s, buf, mac_crc);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user