Skip to content

Commit 82804bd

Browse files
author
Nelson Escobar
committed
enic: Move function from header file to c file
JIRA: https://issues.redhat.com/browse/RHEL-84863 commit 025cf93 Author: Satish Kharat <satishkh@cisco.com> Date: Tue Mar 4 19:56:37 2025 -0500 enic: Move function from header file to c file Moves cq_enet_rq_desc_dec from cq_enet_desc.h to enic_rq.c. This is in preparation for enic extended completion queue enabling. Co-developed-by: Nelson Escobar <neescoba@cisco.com> Signed-off-by: Nelson Escobar <neescoba@cisco.com> Co-developed-by: John Daley <johndale@cisco.com> Signed-off-by: John Daley <johndale@cisco.com> Signed-off-by: Satish Kharat <satishkh@cisco.com> Link: https://patch.msgid.link/20250304-enic_cleanup_and_ext_cq-v2-1-85804263dad8@cisco.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Nelson Escobar <nescobar@redhat.com>
1 parent 1cac946 commit 82804bd

File tree

2 files changed

+84
-81
lines changed

2 files changed

+84
-81
lines changed

drivers/net/ethernet/cisco/enic/cq_enet_desc.h

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -88,85 +88,4 @@ struct cq_enet_rq_desc {
8888
#define CQ_ENET_RQ_DESC_FLAGS_IPV4_FRAGMENT (0x1 << 6)
8989
#define CQ_ENET_RQ_DESC_FLAGS_FCS_OK (0x1 << 7)
9090

91-
static inline void cq_enet_rq_desc_dec(struct cq_enet_rq_desc *desc,
92-
u8 *type, u8 *color, u16 *q_number, u16 *completed_index,
93-
u8 *ingress_port, u8 *fcoe, u8 *eop, u8 *sop, u8 *rss_type,
94-
u8 *csum_not_calc, u32 *rss_hash, u16 *bytes_written, u8 *packet_error,
95-
u8 *vlan_stripped, u16 *vlan_tci, u16 *checksum, u8 *fcoe_sof,
96-
u8 *fcoe_fc_crc_ok, u8 *fcoe_enc_error, u8 *fcoe_eof,
97-
u8 *tcp_udp_csum_ok, u8 *udp, u8 *tcp, u8 *ipv4_csum_ok,
98-
u8 *ipv6, u8 *ipv4, u8 *ipv4_fragment, u8 *fcs_ok)
99-
{
100-
u16 completed_index_flags;
101-
u16 q_number_rss_type_flags;
102-
u16 bytes_written_flags;
103-
104-
cq_desc_dec((struct cq_desc *)desc, type,
105-
color, q_number, completed_index);
106-
107-
completed_index_flags = le16_to_cpu(desc->completed_index_flags);
108-
q_number_rss_type_flags =
109-
le16_to_cpu(desc->q_number_rss_type_flags);
110-
bytes_written_flags = le16_to_cpu(desc->bytes_written_flags);
111-
112-
*ingress_port = (completed_index_flags &
113-
CQ_ENET_RQ_DESC_FLAGS_INGRESS_PORT) ? 1 : 0;
114-
*fcoe = (completed_index_flags & CQ_ENET_RQ_DESC_FLAGS_FCOE) ?
115-
1 : 0;
116-
*eop = (completed_index_flags & CQ_ENET_RQ_DESC_FLAGS_EOP) ?
117-
1 : 0;
118-
*sop = (completed_index_flags & CQ_ENET_RQ_DESC_FLAGS_SOP) ?
119-
1 : 0;
120-
121-
*rss_type = (u8)((q_number_rss_type_flags >> CQ_DESC_Q_NUM_BITS) &
122-
CQ_ENET_RQ_DESC_RSS_TYPE_MASK);
123-
*csum_not_calc = (q_number_rss_type_flags &
124-
CQ_ENET_RQ_DESC_FLAGS_CSUM_NOT_CALC) ? 1 : 0;
125-
126-
*rss_hash = le32_to_cpu(desc->rss_hash);
127-
128-
*bytes_written = bytes_written_flags &
129-
CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK;
130-
*packet_error = (bytes_written_flags &
131-
CQ_ENET_RQ_DESC_FLAGS_TRUNCATED) ? 1 : 0;
132-
*vlan_stripped = (bytes_written_flags &
133-
CQ_ENET_RQ_DESC_FLAGS_VLAN_STRIPPED) ? 1 : 0;
134-
135-
/*
136-
* Tag Control Information(16) = user_priority(3) + cfi(1) + vlan(12)
137-
*/
138-
*vlan_tci = le16_to_cpu(desc->vlan);
139-
140-
if (*fcoe) {
141-
*fcoe_sof = (u8)(le16_to_cpu(desc->checksum_fcoe) &
142-
CQ_ENET_RQ_DESC_FCOE_SOF_MASK);
143-
*fcoe_fc_crc_ok = (desc->flags &
144-
CQ_ENET_RQ_DESC_FCOE_FC_CRC_OK) ? 1 : 0;
145-
*fcoe_enc_error = (desc->flags &
146-
CQ_ENET_RQ_DESC_FCOE_ENC_ERROR) ? 1 : 0;
147-
*fcoe_eof = (u8)((le16_to_cpu(desc->checksum_fcoe) >>
148-
CQ_ENET_RQ_DESC_FCOE_EOF_SHIFT) &
149-
CQ_ENET_RQ_DESC_FCOE_EOF_MASK);
150-
*checksum = 0;
151-
} else {
152-
*fcoe_sof = 0;
153-
*fcoe_fc_crc_ok = 0;
154-
*fcoe_enc_error = 0;
155-
*fcoe_eof = 0;
156-
*checksum = le16_to_cpu(desc->checksum_fcoe);
157-
}
158-
159-
*tcp_udp_csum_ok =
160-
(desc->flags & CQ_ENET_RQ_DESC_FLAGS_TCP_UDP_CSUM_OK) ? 1 : 0;
161-
*udp = (desc->flags & CQ_ENET_RQ_DESC_FLAGS_UDP) ? 1 : 0;
162-
*tcp = (desc->flags & CQ_ENET_RQ_DESC_FLAGS_TCP) ? 1 : 0;
163-
*ipv4_csum_ok =
164-
(desc->flags & CQ_ENET_RQ_DESC_FLAGS_IPV4_CSUM_OK) ? 1 : 0;
165-
*ipv6 = (desc->flags & CQ_ENET_RQ_DESC_FLAGS_IPV6) ? 1 : 0;
166-
*ipv4 = (desc->flags & CQ_ENET_RQ_DESC_FLAGS_IPV4) ? 1 : 0;
167-
*ipv4_fragment =
168-
(desc->flags & CQ_ENET_RQ_DESC_FLAGS_IPV4_FRAGMENT) ? 1 : 0;
169-
*fcs_ok = (desc->flags & CQ_ENET_RQ_DESC_FLAGS_FCS_OK) ? 1 : 0;
170-
}
171-
17291
#endif /* _CQ_ENET_DESC_H_ */

drivers/net/ethernet/cisco/enic/enic_rq.c

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,90 @@ static void enic_rq_set_skb_flags(struct vnic_rq *vrq, u8 type, u32 rss_hash,
101101
}
102102
}
103103

104+
static void cq_enet_rq_desc_dec(struct cq_enet_rq_desc *desc, u8 *type,
105+
u8 *color, u16 *q_number, u16 *completed_index,
106+
u8 *ingress_port, u8 *fcoe, u8 *eop, u8 *sop,
107+
u8 *rss_type, u8 *csum_not_calc, u32 *rss_hash,
108+
u16 *bytes_written, u8 *packet_error,
109+
u8 *vlan_stripped, u16 *vlan_tci,
110+
u16 *checksum, u8 *fcoe_sof,
111+
u8 *fcoe_fc_crc_ok, u8 *fcoe_enc_error,
112+
u8 *fcoe_eof, u8 *tcp_udp_csum_ok, u8 *udp,
113+
u8 *tcp, u8 *ipv4_csum_ok, u8 *ipv6, u8 *ipv4,
114+
u8 *ipv4_fragment, u8 *fcs_ok)
115+
{
116+
u16 completed_index_flags;
117+
u16 q_number_rss_type_flags;
118+
u16 bytes_written_flags;
119+
120+
cq_desc_dec((struct cq_desc *)desc, type,
121+
color, q_number, completed_index);
122+
123+
completed_index_flags = le16_to_cpu(desc->completed_index_flags);
124+
q_number_rss_type_flags =
125+
le16_to_cpu(desc->q_number_rss_type_flags);
126+
bytes_written_flags = le16_to_cpu(desc->bytes_written_flags);
127+
128+
*ingress_port = (completed_index_flags &
129+
CQ_ENET_RQ_DESC_FLAGS_INGRESS_PORT) ? 1 : 0;
130+
*fcoe = (completed_index_flags & CQ_ENET_RQ_DESC_FLAGS_FCOE) ?
131+
1 : 0;
132+
*eop = (completed_index_flags & CQ_ENET_RQ_DESC_FLAGS_EOP) ?
133+
1 : 0;
134+
*sop = (completed_index_flags & CQ_ENET_RQ_DESC_FLAGS_SOP) ?
135+
1 : 0;
136+
137+
*rss_type = (u8)((q_number_rss_type_flags >> CQ_DESC_Q_NUM_BITS) &
138+
CQ_ENET_RQ_DESC_RSS_TYPE_MASK);
139+
*csum_not_calc = (q_number_rss_type_flags &
140+
CQ_ENET_RQ_DESC_FLAGS_CSUM_NOT_CALC) ? 1 : 0;
141+
142+
*rss_hash = le32_to_cpu(desc->rss_hash);
143+
144+
*bytes_written = bytes_written_flags &
145+
CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK;
146+
*packet_error = (bytes_written_flags &
147+
CQ_ENET_RQ_DESC_FLAGS_TRUNCATED) ? 1 : 0;
148+
*vlan_stripped = (bytes_written_flags &
149+
CQ_ENET_RQ_DESC_FLAGS_VLAN_STRIPPED) ? 1 : 0;
150+
151+
/*
152+
* Tag Control Information(16) = user_priority(3) + cfi(1) + vlan(12)
153+
*/
154+
*vlan_tci = le16_to_cpu(desc->vlan);
155+
156+
if (*fcoe) {
157+
*fcoe_sof = (u8)(le16_to_cpu(desc->checksum_fcoe) &
158+
CQ_ENET_RQ_DESC_FCOE_SOF_MASK);
159+
*fcoe_fc_crc_ok = (desc->flags &
160+
CQ_ENET_RQ_DESC_FCOE_FC_CRC_OK) ? 1 : 0;
161+
*fcoe_enc_error = (desc->flags &
162+
CQ_ENET_RQ_DESC_FCOE_ENC_ERROR) ? 1 : 0;
163+
*fcoe_eof = (u8)((le16_to_cpu(desc->checksum_fcoe) >>
164+
CQ_ENET_RQ_DESC_FCOE_EOF_SHIFT) &
165+
CQ_ENET_RQ_DESC_FCOE_EOF_MASK);
166+
*checksum = 0;
167+
} else {
168+
*fcoe_sof = 0;
169+
*fcoe_fc_crc_ok = 0;
170+
*fcoe_enc_error = 0;
171+
*fcoe_eof = 0;
172+
*checksum = le16_to_cpu(desc->checksum_fcoe);
173+
}
174+
175+
*tcp_udp_csum_ok =
176+
(desc->flags & CQ_ENET_RQ_DESC_FLAGS_TCP_UDP_CSUM_OK) ? 1 : 0;
177+
*udp = (desc->flags & CQ_ENET_RQ_DESC_FLAGS_UDP) ? 1 : 0;
178+
*tcp = (desc->flags & CQ_ENET_RQ_DESC_FLAGS_TCP) ? 1 : 0;
179+
*ipv4_csum_ok =
180+
(desc->flags & CQ_ENET_RQ_DESC_FLAGS_IPV4_CSUM_OK) ? 1 : 0;
181+
*ipv6 = (desc->flags & CQ_ENET_RQ_DESC_FLAGS_IPV6) ? 1 : 0;
182+
*ipv4 = (desc->flags & CQ_ENET_RQ_DESC_FLAGS_IPV4) ? 1 : 0;
183+
*ipv4_fragment =
184+
(desc->flags & CQ_ENET_RQ_DESC_FLAGS_IPV4_FRAGMENT) ? 1 : 0;
185+
*fcs_ok = (desc->flags & CQ_ENET_RQ_DESC_FLAGS_FCS_OK) ? 1 : 0;
186+
}
187+
104188
static bool enic_rq_pkt_error(struct vnic_rq *vrq, u8 packet_error, u8 fcs_ok,
105189
u16 bytes_written)
106190
{

0 commit comments

Comments
 (0)