devif: solarflare reading out all error codes from RX events
authorRoni Häcki <roni.haecki@inf.ethz.ch>
Mon, 18 Sep 2017 13:53:32 +0000 (15:53 +0200)
committerRoni Häcki <roni.haecki@inf.ethz.ch>
Mon, 18 Sep 2017 13:53:32 +0000 (15:53 +0200)
Signed-off-by: Roni Häcki <roni.haecki@inf.ethz.ch>

lib/devif/backends/net/solarflare/hw_queue.h

index c94fb80..46a09ac 100644 (file)
@@ -366,6 +366,7 @@ static inline errval_t sfn5122f_queue_handle_rx_ev_devif(sfn5122f_queue_t* q,
         descriptor per packet  */
     struct devq_buf* buf;
     size_t rx_head;
+
     sfn5122f_q_rx_ev_t ev;
     //sfn5122f_q_rx_user_desc_t d_user= 0;
     //sfn5122f_q_rx_ker_desc_t d = 0;
@@ -382,13 +383,32 @@ static inline errval_t sfn5122f_queue_handle_rx_ev_devif(sfn5122f_queue_t* q,
     *flags = buf->flags;
 
     if(!sfn5122f_q_rx_ev_rx_ev_pkt_ok_extract(ev)) {   
-         if (sfn5122f_q_rx_ev_rx_ev_tobe_disc_extract(ev)) {
-            // packet discared by softare -> ok
+        if (sfn5122f_q_rx_ev_rx_ev_tobe_disc_extract(ev)) {
+            // packet discared by software -> ok
+            printf("Discard \n");
             err = NIC_ERR_RX_DISCARD;
-         } else if (sfn5122f_q_rx_ev_rx_ev_buf_owner_id_extract(ev)) {
-             printf("Wrong owner \n");
-             err = NIC_ERR_RX_PKT;
-         }
+        } else if (sfn5122f_q_rx_ev_rx_ev_buf_owner_id_extract(ev)) {
+            printf("Wrong owner \n");
+            err = NIC_ERR_RX_PKT;
+        } else if (sfn5122f_q_rx_ev_rx_ev_frm_trunc_extract(ev)) {
+            printf("Frame truncated \n");
+            err = NIC_ERR_RX_PKT;
+        } else if (sfn5122f_q_rx_ev_rx_ev_tcp_udp_chksum_err_extract(ev)) {
+            printf("UDP/TCP checksum error \n");
+            err = NIC_ERR_RX_PKT;
+        } else if (sfn5122f_q_rx_ev_rx_ev_pkt_not_parsed_extract(ev)) {
+            printf("Card error while parsing \n");
+            err = NIC_ERR_RX_PKT;
+        } else if (sfn5122f_q_rx_ev_rx_ev_ip_frag_err_extract(ev)) {
+            printf("IP header ckecksum error (Fragment)\n");
+            err = NIC_ERR_RX_PKT;
+        } else if (sfn5122f_q_rx_ev_rx_ev_ip_hdr_chksum_err_extract(ev)) {
+            printf("IP header ckecksum error \n");
+            err = NIC_ERR_RX_PKT;
+        } else {
+            printf("Unknown error \n");
+            err = NIC_ERR_RX_PKT;
+        }
     } else {
         *valid_length = sfn5122f_q_rx_ev_rx_ev_byte_ctn_extract(ev);
         /* Length of 0 is treated as 16384 bytes */
@@ -408,7 +428,6 @@ static inline errval_t sfn5122f_queue_handle_rx_ev_devif(sfn5122f_queue_t* q,
     */
     /* only have to reset event entry */
     sfn5122f_queue_clear_ev(ev);
-
     sfn5122f_queue_bump_rxhead(q);
     return err;
 }