Hi,

I added UDP multicast sending support to the 10G IP core.

Now all 224.0.0.0 through 239.255.255.255 are sent correctly with the corresponding multicast MAC.

Earlier these UDP packets would have incorrectly been routed through the gateway MAC (and e.g. our HP6400cl and Summit X450 did not detect and convert the header multicast-IP target MAC from the wrong into the correct multicast MAC upon switching the packet to another 10G port).

The "patch" is attached. It is a diff to "some" version of the 10G core, not the SVN, but the patch is rather short and you can apply it manually if it doesn't work directly.

Maybe you can commit the changes to the ibob/roach SVN?

By the way, there is one remaining TODO: I added provisions for TTL ('tx_ip_ttl'). Default TTL is 0xFF, but for multicast 0x01 is preferrable. The magic value X"8412" in the tx_ip_checksum_fixed_0 sum needs to be changed to include 'tx_ip_ttl'. I couldn't make sense of the X"8412" so the 0x01 TTL is not supported by the patch yet. Maybe somebody can figure out the computation?

 - Jan

--
****************************************************
 Helsinki University of Technology
 Dept. of Metsähovi Radio Observatory
 http://www.metsahovi.fi/~jwagner/
 Work +358-9-428320-36
--- original/ten_gb_eth.vhd     2008-12-13 23:09:44.000000000 +0200
+++ ten_gb_eth.vhd      2009-02-05 13:23:49.000000000 +0200
@@ -179,6 +179,7 @@ architecture ten_gb_eth_arch of ten_gb_e
        type tx_fsm_state is (
                        IDLE,
                        SEND_HDR_WORD_1,
+            SEND_HDR_WORD_1_MULTICAST,
                        SEND_HDR_WORD_2,
                        SEND_HDR_WORD_3,
                        SEND_HDR_WORD_4,
@@ -592,6 +593,7 @@ architecture ten_gb_eth_arch of ten_gb_e
        signal tx_addrfifo_full                        : std_logic;
        signal tx_addrfifo_write_data                  : std_logic_vector(63 
downto 0);
        signal tx_data_count                           : std_logic_vector(15 
downto 0) := (others => '0');
+    signal tx_ip_ttl                               : std_logic_vector( 7 
downto 0) := (others => '1');
        signal tx_ip_length                            : std_logic_vector(15 
downto 0) := (others => '0');
        signal tx_udp_length                           : std_logic_vector(15 
downto 0) := (others => '0');
        signal tx_ip_checksum_0                        : std_logic_vector(17 
downto 0) := (others => '0');
@@ -937,7 +938,13 @@ begin
                                        -- if the address fifo has anything for 
us and the local parameters are valid, we can safely assume that there is also 
data in the buffer and start a frame transmission
                                        if tx_addrfifo_valid = '1' and 
local_valid_retimed = '1' then
                                                -- the request for the MAC is 
done by combinatorial logic
+                        if tx_addrfifo_read_data(31 downto 28) = "1110" then
+                            tx_ip_ttl         <= X"FF";
+                            tx_state          <= SEND_HDR_WORD_1_MULTICAST;
+                        else
+                            tx_ip_ttl         <= X"FF";
                                                tx_state          <= 
SEND_HDR_WORD_1;
+                        end if;
                                                mac_tx_data_valid <= "11111111";
                                        end if;
                                        -- if the current cpu buffer is valid, 
we can start a frame transmission
@@ -946,6 +953,11 @@ begin
                                                tx_state          <= 
SEND_CPU_DATA;
                                                mac_tx_data_valid <= "11111111";
                                        end if;
+                when SEND_HDR_WORD_1_MULTICAST =>
+                                       -- if the MAC is ready then we can send 
the rest of the header and the data
+                                       if mac_tx_ack = '1' then
+                                               tx_state          <= 
SEND_HDR_WORD_2;
+                                       end if;
                                when SEND_HDR_WORD_1 =>
                                        -- if the MAC is ready then we can send 
the rest of the header and the data
                                        if mac_tx_ack = '1' then
@@ -1046,12 +1058,17 @@ with tx_state select mac_tx_data <=
                 tx_arp_cache_read_data(23 downto 16) & 
tx_arp_cache_read_data(31 downto 24) &
                 tx_arp_cache_read_data(39 downto 32) & 
tx_arp_cache_read_data(47 downto 40)
                        when SEND_HDR_WORD_1,
+               local_mac(39 downto 32) & local_mac(47 downto 40) &
+                tx_addrfifo_read_data(7 downto 0) & tx_addrfifo_read_data(15 
downto 8) &
+                "0" & tx_addrfifo_read_data(22 downto 16) & 
+                "01011110" & "00000000" & "00000001"
+                       when SEND_HDR_WORD_1_MULTICAST,
                X"00" & X"45" &
                 X"00" & X"08" &
                 local_mac(7 downto 0) & local_mac(15 downto 8) &
                 local_mac(23 downto 16) & local_mac(31 downto 24)
                         when SEND_HDR_WORD_2,
-               X"11" & X"FF" &
+               X"11" & tx_ip_ttl & -- 0x11=UDP, 0xFF=TTL
                 X"00" & X"40" &
                 X"00" & X"00" &
                 tx_ip_length(7 downto 0) & tx_ip_length(15 downto 8)
@@ -1089,7 +1106,7 @@ with tx_state select mac_tx_data <=
                (others => '0')
                         when others;
 -- compute the fixed part of the ip checksum (1's complement logic)
-tx_ip_checksum_fixed_0 <= ("00" & X"8412"                                      
     )+
+tx_ip_checksum_fixed_0 <= ("00" & X"8412"                                      
     )+ -- TODO: X"8412"==TTL 0xFF, what for TTL of 0x01?
                           ("00" & local_ip(31 downto 16)                       
     )+
                           ("00" & local_ip(15 downto 0)                        
     );
 tx_ip_checksum_fixed_1 <= ("0" & tx_ip_checksum_fixed_0(15 downto 0)           
     )+

Reply via email to