Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor11326651132665 NetDev_AddrMulticastRemove() Anchor11138501113850The next API function is the AddrMulticastRemove() function used to remove an (IP-to-Ethernet) multicast hardware address from a device. Anchor11138101113810

Files

...

11138111113811Every device driver’s net_dev.c Anchor11138171113817

Prototype

...

static void NetDev_AddrMulticastRemove CPU_INT08U *p_addr_hw, CPU_INT08U addr_hw_len, NET_ERR *p_err);
HTML Table
summary
classCode_Listing
Table Row (tr)
Table Cell (td)
rowspan2
Anchor
11138141113814
Code Block
          static void NetDev_AddrMulticastRemove (NET_IF
*p_if,
Anchor
11514781151478
Anchor
11514791151479
Anchor
11514801151480
Table Row (tr)

...

     *pif,
                                                  CPU_INT08U *paddr_hw,
                                                  CPU_INT08U  addr_hw_len,
                                                  NET_ERR    *perr);

Note that since every device driver’s AddrMulticastRemove() function is accessed only by function pointer via the device driver’s API structure, it doesn’t need to be globally available and should therefore be declared as ‘static’. Anchor11319831131983static’.

Arguments

Anchor11319841131984 p_if Anchor11319881131988pif

Pointer to the interface to remove a multicast address.

Anchor11138211113821 p_addr_hw Anchor11319901131990paddr_hw

Pointer to multicast hardware address to remove.

Anchor11138221113822addr_hw_len Anchor11319981131998

Length of multicast hardware address.

Anchor11138231113823 p_err Anchor11320031132003perr

Pointer to variable that will receive the return error code from this function.

...

Returned Value

...

None. Anchor11138261113826

Required Configuration

...

1113827Necessary only if if NET_MCAST_CFG_IPv4_RX_EN  or  NET_IPMCAST_CFG_MULTICAST_SEL IPv4_TX_EN is configured for transmit and receive multicasting (see section D-9-2 on page 752).anchor11146141114614

Notes / Warnings

Anchor11146151114615Use same exact code as in NetDev_AddrMulticastAdd() to calculate the device’s CRC hash (see section B-1-6 on page 362 NetDev_AddrMulticastAdd()), but remove a multicast address by decrementing the device’s hash bit reference counters and clearing the appropriate bits in the device’s multicast registers. Anchor11233441123344  

/* /* Use
 */
          /* Use NetDev_AddrMulticastAdd()
’s
's algorithm to calculate CRC hash.
*/ /* - REMOVE MULTICAST ADDRESS FROM DEVICE -- */
                            */
                                                            /* - REMOVE MULTICAST ADDRESS FROM DEVICE -- */
          paddr_hash_ctrs = &pdev_data->MulticastAddrHashBitCtr[hash];
if

          if (*paddr_hash_ctrs > 1u) {                      /* If multiple multicast addresses hashed, ..*/

             (*paddr_hash_ctrs)--;                          /* .. decrement hash bit reference counter ..*/
*perr =

              *perr = NET_DEV_ERR_NONE;                     /* .. but do NOT unconfigure hash register.
*/ return; }
  */
               return;
          }
          *paddr_hash_ctrs = 0u;                            /* Clear hash bit reference counter.
*/   if (hash <= 31u) { /* Clear multicast hash register bit. */
         */
           
          if (hash <= 31u) {                                /* Clear multicast hash register bit.        */
              pdev->MCAST_REG_LO &= ~(1u << reg_bit);       /* (Substitute
‘MCAST
 'MCAST_REG_LO/
HI’
HI' with ..
*/ } else { /* .. device’s actual multicast registers.) */
     */
          } else {                                          /* .. device's actual multicast registers.)  */
              pdev->MCAST_REG_HI &= ~(1u << reg_bit);
}
HTML Table
summary
classCode_Listing
Table Row (tr)
Table Cell (td)
rowspan2
Anchor
11146211114621
Code Block
                                                            /* ---------- CALCULATE HASH CODE ----------
*/
Anchor
11514811151481
Anchor
11514821151482
Anchor
11514831151483
Anchor
11514841151484
Anchor
11514851151485
Anchor
11514861151486
Anchor
11514871151487
Anchor
11514881151488
Anchor
11514891151489
Anchor
11514901151490
Anchor
11514911151491
Anchor
11514921151492
Anchor
11514931151493
Anchor
11514941151494
Anchor
11514951151495
Table Row (tr)

...


          }