This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-AM243: cpsw can no longer enter EnetUdma_rxCqIsr after successfully received several mac2mac frames.

Part Number: LP-AM243

Tool/software:

Hi TI

We just removed ethernet phy chip in am243x-lp board and coneected RGMII tx to RGMII rx channel to simply test mac2mac function. We successfylly received several frames and can enter EnetUdma_rxCqIsr , but after that we can no longer enter EnetUdma_rxCqIsr, but we can see rx registers is continuously growing larger and larger.

I think cpsw module has received the packages, but why interrupt handlers can not be generated? Which configuration need I check, please give some advice. Thanks very much.  

We are using enet_lwip_cpsw example in SDK, we found that the other net port are not working well when this happen, we ping it but get no response after this happed.

We do more test and found that we can only receive 32 frames in our stack, if we send one frame per second, we will enter the error state in 32 seconds, if we send 100 frames in one second, we will enter the error state immediately.

When we change the number of packets field to 16, we can only receive 16 packets and then goto the error state.

  • Hi ,

    Thanks for your query.

    I will check on this and get back to you.

    Regards

    Ashwani

  • Hi Ashwani

    Thanks for your help.

    err_t
    ethernet_input(struct pbuf *p, struct netif *netif)
    {
      struct eth_hdr *ethhdr;
      u16_t type;
    #if LWIP_ARP || ETHARP_SUPPORT_VLAN || LWIP_IPV6
      u16_t next_hdr_offset = SIZEOF_ETH_HDR;
    #endif /* LWIP_ARP || ETHARP_SUPPORT_VLAN */
    
      LWIP_ASSERT_CORE_LOCKED();
    
      if (p->len <= SIZEOF_ETH_HDR) {
        /* a packet with only an ethernet header (or less) is not valid for us */
        ETHARP_STATS_INC(etharp.proterr);
        ETHARP_STATS_INC(etharp.drop);
        MIB2_STATS_NETIF_INC(netif, ifinerrors);
        goto free_and_return;
      }
    
      /* points to packet payload, which starts with an Ethernet header */
      ethhdr = (struct eth_hdr *)p->payload;
      LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE,
                  ("ethernet_input: dest:%"X8_F":%"X8_F":%"X8_F":%"X8_F":%"X8_F":%"X8_F", src:%"X8_F":%"X8_F":%"X8_F":%"X8_F":%"X8_F":%"X8_F", type:%"X16_F"\n",
                   (unsigned char)ethhdr->dest.addr[0], (unsigned char)ethhdr->dest.addr[1], (unsigned char)ethhdr->dest.addr[2],
                   (unsigned char)ethhdr->dest.addr[3], (unsigned char)ethhdr->dest.addr[4], (unsigned char)ethhdr->dest.addr[5],
                   (unsigned char)ethhdr->src.addr[0],  (unsigned char)ethhdr->src.addr[1],  (unsigned char)ethhdr->src.addr[2],
                   (unsigned char)ethhdr->src.addr[3],  (unsigned char)ethhdr->src.addr[4],  (unsigned char)ethhdr->src.addr[5],
                   lwip_htons(ethhdr->type)));
    
      type = ethhdr->type;
    #if ETHARP_SUPPORT_VLAN
      if (type == PP_HTONS(ETHTYPE_VLAN)) {
        struct eth_vlan_hdr *vlan = (struct eth_vlan_hdr *)(((char *)ethhdr) + SIZEOF_ETH_HDR);
        next_hdr_offset = SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR;
        if (p->len <= SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR) {
          /* a packet with only an ethernet/vlan header (or less) is not valid for us */
          ETHARP_STATS_INC(etharp.proterr);
          ETHARP_STATS_INC(etharp.drop);
          MIB2_STATS_NETIF_INC(netif, ifinerrors);
          goto free_and_return;
        }
    #if defined(LWIP_HOOK_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK_FN) /* if not, allow all VLANs */
    #ifdef LWIP_HOOK_VLAN_CHECK
        if (!LWIP_HOOK_VLAN_CHECK(netif, ethhdr, vlan)) {
    #elif defined(ETHARP_VLAN_CHECK_FN)
        if (!ETHARP_VLAN_CHECK_FN(ethhdr, vlan)) {
    #elif defined(ETHARP_VLAN_CHECK)
        if (VLAN_ID(vlan) != ETHARP_VLAN_CHECK) {
    #endif
          /* silently ignore this packet: not for our VLAN */
          pbuf_free(p);
          return ERR_OK;
        }
    #endif /* defined(LWIP_HOOK_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK_FN) */
        type = vlan->tpid;
      }
    #endif /* ETHARP_SUPPORT_VLAN */
    
    #if LWIP_ARP_FILTER_NETIF
      netif = LWIP_ARP_FILTER_NETIF_FN(p, netif, lwip_htons(type));
    #endif /* LWIP_ARP_FILTER_NETIF*/
    
      if (p->if_idx == NETIF_NO_INDEX) {
        p->if_idx = netif_get_index(netif);
        DebugP_log("%d", p->if_idx);
        if (1 == p->if_idx)
        {
          goto free_and_return;
        }
      }

    We add code 

        if (1 == p->if_idx)
        {
          /* we process the frame here */
          goto free_and_return;
        }
    in function ethernet_input, and it works well now. I think the stack didn't free the pbuf received from RGMII1, but we can consume the received packet here and don't pass it to upper stack, it is ok in our case.
    Thanks for you support, we really appreciate it.
  • it is ok in our case.

    Great to hear that.

    Regards

    Ashwani