Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'enetc-clean-endianness-warnings-up'

Claudiu Manoil says:

====================
enetc: Clean endianness warnings up

Cleanup patches to address the outstanding endianness issues
in the driver reported by sparse.
====================

Link: https://lore.kernel.org/r/20201119101215.19223-1-claudiu.manoil@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+43 -49
+4 -4
drivers/net/ethernet/freescale/enetc/enetc_hw.h
··· 575 575 u8 smac_m[6]; 576 576 u8 dmac_h[6]; 577 577 u8 dmac_m[6]; 578 - u32 sip_h[4]; 579 - u32 sip_m[4]; 580 - u32 dip_h[4]; 581 - u32 dip_m[4]; 578 + __be32 sip_h[4]; 579 + __be32 sip_m[4]; 580 + __be32 dip_h[4]; 581 + __be32 dip_m[4]; 582 582 u16 ethtype_h; 583 583 u16 ethtype_m; 584 584 u16 ethtype4_h;
+39 -45
drivers/net/ethernet/freescale/enetc/enetc_qos.c
··· 128 128 return -ENOMEM; 129 129 } 130 130 131 - cbd.addr[0] = lower_32_bits(dma); 132 - cbd.addr[1] = upper_32_bits(dma); 131 + cbd.addr[0] = cpu_to_le32(lower_32_bits(dma)); 132 + cbd.addr[1] = cpu_to_le32(upper_32_bits(dma)); 133 133 cbd.cls = BDCR_CMD_PORT_GCL; 134 134 cbd.status_flags = 0; 135 135 ··· 506 506 return -ENOMEM; 507 507 } 508 508 509 - cbd.addr[0] = lower_32_bits(dma); 510 - cbd.addr[1] = upper_32_bits(dma); 509 + cbd.addr[0] = cpu_to_le32(lower_32_bits(dma)); 510 + cbd.addr[1] = cpu_to_le32(upper_32_bits(dma)); 511 511 eth_broadcast_addr(si_data->dmac); 512 - si_data->vid_vidm_tg = 513 - cpu_to_le16(ENETC_CBDR_SID_VID_MASK 514 - + ((0x3 << 14) | ENETC_CBDR_SID_VIDM)); 512 + si_data->vid_vidm_tg = (ENETC_CBDR_SID_VID_MASK 513 + + ((0x3 << 14) | ENETC_CBDR_SID_VIDM)); 515 514 516 515 si_conf = &cbd.sid_set; 517 516 /* Only one port supported for one entry, set itself */ 518 - si_conf->iports = 1 << enetc_get_port(priv); 517 + si_conf->iports = cpu_to_le32(1 << enetc_get_port(priv)); 519 518 si_conf->id_type = 1; 520 519 si_conf->oui[2] = 0x0; 521 520 si_conf->oui[1] = 0x80; ··· 539 540 540 541 si_conf->en = 0x80; 541 542 si_conf->stream_handle = cpu_to_le32(sid->handle); 542 - si_conf->iports = 1 << enetc_get_port(priv); 543 + si_conf->iports = cpu_to_le32(1 << enetc_get_port(priv)); 543 544 si_conf->id_type = sid->filtertype; 544 545 si_conf->oui[2] = 0x0; 545 546 si_conf->oui[1] = 0x80; ··· 549 550 550 551 cbd.length = cpu_to_le16(data_size); 551 552 552 - cbd.addr[0] = lower_32_bits(dma); 553 - cbd.addr[1] = upper_32_bits(dma); 553 + cbd.addr[0] = cpu_to_le32(lower_32_bits(dma)); 554 + cbd.addr[1] = cpu_to_le32(upper_32_bits(dma)); 554 555 555 556 /* VIDM default to be 1. 556 557 * VID Match. If set (b1) then the VID must match, otherwise ··· 559 560 */ 560 561 if (si_conf->id_type == STREAMID_TYPE_NULL) { 561 562 ether_addr_copy(si_data->dmac, sid->dst_mac); 562 - si_data->vid_vidm_tg = 563 - cpu_to_le16((sid->vid & ENETC_CBDR_SID_VID_MASK) + 564 - ((((u16)(sid->tagged) & 0x3) << 14) 565 - | ENETC_CBDR_SID_VIDM)); 563 + si_data->vid_vidm_tg = (sid->vid & ENETC_CBDR_SID_VID_MASK) + 564 + ((((u16)(sid->tagged) & 0x3) << 14) 565 + | ENETC_CBDR_SID_VIDM); 566 566 } else if (si_conf->id_type == STREAMID_TYPE_SMAC) { 567 567 ether_addr_copy(si_data->smac, sid->src_mac); 568 - si_data->vid_vidm_tg = 569 - cpu_to_le16((sid->vid & ENETC_CBDR_SID_VID_MASK) + 570 - ((((u16)(sid->tagged) & 0x3) << 14) 571 - | ENETC_CBDR_SID_VIDM)); 568 + si_data->vid_vidm_tg = (sid->vid & ENETC_CBDR_SID_VID_MASK) + 569 + ((((u16)(sid->tagged) & 0x3) << 14) 570 + | ENETC_CBDR_SID_VIDM); 572 571 } 573 572 574 573 err = enetc_send_cmd(priv->si, &cbd); ··· 601 604 } 602 605 603 606 sfi_config->sg_inst_table_index = cpu_to_le16(sfi->gate_id); 604 - sfi_config->input_ports = 1 << enetc_get_port(priv); 607 + sfi_config->input_ports = cpu_to_le32(1 << enetc_get_port(priv)); 605 608 606 609 /* The priority value which may be matched against the 607 610 * frame’s priority value to determine a match for this entry. ··· 655 658 err = -ENOMEM; 656 659 goto exit; 657 660 } 658 - cbd.addr[0] = lower_32_bits(dma); 659 - cbd.addr[1] = upper_32_bits(dma); 661 + cbd.addr[0] = cpu_to_le32(lower_32_bits(dma)); 662 + cbd.addr[1] = cpu_to_le32(upper_32_bits(dma)); 660 663 661 664 cbd.length = cpu_to_le16(data_size); 662 665 ··· 664 667 if (err) 665 668 goto exit; 666 669 667 - cnt->matching_frames_count = 668 - ((u64)le32_to_cpu(data_buf->matchh) << 32) 669 - + data_buf->matchl; 670 + cnt->matching_frames_count = ((u64)data_buf->matchh << 32) + 671 + data_buf->matchl; 670 672 671 - cnt->not_passing_sdu_count = 672 - ((u64)le32_to_cpu(data_buf->msdu_droph) << 32) 673 - + data_buf->msdu_dropl; 673 + cnt->not_passing_sdu_count = ((u64)data_buf->msdu_droph << 32) + 674 + data_buf->msdu_dropl; 674 675 675 676 cnt->passing_sdu_count = cnt->matching_frames_count 676 677 - cnt->not_passing_sdu_count; 677 678 678 679 cnt->not_passing_frames_count = 679 - ((u64)le32_to_cpu(data_buf->stream_gate_droph) << 32) 680 - + le32_to_cpu(data_buf->stream_gate_dropl); 680 + ((u64)data_buf->stream_gate_droph << 32) + 681 + data_buf->stream_gate_dropl; 681 682 682 - cnt->passing_frames_count = cnt->matching_frames_count 683 - - cnt->not_passing_sdu_count 684 - - cnt->not_passing_frames_count; 683 + cnt->passing_frames_count = cnt->matching_frames_count - 684 + cnt->not_passing_sdu_count - 685 + cnt->not_passing_frames_count; 685 686 686 - cnt->red_frames_count = 687 - ((u64)le32_to_cpu(data_buf->flow_meter_droph) << 32) 688 - + le32_to_cpu(data_buf->flow_meter_dropl); 687 + cnt->red_frames_count = ((u64)data_buf->flow_meter_droph << 32) + 688 + data_buf->flow_meter_dropl; 689 689 690 690 exit: 691 691 kfree(data_buf); ··· 789 795 return -ENOMEM; 790 796 } 791 797 792 - cbd.addr[0] = lower_32_bits(dma); 793 - cbd.addr[1] = upper_32_bits(dma); 798 + cbd.addr[0] = cpu_to_le32(lower_32_bits(dma)); 799 + cbd.addr[1] = cpu_to_le32(upper_32_bits(dma)); 794 800 795 801 sgce = &sgcl_data->sgcl[0]; 796 802 797 803 sgcl_config->agtst = 0x80; 798 804 799 - sgcl_data->ct = cpu_to_le32(sgi->cycletime); 800 - sgcl_data->cte = cpu_to_le32(sgi->cycletimext); 805 + sgcl_data->ct = sgi->cycletime; 806 + sgcl_data->cte = sgi->cycletimext; 801 807 802 808 if (sgi->init_ipv >= 0) 803 809 sgcl_config->aipv = (sgi->init_ipv & 0x7) | 0x8; ··· 819 825 to->msdu[2] = (from->maxoctets >> 16) & 0xFF; 820 826 } 821 827 822 - to->interval = cpu_to_le32(from->interval); 828 + to->interval = from->interval; 823 829 } 824 830 825 831 /* If basetime is less than now, calculate start time */ ··· 831 837 err = get_start_ns(now, sgi->cycletime, &start); 832 838 if (err) 833 839 goto exit; 834 - sgcl_data->btl = cpu_to_le32(lower_32_bits(start)); 835 - sgcl_data->bth = cpu_to_le32(upper_32_bits(start)); 840 + sgcl_data->btl = lower_32_bits(start); 841 + sgcl_data->bth = upper_32_bits(start); 836 842 } else { 837 843 u32 hi, lo; 838 844 839 845 hi = upper_32_bits(sgi->basetime); 840 846 lo = lower_32_bits(sgi->basetime); 841 - sgcl_data->bth = cpu_to_le32(hi); 842 - sgcl_data->btl = cpu_to_le32(lo); 847 + sgcl_data->bth = hi; 848 + sgcl_data->btl = lo; 843 849 } 844 850 845 851 err = enetc_send_cmd(priv->si, &cbd);